how do i create a smooth running where my person changes costumes to look like he is running bt not interfere with other scripts, i cannot make him jump and run at same time unless i push button at exact time
Offline
I'm not too sure what you mean by the costume change... do you mean the sprite changes costume for each direction it's running or as it is running it continuously changes costumes? I think you mean the 2nd one and I'll write that script for you.
Make three separate scripts
when gf clicked forever if <key [left arrow v] pressed?> change x by [-10] end if <key [right arrow v] pressed?> change x by [10] end if <<key [left arrow v] pressed?> or <key [right arrow v] pressed ?>> set [running v] to [yes] else set [running v] to [no] end end when gf clicked forever if <key [up arrow v] pressed?> repeat [10] change y by [2] end if <not <key [up arrow v] pressed?>> change y by [-2] end end when gf clicked forever if <(running)=[yes]> next costume wait [0.2] secs end end
Offline
PhirripSyrrip wrote:
I'm not too sure what you mean by the costume change... do you mean the sprite changes costume for each direction it's running or as it is running it continuously changes costumes? I think you mean the 2nd one and I'll write that script for you.
Make three separate scriptswhen gf clicked forever if <key [left arrow v] pressed?> change x by [-10] end if <key [right arrow v] pressed?> change x by [10] end if <<key [left arrow v] pressed?> or <key [right arrow v] pressed ?>> set [running v] to [yes] else set [running v] to [no] end when gf clicked forever if <key [up arrow v] pressed?> repeat [10] change y by [2] end if <not <key [up arrow v] pressed?>> change y by [-2] end end when gf clicked forever if <(running)=[yes]> next costume wait [0.2] secs end end
Well that works, but I must say I prefer:
when gf clicked forever if <key [left arrow v] pressed?> repeat until <not <key [left arrow v] pressed?>> change x by [-1] end end if <key [right arrow v] pressed?> repeat until <not <key [right arrow v] pressed?>> change x by [1] end endIt makes it move quite smoothly, and, if you ask me, is totally worth it.
Last edited by wasabi56 (2012-05-27 19:40:59)
Offline
wasabi56 wrote:
Well that works, but I must say I prefer:
when gf clicked forever if <key [left arrow v] pressed?> repeat until <not <key [left arrow v] pressed?>> change x by [-1] set [running v] to [yes] end end set [running v] to [no] if <key [right arrow v] pressed?> repeat until <not <key [right arrow v] pressed?>> change x by [1] set [running v] to [yes] end end set [running v] to [no]It makes it move quite smoothly, and, if you ask me, is totally worth it.
(For the smooth moving, that is)
That fixed script combined with this script,
when gf clicked forever if <(running) = [yes]> switch to costume [first running costume v] repeat [2]//or however many other running costumes there are minus the first one. wait [0.01] secs next costume end else switch to costume [standing v] endwill fix your problem.
Offline