Navigate InfoSuite
Hosted At
Link to CGS
The Basics - Sprites

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 invisible in the game. These special sprites can do certain things depending on how you tag them. You'll learn about those in the next section.


Placing


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 is 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 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 on sprites.


Attributes


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 squared (power of 2) dimensions 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 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 have an effect on special sprites.


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 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 number 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 pertaining to the values.


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, 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.


Finishing Up


If you press C on a sprite, it will become "true-centered", which means the height of the sprite will be relative to its actual center. By default sprite's are "foot-centered", which means that their height is relative 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 from its bottom is very useful, especially once you learn how to make sectors move up and down.

When selecting textures, you may notice that many display a name. These are usually special textures which have a function in the game. For example, if you wanted to place a pigcop in your level, you would have to texture a sprite with the PIGCOP texture (#2000). If you use an unnamed texture for an enemy, 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.), it will automatically drop back to the floor in the game as soon as it "sees" the player. These sprites are coded to do so.


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