Page 2 of 2

Re: Blobby aKa the new mario

Posted: Fri 05 Dec, 2008 1:05 am
by cjgone
I'm assuming they want this: y=Vo*t + 1/2 at^2, where y is distance it travels up, Vo = initial vertical velocity, a = gravity or 9.8 m/s^2 and t for time.

Basically you need to figure out what you want your initial velocity to be, or how fast you want to throw it upwards. That will allow you to figure out how high it will go and the time it takes for you to throw it up and for it to fall down to the ground.

Now, once you have the time, all you need to do is have a separate velocity, or horizontal velocity, to determine how much you want it to travel forward.
Example of have to use this equation please using 9.8 m\s\s would be appreciated.

Probably gonna precalculate the values then do what driesgrudolf said or whatever his user is. ;o

Re: Blobby aKa the new mario

Posted: Fri 05 Dec, 2008 6:20 am
by calc84maniac
What I do in my Mario game is:
a) Have an x and y velocity for each object
b) Each frame, add the x velocity to the x position and the y velocity to the y position
c) Each frame, also add a gravity value to the y velocity
d) Also handle the x velocity in each frame depending on what arrow keys are pressed, which allows for "sliding"

Re: Blobby aKa the new mario

Posted: Fri 05 Dec, 2008 10:27 am
by driesguldolf
cjgone wrote:
-snip-
Example of have to use this equation please using 9.8 m\s\s would be appreciated.

Probably gonna precalculate the values then do what driesgrudolf said or whatever his user is. ;o
That is exactly how it works, however the 9.8 m/s probably won't work very well (since you don't want 'real' jumps, and mario usually jumps rather high). In your simulation the meters are pixels and seconds are frames.

Mine was just a worked out example of the actual theory behind it (as ISUCK explained).

Re: Blobby aKa the new mario

Posted: Mon 26 Jan, 2009 3:36 am
by cjgone
awesomenessssss

Image

Re: Blobby aKa the new mario

Posted: Tue 27 Jan, 2009 11:45 am
by tr1p1ea
WOW! Looking fantastic cjgone! Its basically almost complete by the looks of things, at least it would be very playable if you were to release it now.

As far as physics is concerned, you dont need to use constant accel equations or any other worldy physics formulas. Simple addition of your acceleration is sufficient, sort of like:

Acceleration = Constant
Velocity = Velocity + Acceleration
Position = Position + Velocity

To make something 'jump' just set 'Velocity' to -10 or something, and maybe an acceleartaion of 2. You will have to play around with these values.

Re: Blobby aKa the new mario

Posted: Wed 28 Jan, 2009 4:17 am
by cjgone
Thanks. I'm planning to add "physics" to up and down.


I already use speeding up for left\right in the screeny using the velocity \ acceleration add method -- a bit choppy since it's either like 1 \ 2 \ 3 pixels, but i'm pretty lazy heh. I'm also using lists of x and y residuals to give things like throwing veggies and crap more of a "natural" throw (already implemented in the particles to give them a more realistic fall). Unfortunately, can't do that with some objects that interact with the tile maps, because of a lame limitation I coded.

Score system , I still gotta plan that out since it's a bit tougher then I expected, again due to a coding limitation (the score you get from killing crap is an object that's pretty much a discrete unit, so 20 isn't 20, it's jsut a pic of 20 and cannot become 30 atm.. My engine doesn't allow for special objects atm, so i'm trying to find another way). :(

Some more bugs to be fixed when I get some time. :D and i'm gonna art crazy and make like a gazzilion bitmap pics to give the game abetter look, since it still appears a bit bleak atm. (not to mention my XOR drawing, which I need to find an AND\OR clipping routine.)