Question:
How do you move the position of a sprite in smileBASIC?


Answer:

After defining your sprite using the command SPSET, you can use the command SPOFS to move it to a different position on the screen! Let's say your sprite definition number is 0 for the sprite you want to move. Your code would look like this:

SPOFS 0,60,100

SPOFS allows you to change the X coordinate and Y coordinate of a sprite on the screen. So in the above example, the 60 is the new X coordinate and 100 is the new Y coordinate of the sprite.

Run this code and see what happens. Your sprite should now have a new position on the screen! Congratulations! Try to make the sprite go in other parts of the screen! Explore and see what you can do!

Page updated: October 17th, 2015 @ 11:23 PM Eastern Time

Copyright 2010-2019 ExecuteCode.com.
All Rights Reserved.
Our other websites: