0

Hey I am making a game and i can make the character jump, but i am trying to make the character land on an object. I am trying to do this with object collision but im not sure how. My code for jumping for an image with a certain height is below. I was trying to do it when the character jumps to a certain height and collides with an object, its new location on the screen will be on top of the object but i am not sure how to add that in. any suggestions would be great.

//METHOD TO JUMP
	public void jump(){
		if(peak == false)
			v--;//character jumping
		if(v == 250)//max height for jump
			peak = true;
		if(peak == true && v <= 300){//returning to ground
			v++;
			if(v == 300){
				done = true;
			}
		}
	}
2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by NormR1
0

No idea what your code is supposed to do.
Can you explain your problem in terms of x and y values?
You have a character at one x,y location and an object at another x,y location.
Then what do you want to happen?
How are the x,y values changing for the two items in question?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.