Fleshed out createSprite DOC files
This commit is contained in:
@@ -1,4 +1,38 @@
|
||||
#title CreateSprite [RCBasic Doc]
|
||||
#header function CreateSprite( img )
|
||||
|
||||
Returns new sprite
|
||||
This function returns a new sprite which you can place in a variable for use in your program.
|
||||
|
||||
Here is an example of opening a sprite canvas layer, creating a sprite, setting it's position and finally displaying it.
|
||||
|
||||
#code
|
||||
isFullScreen = false
|
||||
vSync = true
|
||||
winWidth = 640
|
||||
winHeight = 480
|
||||
canViewPortX = 0
|
||||
canViewPortY = 0
|
||||
|
||||
OpenWindow("CreateSprite", winWidth, winHeight, isFullScreen, vSync)
|
||||
sCanvas = OpenCanvasSpriteLayer(canViewPortX, canViewPortY, winWidth, winHeight)
|
||||
Canvas(sCanvas)
|
||||
|
||||
DIM eye
|
||||
DIM eyeW
|
||||
DIM eyeH
|
||||
|
||||
eye = LoadImage("theEye.png")
|
||||
GetImageSize(eye, eyeW, eyeH)
|
||||
|
||||
eyeSprite = CreateSprite(eye, eyeW, eyeH)
|
||||
SetSpritePosition(eyeSprite, 100, 100)
|
||||
|
||||
While Not Key(K_ESCAPE)
|
||||
'ClearCanvas() For a sprite layer canvas, you don't need to call ClearCanvas. It's automatically called.
|
||||
Update() 'Update automatically deals with drawing the sprites on the sprite canvas.
|
||||
Wend
|
||||
#/code
|
||||
|
||||
#image "images/theEye.png"
|
||||
|
||||
#ref OpenCanvasSpriteLayer SetSpritePosition
|
||||
|
||||
Reference in New Issue
Block a user