How To Use Draw And Swap Commands

Hello I need some help
Im trying to make it so that a (Non Player) sprite moves up after a second but I cant find out how to make it wait before the draw command
I tryed just adding 0.1 to a varible inside the "On Draw" and then using if Time = 10 then draw but then the moment it became 11 it disappered.
does anyone know how to sole this?
if you need more info let me know

Try moving your move logic to the game’s loop handler and instead of draw use swap. (draw does just that, it draws on the frame it is called and has no lasting effects beyond that.)

I will but the docs does not have very much info on swap. how do i set the cord it swaps to

When called in a tile’s event handler it affects that tile. If you want to target another tile you need to use tell, eg.

tell x,y to
  swap “white”
1 Like

I tryed
on loop do
tell 10,10 to
swap Goalie
but it just stays in the same place.

Swap means put this tile at the location you are calling tell on. I'm assuming your goalie was already at 10,10 so you're replacing the goalie with another goalie.

You probably need to do something like:

tell 10,9 to
  swap "goalie"

tell 10,10 to
  swap "white"

This puts the goalie at 10,9 and sets the white background at 10,10. If you are using a differently named background tile, use the name of that instead. Make sure you use the correct capitalisation in the names of the tiles you want.


Thank you so much! that worked great!