Page 1 of 1
marblemadness
Posted: Fri Apr 22, 2005 6:22 pm
by kenet
Hi ^^
i'm just trying to write a marble madness "clone", for fun... i didn't find a lot of information about the physics of the ball (how it realy work, tips and stuff...) and i was wondering if anybody around could be able to help me out with it!
I'm "just" trying to find a way to do it without too much headack you know

It that real physics or faked one ? any tuto on physics ball on 3d iso around ? stuff like that ^^;
any info/help welcome!
thx!
Posted: Fri Apr 22, 2005 9:08 pm
by Blade
That kind of movement is done whith just some inertia.
very basic fake code:
Code: Select all
if "left arrow" then vx-1
if "right arrow" then vx+1
if "up arrow" then vy-1
if "down arrow" then vy+1
xball+vx
yball+vy
if collision
;bouce back
vx=-vx
vy=-vy
endif
showthesprite()
(Al values have to be properly scaled)
Posted: Mon Apr 25, 2005 1:33 pm
by kenet
huummm are you realy sure about that ?
i mean what about the "gravity" when you go down and stuff ? how do you know the right direction to follow for the ball.
when you "say" to the ball to go on left and you passing by a "slope", she finaly go down. you know what i mean ? ^^
Posted: Mon Apr 25, 2005 3:52 pm
by Blade
Ok, my example was good for a "plain" ground. A good start anyway!
For slopes, simply add to vx and vy the right values just after the "if left" etc. statements.
i.e. if the ball is over an "horizontal" ramp, just add (or sub) something to the X speed.
How to compute the direction of a slope?
You already have a collision maps, right? Let's say formed by 16x16 pixels, to check what block is passable and what not.
Now add another map for slopes, same resolution to make things easier, saing "over this block the ball moves on the right of 5 pixels, and down 3 pixels"
Combining many blocks you can easily make hills and holes...
This is enough for a mini-golf game. Marble Madness is just a minigolf "on steroids"

Posted: Thu Apr 28, 2005 10:13 pm
by kenet
I see, i see that what basicly i was thinking

It look not that hard so far.
thx a lot for your help!
my first step will be doing an map editor... it will help me to start ^^;
thanx again!