Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

The 20 Line Challenge / [DBC/DBP] rolling marble game

Author
Message
29 games
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 22nd Feb 2011 00:27
This is a little rolling marble game that I wrote.

You control the yellow marble, dodge the red marbles and collect the green marble. The game ends when you are hit by a red marble. Once the green marble has been collectec, another one appears in a random location.

To control the yellow marble you use the mouse. You have to sort of repeatedly flick the mouse left, right and up and down to get the marble to roll. I find it works best on a laptop touch pad.

The game was originally written in DBC but the method I used to get the marbles to roll didn\'t work in DBPro, so I had to change it. It\'s not as good but it looks ok.

DBC version:




DBPro version:




Hope you like it.
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 22nd Feb 2011 02:26
This is lots of fun!

I only got up to 12 though

Enjoy your day.
Zwonimir_2011
13
Years of Service
User Offline
Joined: 12th Feb 2011
Location: Somewhere close to Balkans and Alps
Posted: 23rd Feb 2011 01:17
This is great!
Also there's the code to make a ball roll on the right direction after its pivot has changed:


thx! I've searched a lot for this code! (I'll try to understand the meanings of that variables )
29 games
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 1st Mar 2011 22:22
Thanks for the comments. It's always nice to get praise from the internet.

Glad you found something useful Zwonimir

To give you a better understanding method I've used for the rolling, rather than expanding the code for the game and commenting it, I've come up with a simpler bit of code (DBP). I got rid of the various arrays, loops and game stuff and just focused on the controls, the maths and method of getting the ball to roll (I've also taken out friction so the marble might zoom off the screen if you're not careful).



This controls the global angular velocities and translates these into linear movement and local rotations. (You could control glabol linear motion and translate this into local rotations if you want, it doesn't really matter).

The main difference between the DBC and DBP version is that for the DBC version you can imagine the marble rolling on a tilting surface whereas the DBP version is more like a rolling wheel. So in the DBP version it's not perfect marble rolling.

I used the FIX PIVOT command in DBC to give the rolling effect (this essentially lines of the local x,y,z axis to the global x,y,z axis) but this didn't work in DBP and I can't figure out why this should be so.

@Latch
My hightest ever score is 11 so you're doing better than me.

I might modify the game to give it a gentler start.
Zwonimir_2011
13
Years of Service
User Offline
Joined: 12th Feb 2011
Location: Somewhere close to Balkans and Alps
Posted: 4th Mar 2011 01:06
Cool!
Thx 29 games!

Yeah I have to simulate the rotation of a ball on the ground depending of the direction ... of course moving it is not a proble with the command "move object", the problem is to simulate the rotation ... I don't wanna use a physics dll cause for the rest of my project physics is very singular and not realistic, so your algorithm is perfect for a rolling ball on the ground!
Daygamer
14
Years of Service
User Offline
Joined: 16th Mar 2010
Location: United States
Posted: 22nd May 2011 02:31
This is really fun!!!!! The ball rolling is really impressive. My high was 12! Thanks 29 games!

yrotate when you can spin?
God Bless!
/2007/dngsig.png[/img][/href]

Login to post a reply

Server time is: 2024-04-19 21:33:03
Your offset time is: 2024-04-19 21:33:03