|
CreateSprite | |
CreateSprite SpriteIndex | |
Parameters: SpriteIndex = The identifier of the sprite you wish to create |
|
Returns: NONE | |
CreateSprite initializes a sprite entity and adds it to PlayBasic active sprite list ready for use. What are Sprites ? Sprites can be thought of as an extended control layer over the image commands. The sprite system gives the user much easier and faster interface for controlling many images as once. Like we'll need when writing a game. The Sprite system includes controls for handling sprites depth ordering, collision, movement, local data through to real time rendering effects like Alpha Blending and Rotation to name a few. You can think of sprites as being the entity which houses the display properties of each characters appearance in your game, while the Image is merely the picture information. When we create a sprite, the CreateSprite command initializes our selected sprites properties to their defaults. It's properties are things like it's position, rotation angle, draw mode, collision mode, local data and of course it's image. Before a sprite can be visualized to the screen, it needs to be assigned an image to render (see SpriteImage). When a sprite is drawn, PlayBASIC uses the sprites current properties (it's X position,Y position, DrawMode, Rotation etc) to render the sprites assigned image at it's current location. Sprite Defaults X position = 0 Y position = 0 Z position = 0 Image = 0 ImageHandleX = 0 ImageHandleY = 0 AutoCenterSpritehandles =0 DrawMode = 0 Filter = 0 Rotation = 0 ScaleX = 1.0 ScaleY = 1.0 Collision = 1 CollisionClass = 1 TintColour = RGB(255,255,255) ($ffffff) FACTS: * Before you can see a sprite, you must assign it an image (that exists), then draw your sprites via DrawSprite, DrawALLSprites or DrawOrderedSprites * For sprites to be drawn based upon their Z order, you must use either DrawOrderedSprites or capture them to a scenebuffer (CaptureToScene and let the camera order them. * For Dynamic sprite creation see NewSprite * See GetFreeSprite to dynamically request free sprite index |
|
Example Source: Download This Example
|
Related Info: | DeleteSprite | GetFreeSprite | GetSpriteStatus | NewSprite | SpriteCollision | SpriteImage | SpriteQuantity : |
|
|||||||||||||||||||||||||||||||||||||||
(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com |