Original Post
Hi GameDev!
This is my first post here ^^
Now to le business.
The problem:
I have a side-scrolling-platform-game where you have 2 characters. The first one is the one you are in controll of. He is ready and done with all the controlls.
Then we have the enemy, lets call her Sarah.
Sarah will be at the left on the screen throwing stuff at you, and when you get close enough she will either walk or jump to the next waypoint in her waypointlist.After that she will continue to throw stuff at you. That is, untill you get close enough, then she will either walk or jump to the next waypoint and so on and so on.
My problem here is that i want to create a code for her jumping. i will have set of waypoints which will have 1) coordinates for the next place she wants to go and 2) if a jump is needed or not.
But i cant seem to find anywhere a similair code for that.
I've looked at parabola equations (http://www.wolframalpha.com/input/?i=y+%3D+%28x%5E2%29+%2F+%284+*+a%29+where+a+is+-1 and http://www.wolframalpha.com/input/?i=parabola+formula)
And also the throwing equation you learned in physics courses at high school (http://www.wolframalpha.com/input/?i=y+%3D+%28V0+*+sin%28a%29+*+t%29+-+%28%28g+*+t%5E2%29+%2F+2%29)
But I really can't seem to get a code where she jumps EXACTLY to the place i have in her waypoint-vector..
So the variables i have from the beggining och the jump are:
The distance in x.
The distance in y at the top (i will have the difference in Y in the the platforms + 128 pixels as a top for the parabola).
Asides from those two, i have tried to experiment things like starting veclocity in x and y, gravity and at which time (in frames) the jump would take.
Can somebody please give me either a code for this, a good site about this or something else useful i would be forever grateful!
Cheers!
/TheCalm
This is my first post here ^^
Now to le business.
The problem:
I have a side-scrolling-platform-game where you have 2 characters. The first one is the one you are in controll of. He is ready and done with all the controlls.
Then we have the enemy, lets call her Sarah.
Sarah will be at the left on the screen throwing stuff at you, and when you get close enough she will either walk or jump to the next waypoint in her waypointlist.After that she will continue to throw stuff at you. That is, untill you get close enough, then she will either walk or jump to the next waypoint and so on and so on.
My problem here is that i want to create a code for her jumping. i will have set of waypoints which will have 1) coordinates for the next place she wants to go and 2) if a jump is needed or not.
But i cant seem to find anywhere a similair code for that.
I've looked at parabola equations (http://www.wolframalpha.com/input/?i=y+%3D+%28x%5E2%29+%2F+%284+*+a%29+where+a+is+-1 and http://www.wolframalpha.com/input/?i=parabola+formula)
And also the throwing equation you learned in physics courses at high school (http://www.wolframalpha.com/input/?i=y+%3D+%28V0+*+sin%28a%29+*+t%29+-+%28%28g+*+t%5E2%29+%2F+2%29)
But I really can't seem to get a code where she jumps EXACTLY to the place i have in her waypoint-vector..
So the variables i have from the beggining och the jump are:
The distance in x.
The distance in y at the top (i will have the difference in Y in the the platforms + 128 pixels as a top for the parabola).
Asides from those two, i have tried to experiment things like starting veclocity in x and y, gravity and at which time (in frames) the jump would take.
Can somebody please give me either a code for this, a good site about this or something else useful i would be forever grateful!
Cheers!
/TheCalm