Does anyone know a good jumping routine, like one that will cause the character to jump up in the air and come down, and not one of those where its moves up 2 then down 2. One that looks like real gravity is in place. I'm not sure what I'll use this for, but I think it might be a mario game.
I have a matrix based "physics" routine made by BuilderBoy but it's designed to be used with xLIB and 8x8 pixel sprites. Would that be of any help?
Yes it would. I believe I will be using xlib eventually in the program anyways Smile
M'kay, I'll extract the basic code from my half-completed engine and post it up tomorrow. Smile
Thank you, I look forward to seeing the program. All the gravity simulators I have made always look really blocky, or just doesn't match actual physics in any way Sad oh well. Do you know what variables it uses so that I can begin working on it?
It needs like 5 variables minimum (although I can only remember the reason for 4 of them). Well.. less if you have very non-dynamic sprites Razz

If you mean what are the variables I use, well then: X, Z, E, D, and K (lol random variables and yes I know you shouldn't use X or Y but my engine is a WIP engine).

If I'm still not understanding and answering your question then ... it's 10 at night. I'm too tired to think Laughing
could one of the variables be the xor, and, or part? Also what does "0x5" mean, I have seen it on many forums on cemetech and wasn't sure.
Lol is the auto correct of l o l (without the spaces)
I don't quite remember why though...
They look blocky because you are working with a crappy screen.

As for jumping, just use the real physics. A jump is simply a falling body that starts with an initial upward velocity. So give your character some initial velocity, then repeatedly add the acceleration due to gravity (-9.8m/s^2) until the characters resulting position is back at where he started.

Or if you haven't taken any high school physics classes, here is an algorithm you can copy - since that is probably what you really want. Not to learn and research, just to copy/paste. I know this because you didn't just google for how to do this, you bugged all of us with a really basic question: http://www.gamedev.net/community/forums/topic.asp?topic_id=490713

As for 0x5 being lol, its a geeky joke Kerm took way too far.
_player1537 wrote:
could one of the variables be the xor, and, or part? Also what does "0x5" mean, I have seen it on many forums on cemetech and wasn't sure.


Variables (I remember now Laughing ): One is for the X location on the graph screen, one is for the Y location, one is for the bytes-from-left on the source pic (used for alternating sprites for walking), one is for horizontal flip, and one is for the xLIB getkey
Yup, I was going to say that you need an (X,Y) location for the player, a (Vx,Vy), and an (Ax,Ay). Ax should be some coefficient of friction if you want friction surfaces, and Ay is of course -9.81m/s^2 (of -32ft/s^2).
KermMartian wrote:
Yup, I was going to say that you need an (X,Y) location for the player, a (Vx,Vy), and an (Ax,Ay). Ax should be some coefficient of friction if you want friction surfaces, and Ay is of course -9.81m/s^2 (of -32ft/s^2).


wait, is this character jumping just straight up and down, or also forwards/backwards and off odd surfaces?

For straight up/down, the simplest solution would be just to specify an intial velocity (upwards, such as 5 pixels/frame), and subtract one or more pixels each frame until the player hits the ground again.

If you want the character to bounce, then just subtract one or more pixels from each frame each bounce.

Sure, it might not be completely accurate, but it'll look good, and for smaller jumps, it'll be fine.
i remember making some jumping engines way back when(ah the good old days...)
it's really not that difficult; you should just try to figure it out yourself before asking people.

Quote:
As for jumping, just use the real physics. A jump is simply a falling body that starts with an initial upward velocity. So give your character some initial velocity, then repeatedly add the acceleration due to gravity (-9.8m/s^2) until the characters resulting position is back at where he started.


to make this a little simpler: take your character sprite and estimate what his height would be in meters were he full-sized. then use the ratio of the characters estimated height in meters to his actual height in pixels to find the total number of pixels-per-meter (spr pixels/spr meters=x/1. solve by cross-multiplying). then find the number of pixels in ten(approximation) meters and make that the rate of change for your Y-acceleration variable
...or you could just guesstimate(i doubt anyone will know the difference, seeing how small the screen is). then just use a matrix for collision data and you're set!
oh, and friction is really unnecessary if you're writing in basic
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement