BB___SPRITEORIENT

=SPRITEORIENT=

toc

Description
> This Just 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.
 * 1) Print #main, "SPRITEORIENT spritename mirror"
 * 2) #main, "SPRITEORIENT spritename mirror"
 * 3) #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 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 - 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 code

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