Challenge 10
Problem:
A character jumps up off a platform, and return under the influence of gravity – you cannot jump from midair.
Solution:
This one is is the hardest problem yet because I have to add so much code.
Create 2 sprites a ball or any object and a wall.
For the movement of the ball you must set what happens when you hit the keys.
Up- If there is a collision at a position x0, y1 make it relative , and set the verticle speed to -10
Left- If position is collision free x-4, y0 make it relative. Make it jump to a given position x-4, y0 make it relative.
Right-If a position is collision free x4,y0 make it relative and jump to a given position x4, y0 make it relative
You must make it that when it hits the wall it stops.
Collision event with block, move to contact position direction is direction, maximum is 12 and solid objects. and set the verticle speed to 0 to make it stop moving.
Step Event for the Ball
Coment check in air.
If a position is collision free, x0,y1 relative.
Set the gravity, direction 270 and the gravity 0.5
ELSE
Set the gravity, direction 270 and the gravity to 0.5.
Coment: Limit Verticle speed.
If variable has a value, variable is vspeed, value is 12 and the operation is larger than.
Set the value of a variable, variable is vspeed and the value is 12.
Make the wall object solid or the ball will slip through.
1 Comment »
Leave a Reply
-
Recent
-
Links
-
Archives
- April 2006 (2)
- March 2006 (5)
- February 2006 (9)
-
Categories
-
RSS
Entries RSS
Comments RSS
you’ve covered this one in detail
but gravity has to be zero when on the platform, otherwise can’t move left or right
anyone help?