How do you load custom sprites into smileBASIC?
Answer:
First, you need to have created a custom sprite sheet. You can see how to do that in the article: How do you make a custom sprite in smileBASIC?
Once you have a custom sprite created, in your code, you'll need to use the command LOAD. This command allows you to load an external file into your program to use. So we want to load your sprite sheet in your program so that we can use your custom sprite sheet and NOT the default sprites. Make sure you know the name of your sprite sheet. For example, if your sprite sheet is titled SPRITE_4_GAME, you would use the following code:
LOAD "GRP4:SPRITE_4_GAME" |
Now, run your code and see if you get an error when it tries to load. If you do get an error, check to see if the filename is spelled correctly. If you continue to get errors, make sure the sprite sheet file is in the same folder as the program you are working on. If you need to move file around, use the Manage Project/Files option on the Top Menu. (You may also need to change your current Active Project folder)
Once your game runs without errors, this means you can now use the character codes that correspond to the sprite you want to use on your sprite sheet to draw a specific custom sprite in your game.
You can use the Smile Tool to check the numbers for each of your sprites in your sheet. (They are 4 digit numbers) Just open the Smile Tool and click SPDEF at the bottom of the screen. Here you can scroll through the window to see all the sprites from your sprite sheet and each of their four digit codes.
Congratulations! You have now loaded your sprite sheet into your game! Explore and see what you can do! Now that you have your sprite sheet loaded, find out How to draw one of those sprite on the screen in smileBASIC here!
Page updated: October 17th, 2015 @ 10:30 PM Eastern Time |