DRAWSPRITES: 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 command updates the sprite display and is therefore mandatory when using sprites. All the visible sprites will be drawn on the BACKGROUND. Without this command you will not see the sprites or the BACKGROUND.
Syntax
- print #WindowHandle.controlHandle, "Drawsprites"
- #WindowHandle.controlHandle "Drawsprites"
Hints
- DRAWSPRITES is mostly used in timed loops with the help of the TIMER.
Example
BMP files that will be used in the example below:
This example uses the images from above. Save them to a folder of your choice and run this code from the same folder.
NOMAINWIN
LOADBMP "BMP1","sprite_jb_back.bmp"
LOADBMP "BMP2","sprite_jb_guy_1.bmp"
Open "Just BASIC - Sprite Demo - Drawsprites" For Graphics_nsb_nf as #main
#main "Trapclose [quit]"
#main "Background BMP1"
#main "AddSprite player BMP2"
' go to the redraw branch every 56 milliseconds
Timer 56,[redraw]
Wait
[redraw]
' the Drawsprites command is issued every 56 milliseconds
#main "Drawsprites"
Wait
[quit]
Timer 0
Close #main
UNLOADBMP "BMP1"
UNLOADBMP "BMP2"
End
Useful Procedures
' Place a useful function or sub using this keyword here