SPRITEORIENT: Difference between revisions
Jump to navigation
Jump to search
m (Text replacement - "Building Blocks Categories" to "Building Blocks") |
m (1 revision imported) |
Latest revision as of 03:04, 11 October 2023
Description
- This BASIC command will change the orientation of a Sprite.
- The four possible directions are: normal (this is the default orientation), flip, mirror, and rotate180.
- The Background and Sprites will not show up until a DRAWSPRITES command is issued.
Syntax
- Possible syntax using mirror orientation as an example.
- Print #main, "SPRITEORIENT spritename mirror"
- #main, "SPRITEORIENT spritename mirror"
- #main "SPRITEORIENT spritename mirror"
Hints
- Lets suppose you want to have your playable character facing to the right direction when he goes into that direction but the bitmap of such sprite is looking to the left. Then use mirror to make the sprite face the other way around.
Example
- This example uses the image from above. Save it to a folder of your choice and run this code from the same folder.
NOMAINWIN
LOADBMP "BMP","sprite_jb_guy_1.bmp"
Open "Just BASIC - Sprite Demo - SPRITEORIENT" For Graphics_nsb_nf as #main
#main "Trapclose [quit]"
#main "AddSprite player BMP"
#main "Drawsprites"
' each timer will add a pause of 1000ms to actually see the change
Timer 1000, [first]
Wait
[first]
Timer 0
#main "SPRITEORIENT player mirror"
#main "Drawsprites"
Timer 1000, [second]
wait
[second]
Timer 0
#main "SPRITEORIENT player flip"
#main "Drawsprites"
Timer 1000, [third]
wait
[third]
Timer 0
#main "SPRITEORIENT player rotate180"
#main "Drawsprites"
Timer 1000, [fourth]
wait
[fourth]
Timer 0
#main "SPRITEORIENT player normal"
#main "Drawsprites"
Timer 1000, [first]
wait
[quit]
Timer 0
Close #main
UNLOADBMP "BMP"
End
Useful Procedures
' Place a useful function or sub using this keyword here