How do you draw a sprite on the screen in smileBASIC?


In your code, you will need to use the command SPSET, like this:

SPSET 0,0000

SPSET is a command that creates a sprite in your smileBASIC program. Sprites are a big part of your game. They can be animated, they can move around the screen by themselves or by user input (by the player pressing buttons), detect collisions, and more!

The 0 after the command is the management number of this sprite. You can set this number from 0 to 511, meaning you can have 512 active sprites at can do certain things in your game at one time. (You can also create a variable, assign a number between 0 to 511 to that variable, and use that variable in SPSET to assign the number. As a note, when your game projects have more complicated code, this practice will become very important!)

The 0000 is the four digit sprite definition numbers. This number is assigned to a certain sprite in your sprite sheet. You can use the Smile Tool to see what sprites are in your sprite sheet and what each of their numbers.

If you run your code, you should see your sprite appear in the top right corner of the screen. Congratulations! Your sprite is now drawn on the screen! Explore and see what you can do! Now you might want to move your sprite to a different spot on the screen. Find out How to move your sprite to a different place on the screen here!

Page updated: October 17th, 2015 @ 10:43 PM Eastern Time

Copyright 2010-2023
All Rights Reserved.
Our other websites: