This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-06-06 13:28:22

Shinkaze
Scratcher
Registered: 2012-05-27
Posts: 44

'Idle' costume for 'still' player

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]
end
And 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]
end
the player just flickers between running costumes and the idle costume and looks ridiculous.

Am I missing something simple?
SK


http://thisisagoodbook.com/images/shinkazesig2.png

Offline

 

#2 2012-06-06 14:53:40

sonicfan12p
Scratcher
Registered: 2011-11-16
Posts: 1000+

Re: 'Idle' costume for 'still' player

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
end
That will work for running, jumping, and attacking. Hope this helps!  smile

Last edited by sonicfan12p (2012-06-06 15:41:01)


Why are the secret organizations getting all the attention?  mad

Offline

 

#3 2012-06-06 15:01:11

Shinkaze
Scratcher
Registered: 2012-05-27
Posts: 44

Re: 'Idle' costume for 'still' player

@sonicfan12p It looks like once again, you've helped with the creation of my game - you've answered three of my questions now  big_smile ! Thank you!
SK


http://thisisagoodbook.com/images/shinkazesig2.png

Offline

 

#4 2012-06-06 15:07:05

Shinkaze
Scratcher
Registered: 2012-05-27
Posts: 44

Re: 'Idle' costume for 'still' player

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


http://thisisagoodbook.com/images/shinkazesig2.png

Offline

 

#5 2012-06-06 15:12:10

sonicfan12p
Scratcher
Registered: 2011-11-16
Posts: 1000+

Re: 'Idle' costume for 'still' player

Ok, I'll edit the above post. And, your welcome! big_smile
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)


Why are the secret organizations getting all the attention?  mad

Offline

 

#6 2012-06-06 15:37:14

Shinkaze
Scratcher
Registered: 2012-05-27
Posts: 44

Re: 'Idle' costume for 'still' player

@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


http://thisisagoodbook.com/images/shinkazesig2.png

Offline

 

#7 2012-06-06 15:38:34

sonicfan12p
Scratcher
Registered: 2011-11-16
Posts: 1000+

Re: 'Idle' costume for 'still' player

Oh, right!  roll  Forgot about that, on a regular circle graph, 270 is he same as -90. Sorry about that!


Why are the secret organizations getting all the attention?  mad

Offline

 

#8 2012-06-06 15:39:36

SciTecCf
Scratcher
Registered: 2011-11-23
Posts: 1000+

Re: 'Idle' costume for 'still' player

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.


http://bit.ly/LCZEJRhttp://bit.ly/LSONcOhttp://bit.ly/LF3vIc
http://trinary.site40.net/images/scratchrank.php?username=SciTecCf&amp;display=small

Offline

 

#9 2012-06-06 15:41:18

Shinkaze
Scratcher
Registered: 2012-05-27
Posts: 44

Re: 'Idle' costume for 'still' player

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


http://thisisagoodbook.com/images/shinkazesig2.png

Offline

 

#10 2012-06-06 15:43:01

sonicfan12p
Scratcher
Registered: 2011-11-16
Posts: 1000+

Re: 'Idle' costume for 'still' player

How did you draw the sprite originally? was he pointing left or right in the original costume?


Why are the secret organizations getting all the attention?  mad

Offline

 

#11 2012-06-06 15:46:42

Shinkaze
Scratcher
Registered: 2012-05-27
Posts: 44

Re: 'Idle' costume for 'still' player

sonicfan12p wrote:

How did you draw the sprite originally? was he pointing left or right in the original costume?

Pointing right, I downloaded it off the internet.


http://thisisagoodbook.com/images/shinkazesig2.png

Offline

 

#12 2012-06-06 15:47:48

sonicfan12p
Scratcher
Registered: 2011-11-16
Posts: 1000+

Re: 'Idle' costume for 'still' player

Maybe you accidentally selected the wrong direction to point in, double check and make sure.


Why are the secret organizations getting all the attention?  mad

Offline

 

#13 2012-06-06 15:50:44

Shinkaze
Scratcher
Registered: 2012-05-27
Posts: 44

Re: 'Idle' costume for 'still' player

Oh, yes, I had accidentally put 180 instead of -90.
Thanks for all the help!
SK


http://thisisagoodbook.com/images/shinkazesig2.png

Offline

 

#14 2012-06-06 15:52:49

sonicfan12p
Scratcher
Registered: 2011-11-16
Posts: 1000+

Re: 'Idle' costume for 'still' player

You are very welcome! Helping people is what I'm here for.  wink


Why are the secret organizations getting all the attention?  mad

Offline

 

Board footer