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

#1 2011-06-07 10:44:02

redman123
New Scratcher
Registered: 2011-05-18
Posts: 18

Need help with jump and airkick movement !

http://scratch.mit.edu/projects/redman123/1843256

This time I tried to use the velocity in the script and put all of the stances in one script. But I have problem with jump and airkick movement !
It seems that there is a glitch in airkick movement.
Any tips ?
Or any master can re-script it for me ?

Offline

 

#2 2011-06-07 21:25:14

EdnaC
Scratcher
Registered: 2007-08-28
Posts: 100+

Re: Need help with jump and airkick movement !

I'm not sure what you want to happen, but would suggest separating the costume changes (stances) from the movement.  This may be simpler in the long run, I think that the costume changes in the movement (jump) are over-riding the kick. 

You can put together a script that cycles the character thru the kick costumes and make sure the timing is right to make it look good.  Then you need to decide when a kick should be allowed.  Think of what information the kick script needs to have about what the character is doing, and make variables to track that info. 

Here is my thought:

I think that you probably want the "kick" to only occur if the character is in a jump and is high enough.  So the jump script, when it gets the jump input, could cycle thru some costumes to represent the jump and then give the character upward velocity (as your script does now).  Once the character has left the ground, the script could set two variables:

Jumping = 1
HighEnoughToKick = 1

If the user gives the kick input, the script that cycles thru the kick costumes can test these variables to see if it should run.  If Jumping = 1 AND HighEnoughToKick = 1 then run the kick script, if either isn't true, ignore the input.

The motion (jump) script, would keep testing how high the character is, and when he is on the way down and too low to Kick, set HighEnoughToKick = 0.  When he is back on the ground, set Jumping = 0.  You could also use the Jumping variable in the motion script to prevent jumping again while you are already jumping.

There are lots of way to do things in programs, I always try to imagine what the program really needs and make variables to keep track of that info.  Hope this helps.

Last edited by EdnaC (2011-06-08 10:49:11)

Offline

 

#3 2011-06-08 18:26:25

redman123
New Scratcher
Registered: 2011-05-18
Posts: 18

Re: Need help with jump and airkick movement !

Thanks for the tips.
I will give it a try.

Offline

 

Board footer