Hi, I was wondering is anyone could help me out. I'm trying to program Mario as my final for my comp sci. class. I'm not working about the actual Sprites now, just the basics, ie, moving, jumping and collisions. I'm stumped on the jumping part. Is there a good way to make him jump while retaining his x Velocity, and moving in a smooth arc?

Recommended Answers

All 9 Replies

Hold x velocity constant, set an initial upwards y velocity (depending on how hard he jumps). In each time interval reduce the y velocity by a fixed small amount (modelling the effect of gravity). As the y velocity reduces to zero then goes negative he will follow an inverted parabola, just like the physic says he should.

ahh, thanks for the help, it works now =]

Out of curiosity, what are you using for this project (as far as GUI package)? Java 3d?

I haven't messed with Java 3d yet, but I want to. Right now I'm just using the Rectangle class to store the information about the location of the ground, pipes, ect. and using the fillRect method to draw everything >.< It's pretty basic so far, no sprites yet...

GUI package?

I meant GUI package as in graphics package, OpenGL being an example of one, java 3d being another

I have no idea, lol

OpenGL and Java3D are only necessary for 3D work. You don't need to worry about them if you are working with 2D.

Yeah, and initially, I didn't realize that was the case

hahaha, ok, for a second there, I was worrying that I'd done something REALLY wrong, lol =P

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.