This example shows how to handle a large sprite on a system that supports sprite multiplexing. It also uses some constructs to automatically calculate the position of the sprites.
source
compile
sandbox
issues?
back to examples
OPTION EXPLICIT DEFINE IMAGE FREE HEIGHT DEFINE MSPRITE ASYNC BITMAP ENABLE COLOR BORDER GREEN DIM forestImage AS IMAGE DIM dragonBirdImage AS IMAGE DIM dragonBirdSprite AS MSPRITE DIM dragonBirdMove AS PATH DIM dragonBirdLeftMove AS PATH DIM dragonBirdRightMove AS PATH DIM dragonBirdX AS POSITION, dragonBirdY AS POSITION forestImage := LOAD IMAGE("forest.png") dragonBirdLeftMove = CREATE PATH( 300, 52 TO 0, 52 ) dragonBirdMove = dragonBirdRightMove dragonBirdImage := LOAD IMAGE("dragonbird.png") dragonBirdSprite = MSPRITE(dragonBirdImage IGNORE COLOR LIGHT RED) CLS PUT IMAGE forestImage AT 0, 0 DO TRAVEL dragonBirdMove TO dragonBirdX, dragonBirdY SPRITE dragonBirdSprite AT dragonBirdX, dragonBirdY IF dragonBirdX = 0 THEN dragonBirdMove = dragonBirdLeftMove ENDIF MSPRITE UPDATE LOOP
The instructions here refer to compiling the example from the command line. For Microsoft Windows
users we suggest using UGBASIC-IDE, which allows
you to download and compile each single example with just one click.
Are instructions for your specific home computer / console missing? First of all, check if your computer
is supported by clicking here. If so, since ugBASIC is a language which does not provide abstractions, it is possible
that this example will not work on your target. If you think this is an issue, please click here.
In order to compile the example, type this command on the command line:
Linux
ugbc.c128 -O prg -o sprites_example_09.prg sprites_example_09.bas
Windows
ugbc.c128.exe -O prg -o sprites_example_09.prg sprites_example_09.bas
For Microsoft Windows users we suggest using UGBASIC-IDE, which allows
you to download and compile this example with just one click.
In order to compile the example, type this command on the command line:
Linux
ugbc.c64 -O prg -o sprites_example_09.prg sprites_example_09.bas
Windows
ugbc.c64.exe -O prg -o sprites_example_09.prg sprites_example_09.bas
For Microsoft Windows users we suggest using UGBASIC-IDE, which allows
you to download and compile this example with just one click.
In order to compile the example, type this command on the command line:
Linux
ugbc.c64reu -O d64 -o sprites_example_09.d64 sprites_example_09.bas
Windows
ugbc.c64reu.exe -O d64 -o sprites_example_09.d64 sprites_example_09.bas
For Microsoft Windows users we suggest using UGBASIC-IDE, which allows
you to download and compile this example with just one click.
If you have found a problem trying to run this example, if you think there is a bug or, more
simply, you would like it to be improved, open an issue for this example on GitHub.
Thank you!
open an issue
BACK TO EXAMPLES