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! / help, platform physics

Author
Message
Vai mamar na pila
20
Years of Service
User Offline
Joined: 10th Nov 2004
Location: Behind Your Behind
Posted: 13th Jan 2005 09:55
i need to find a tut on makign a platfomr game, with collision for teh platforms and gravity, so that i can jump and land on platforms and that stuff, althoug i can only use math functions, has i dont want/cant use sprite collision command that comes with dbpro, where can i find this ?

changed name recently, remain the same, a.k.a sandra
Tapewormz
22
Years of Service
User Offline
Joined: 15th Sep 2002
Location: Winnipeg, Mantoba, Canada
Posted: 16th Jan 2005 14:56


You're probably not going to find ALL of that in one sample. You're going to have to search the code base for bits and pieces that will help you to learn how to do it.

The worst thing you can do is, ask for someone to hand over complete code for a game so that you can change it. A) You won't learn anything that way, and B) Alot of people work too hard on their projects, to just hand them over so they can be reverse engineered.

But like I said, you'll find alot of the answers to your questions in the codebase. If you ask for help with bits and pieces, you'll get help. Just not when you ask for an entire working game.

Vai mamar na pila
20
Years of Service
User Offline
Joined: 10th Nov 2004
Location: Behind Your Behind
Posted: 17th Jan 2005 03:27
Quote: "Just not when you ask for an entire working game.
"


you arendt understanding me, im not asking for a complete game source, im asking for platform collision code ! besides, i learn a lot looking into to others code, indeed its the best way to learn, at least IMHO.

changed name recently, remain the same, a.k.a sandra
Tapewormz
22
Years of Service
User Offline
Joined: 15th Sep 2002
Location: Winnipeg, Mantoba, Canada
Posted: 17th Jan 2005 08:47 Edited at: 17th Jan 2005 08:53
Use a tile based system and assign two different two dimensional arrays to each tile. for instance, tx(tile number,tile width) and ty(tile number,tile height).

Use these arrays to store the x,y collision data for each tile. In your main loop, check to make sure your sprite is not beaching the x/y coords supplied in the array for each tile.

There, I just supplied you with a theory on how to do your engine.

You'll also need a two dimensional array that holds your level. Perhaps something like map(map width, map height) which will store what tile is where.

So there you have it, three two dimensional arrays.

dim map(map_width, map_height) as integer
dim tilex(tile_number, tile_width) as integer
dim tiley(tile_number, tile_height) as integer


You define the map width/map height and the tile width/tile height, aswell as the number of tiles you have have in your tile set.

You'll know what tiles to check depending on what direction your object is moving. You won't need to check all 8 directions in your main loop, just 5 at the most.

All you need to do now is assemble a bunch of IF STATEMENTS to set your conditions. You'll also need DATA STATEMENTS that contain your map data and your tile collision table.

Tapewormz
22
Years of Service
User Offline
Joined: 15th Sep 2002
Location: Winnipeg, Mantoba, Canada
Posted: 17th Jan 2005 09:09
Check out pizzaman's tutorial. This will help with most of what you need.

http://forum.thegamecreators.com/?m=forum_view&t=45363&b=4

Vai mamar na pila
20
Years of Service
User Offline
Joined: 10th Nov 2004
Location: Behind Your Behind
Posted: 17th Jan 2005 17:07
thanks Tapewormz, that indeed helped me plenty , i oewn you one

changed name recently, remain the same, a.k.a sandra

Login to post a reply

Server time is: 2025-05-16 23:40:55
Your offset time is: 2025-05-16 23:40:55