BB___SPRITEMOVEXY

=SPRITEMOVEXY= toc

Description
> This JustBASIC sprite command will cause a sprite to move automatically on each DRAWSPRITES execution. > Two variables define the amount of pixels to move on each coordinate. Setting those to 0 (zero) will cause the sprite to stop moving. > The Background and Sprites will not show up until a DRAWSPRITES command is issued.



GraphicBox Control

 * 1) Print #Handle.Extension, "spritemovexy spritename x y"
 * 2) #Handle.Extension, "spritemovexy spritename x y"
 * 3) #Handle.Extension "spritemovexy spritename x y"
 * 4) Print #Handle.Extension, "spritemovexy spritename "; varx;" "; vary
 * 5) #Handle.Extension, "spritemovexy spritename "; varx;" "; vary
 * 6) #Handle.Extension "spritemovexy spritename "; varx;" "; vary

Graphics Type Window

 * 1) Print #Handle, "spritemovexy spritename x y"
 * 2) #Handle, "spritemovexy spritename x y"
 * 3) #Handle "spritemovexy spritename x y"
 * 4) Print #Handle, "spritemovexy spritename "; varx;" "; vary
 * 5) #Handle, "spritemovexy spritename "; varx;" "; vary
 * 6) #Handle "spritemovexy spritename "; varx;" "; vary

Hints
> The sprites could be several images of a character walking. > **Only one graphicbox or graphics window in a program may use sprites.**

Example
//This example uses the image from this article. Save it to a folder of your choice and run this code from the same folder.// code format="lb" NOMAINWIN LOADBMP "BMP","sprite_jb_guy_1.bmp" Open "Just BASIC - Sprite Demo - SpriteMoveXY" For Graphics_nsb_nf as #main #main "Trapclose [quit]" #main "AddSprite player BMP"

[startMoving] #main "SpriteMoveXY player 3 3"

Timer 100, [repeat] Wait [repeat] #main "Drawsprites" wait

[quit] Timer 0 Close #main UNLOADBMP "BMP" End code

Useful Functions
code format="lb" Place a useful function using this keyword here code