In my side-scrolling platformer, the player goes through the 'running' costumes when the right or left arrow key's are clicked, but I cannot get the player to switch to an idle costume when it is not moving.
For movement costumes, I have:
when gf clicked forever if < key [right arrow] pressed > wait (0.1) secs switch to costume [running_1] wait (0.1) secs switch to costume [running_2] endAnd so on, and a variant of that for the left arrow key as well. But when I try:
when gf clicked forever if < not < key [right arrow] pressed > > switch to costume [idle] endthe player just flickers between running costumes and the idle costume and looks ridiculous.
Offline
What you need is this,
when gf clicked forever if <key [right arrow v] pressed?> point in direction [90 v] running costumes else if <key [left arrow v] pressed?> point in direction [-90 v] running costumes else if <key [up arrow v] pressed?> jumping costumes else if <key [space v] pressed?> attacking stuff else switch to costume [standing v] end end end endThat will work for running, jumping, and attacking. Hope this helps!
Last edited by sonicfan12p (2012-06-06 15:41:01)
Offline
In fact, I do have one more semi-related question - after my player has finished running to the left, I need it to switch to an Idle_left costume, and after running right, an Idle_right costume. How do I do that?
Thanks in advance,
SK
Offline
Ok, I'll edit the above post. And, your welcome!
About the script, you will need to select, only face left, right, next to the little picture of the sprite in the top left corner, instead of rotate.
Last edited by sonicfan12p (2012-06-06 15:14:26)
Offline
Oh, right! Forgot about that, on a regular circle graph, 270 is he same as -90. Sorry about that!
Offline
Shinkaze wrote:
@sonicfan12p Is there a glitch in your scripts? Because on the drop down menu of the 'point in direction ___' block, there is only 90, -90, 0 and 180, no 270.
SK
If you click the number, you can type in the box.
Offline
Shinkaze wrote:
@sonicfan12p Is there a glitch in your scripts? Because on the drop down menu of the 'point in direction ___' block, there is only 90, -90, 0 and 180, no 270.
SK
Ah, never mind, I just realised you could type it as well. But there still seems to be problem, when I press the left key, he moves left while the costumes change as if he is moving to the right. But afterwards (when he is idle) he is pointing left again. So, in short, it looks like he is doing the moonwalk.
Any ideas?
SK
Offline
How did you draw the sprite originally? was he pointing left or right in the original costume?
Offline
Maybe you accidentally selected the wrong direction to point in, double check and make sure.
Offline
You are very welcome! Helping people is what I'm here for.
Offline