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.

2D All the way! / Donkey Kong tutorial?

Author
Message
Metroid Larvae
15
Years of Service
User Offline
Joined: 17th Oct 2008
Location:
Posted: 5th Aug 2009 23:14
I was trying to find a programming tutorial for this classic arcade game but it looks like noone has attempted it. I would like to try to clone this game but I'm stuck on even imagining what to do on the first ladder level. The ladders aren't straight which makes simulating gravity and making mario jump even harder. If anyone knows where I could find any articles on this it would be greatly appreciated.
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 6th Aug 2009 15:48 Edited at: 6th Aug 2009 16:05
You use map data where a 1 is a collision, and a zero isn't. You make the map like..

Data 0,0,0,0,0,1,0,0,0
Data 0,0,0,0,1,0,0,0,0
Data 0,0,0,1,0,0,0,0,0
Data 1,1,1,1,1,1,1,1,1

Now the 1's are a sloping ladder, and the bottom row is the ground.

The character moves in blocks of about 16 pixels at a time (but smoothly). So just a quick press of the button moves him 16 pixels. Which means that each Data entry is in fact 16 pixels squared of data. You can make ladders as number 2 as well which is a way to allow him to walk past them, it solves some issues with maintaining the button commands, it is just a different way of hitting the edges of the screen, which you can do as 1's around the border, or just an X value limit.

Dark Dragon
16
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 7th Aug 2009 20:49
Quote: "Data 0,0,0,0,0,1,0,0,0
Data 0,0,0,0,1,0,0,0,0
Data 0,0,0,1,0,0,0,0,0
Data 1,1,1,1,1,1,1,1,1

Now the 1's are a sloping ladder, and the bottom row is the ground."


Bottom Row should be Ground,in which the number is 1, but for slopes i'd use 2 or somthing else. that way when a collision is returned, you'll know how to do movement (1 - You can move straight, or 2 - You move right and up or left and down,etc...)

(\__/) HHAHAHAHAHAH!
(O.o ) / WORLD DOMINATION!!!!!!!!!!
(> < )
Neuro Fuzzy
16
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 8th Aug 2009 11:10
you could do these checks:
1. if the player is in a grid space above a "1" tile (ground), lock him above that one tile.
2. If the player is on a "2" tile (ladder), and the up key is pressed, move him up, if the down key is pressed, move him down. If above or below him is a "1" tile, limit him there.
3. If the player is on a "3" tile, he wins.

This, of course, will only allow for flat ground surfaces, and layers, but it's definitely a start.

Try searching for a 2d collision plugin. It shouldn't be too hard to find.

Also, you really don't need to worry about physics. It's not really a physics based game (physics meaning worrying about forces, work, bounciness, that sort of stuff).
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 8th Aug 2009 13:34
Actually, strike the 16 pixel movement, that was Pacman, and I don't think it applies to Donkey Kong, but you still have to tile it that way.

Login to post a reply

Server time is: 2024-03-28 20:04:46
Your offset time is: 2024-03-28 20:04:46