Navigate InfoSuite
Hosted At
Link to Duke4
The Basics - Sprites


Now that you understand sectors and walls, it's time to learn about sprites. Sprites make a level much more interactive. A sprite is just an object. Weapons, ammo, enemies, babes, and even Duke himself are all sprites. There are also many 'special sprites', some of which are intangible (invisible and unknown to the player) within the game. These special sprites can do certain things depending on how you tag them. You'll learn about those in the next section.


Start a new map and make a sector. It doesn't really matter what size, just as long as you have enough space to move about. In 2D mode, point the mouse cursor somewhere inside your sector and press S. A pink object will appear, which looks like a circle with a line protruding from its center. This object is a sprite. The line signifies which direction the sprite is facing. By default, sprites face North/upwards. You can move sprites in 2D mode by dragging them with the Left Mouse Button. Note that if more than one sprite is on the same grid point, you will not see any of them flickering when highlighted, but you will still be able to move them. A sprite can be deleted with the Delete key.


If you look at the sprite in 3D mode, it will be automatically textured with the most common sprite texture to appear in the map. Since there are currently no other sprites in the map, it will be the default brown brick texture. Pressing S in 3D mode also places a sprite. If the mouse cursor is pointed at the floor or ceiling, the sprite will appear directly on the floor/ceiling. If the mouse cursor is pointed at the wall, the sprite will be placed flat against the wall (this is referred to as 'wall-alignment'). You can change the texture of a sprite just like everything else. Press V on it once, and you'll see a list of all the sprite textures currently being used in the map. Since there are no other sprites in the map, only the default texture will appear in the list. Press V again to get a complete texture list. You can pick anything you want: enemies, guns, lights, bottles, garbage cans... anything. Notice that pink pixels become invisible when used on sprites.



Highlight the sprite and press R. The sprite will become wall-aligned. You've just altered its relative alignment. There are three modes of relative alignment, all of which are cycled through using the R key: face-alignment (always faces the player), wall-alignment, and floor-alignment. Floor-alignment will cause some sprites to look meshed. As a general rule, only textures with dimensions which are powers of 2 will look proper in floor-alignment mode. For example, 64x128 would look normal, but 21x55 would not. You can change a sprite's angle in either 2D or 3D mode using , and . (better remembered as < and >). Since you cannot rotate the overall grid perspective in 2D mode, sprite angles are absolute (up is always up, down is always down, etc). This is important because the angle of a sprite can affect how it functions.


Some of the keypresses that apply to sectors also apply to sprites. You can move a sprite up and down using PGUP and PGDN. You can place a sprite directly on the ceiling or floor using Ctrl + PGUP or Ctrl + PGDN (this also happens automatically when you point at the floor or ceiling and place a new sprite with S). Note that if a sprite is directly on the floor or ceiling, it will stick to it while it moves up or down. You can shade a sprite with either Keypad + / - or with numerical values using Apostrophe ( ' ) + S. You can assign palette values to sprites as well. Use Alt + P and then enter any value from 0-25. Not all palette values cause a colour change. Check the "References - Palettes" section for details.


If you walk into the sprite in 3D mode, you will automatically step up onto it. This is because its blocking flag is on. You can tell because it is pink in 2D mode. If you want to block or unblock a sprite, press B on it. It will turn blue in 2D mode when the blocking flag is off. You can set the hitscan flag with H in 3D mode and Ctrl + H in 2D mode, but be aware that a blocked sprite will automatically be hittable. Also note that many 'active' sprites (such as enemies) will be automatically blocked and hittable in the game regardless of flag settings.


Many sprites are oversized by default. You can stretch or shrink a sprite manually using Keypad 2/4/6/8. Most 'active' sprites (weapons, health, enemies, etc) will automatically adjust themselves when the game starts, but I usually resize everything anyway.


Here are just a few more sprite attributes you can modify in 3D mode. Use T to cycle through the three modes of transparency: opaque, semi-transparent, and transparent. Pressing 1 on a sprite will make it one-sided (this is only relevant with wall-aligned or floor-aligned sprites). To change a sprite back to being two-sided, just press 1 on it again. You can also flip sprites. Use F to cycle through the 4 different flip variations. Make sure you play around with all of these keys to get a feel for them.



To move a group of vertices and/or sprites (or even an entire sector), hold Right Shift and drag the pink box over the objects/sector(s) you want to move. Once they're highlighted and flashing, use the Left Mouse Button to grab one of the highlighted objects and drag the whole unit wherever you want. Press Right Shift again to deselect it.

To copy sprites, hold Right Shift and drag the pink box over the sprite(s) which you want copied. Once they're highlighted and flashing, press Insert. The message "Sprites duplicated and stamped" will appear, and you can now use the Left Mouse Button to drag the sprite(s) off of the original and place them wherever you want. In Build, they must be dragged away individually; In Mapster32, they can be dragged away as a group (as long as they're still highlighted). Press Right Shift again to deselect the sprite(s) when you're finished. It is worth noting that even a single sprite must be highlighted before it can be copied using Insert!


Finishing Up

If you press C on a sprite (in 3D mode), it will become "true-centered", which means the height of the sprite will be relative to its actual center. However, by default sprite's are "foot-centered", which means that their height is determined according to the bottom of the sprite. You will almost never be making use of this key, so why the description? Because the knowledge that a sprite's height is determined according to its bottom is crucial, especially once you learn how to make sectors move up and down. While it may seem strange at first to use the bottom of a sprite as a reference for its actual height, this makes sense when you consider that the "center" of a sprite will differ for sprites of different sizes, whereas the bottom of a sprite is consistent for sprites of any size: It's always at the bottom!

You may notice that many textures have multiple frames. These are animated textures. While it is possible to use any of the individual frames, only the first frame (which should have a name assigned to it) will initialize the full texture animation. Textures with a name assigned to them often have a special function. These functions are not limited to animation. Many (in fact, most) textures with a name do not simply animate, but cause an object to initiate code and become active within the game. For example, if you wanted to place a Pig Cop in your level, you would have to texture a sprite with the PIGCOP texture (#2000). If you were to use an unnamed texture frame for an enemy, no code will be initiated and it won't function in the game. There are also other enemy textures such as PIGCOPSTAYPUT. These special textures will determine the enemy's initial position and behaviour. In the case of the STAYPUT textures, the enemy would not be allowed to leave their initial sector.

Note: If you raise an 'active' sprite above the ground (weapons, health, enemies, etc), most of them will automatically drop back to the floor in the game as soon as they "see" the player. These sprites are coded to do so. Check the "References - Compatibility Listings" section for the complete list.

Well, that covers the basics of sprites, so you can move on to the Tags section whenever you've had enough fun playing around.

Return to top