I found a new script to move a sprite:
when gf clicked set [x v] to [0] set [y v] to [0] forever go to x: (x) y:(y) end when [up arrow v] key pressed change [y v] by [10] when [down arrow v] key pressed change [y v] by [-10] when [right arrow v] key pressed change [x v] by [10] when [left arrow v] key pressed change [x v] by [-10]link
Last edited by Portalmaker (2012-12-07 17:31:02)
Offline
that would be a pretty jumpy script. And why the variables?
Offline
Oh the variables control the x/y position of the sprite.
Offline
This is a very good script but I am not sure if this is the right forum for it. I think it suits Help With Scripts better.
Offline
The variables are pointless, and those hat blocks cause very choppy movement. It creates better performance if you do this:
when gf clicked go to x: (0) y: (0) forever if <key [up arrow v] pressed?> change y by (10) end if <key [down arrow v] pressed?> change y by (-10) end if <key [right arrow v] pressed?> change x by (10) end if <key [left arrow v] pressed?> change x by (-10) end end
Offline
lalala3 wrote:
The variables are pointless, and those hat blocks cause very choppy movement. It creates better performance if you do this:
when gf clicked go to x: (0) y: (0) forever if <key [up arrow v] pressed?> change y by (10) end if <key [down arrow v] pressed?> change y by (-10) end if <key [right arrow v] pressed?> change x by (10) end if <key [left arrow v] pressed?> change x by (-10) end end
Completely right.
Offline