Labyrinth!

Viraaj Marathe

CMPS161

Winter 2010





Description:


For my project, I did a variation of the Labyrinth game. Instead of a maze, there are three different colored balls that you have to get into their corresponding colored holes. The user can rotate and flip and turn the game board in any direction in order to move the balls.


Physics:


The physics of the game is basic kinematics with changing angles.


Basically, ax = g sin (thetax) and ay = g sin(thetay). In order to make the game easier to play, I had to have some sort of friction in order to slow the balls down so they don't keep bouncing around. Basically this changes the acceleration by a function of the normal force which is mgcos(theta). Doing so made the balls slow down a bit in order to make the game more playable.


I also implemented a jump function. The user can “flick” the board to make all the balls go in the air and jump over holes. The physics for this was basic projectile motion.


There is also elastic and inelastic collisions. The blue ball is able to bounce off of other balls, although I never was able to make it realistic to where it hits the balls. The other two balls stick to each other when they hit.


I implemented RK2 integration in order to do realistic physics for the balls. The acceleration is dependant in two dimensions in x and y, so you have to calculate it for two different thetas depending on how the board is alligned.


All kinematics animation was done using RK2 to make it smooth.



Screenshots:



Starting positions





Jumping Animation




Ball falling through a hole



Video:


Labyrinth Video




User Manual:


W – tilt board up

A – tilt board left

S – tilt board down

D – tilt board right

Space – Jump the balls


Links:


Source: maze.cpp