New to Pico-8 - Trying to get my feet wet. I created 3 sprites - 2 Bad Guys and 1 Good Guy. In the sprite editor my bad guys are located in location 000,001,002 and 016, 017, 018 while my good guy is located 003, 004, 005.
I am using a move_demo from here - Movement Demo by Shane Riley.
When the program is ran - I get the Bad Guy located at 000 to 002 to control. I tried changing some values around to get the sprite located @ 003 to 005 to no avail.
How do I go about doing this without cutting and pasting my Good Guy to the Bad Guy position?
It's been a great many years since I coded anything, FYI.
Hi Megazell! The values you want to change are the player.sprite ones. In your very case, you should set player.sprite to 3 at the beginning and then your move function should look like this:
function move() player.moving = true player.sprite += 1 if player.sprite > 5 then player.sprite = 3 end end
You would then be asking for your cart to use the sprites 003 to 005!
As an alternative, I'm a fan of setting an origin point for a sprite animation, and then cycling the displacement e.g.
function move() player.moving = true player.phase +=1 player.phase %=3 player.sprite = player.origin + player.phase end
Which does not use any 'if' clauses.
[Please log in to post a comment]