Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Don't forget to read Tuesday's email newsletter for your chance to win a free copy of Construct 2!


stoffe1100

Member Since 02 Apr 2012
Offline Last Active Jun 03 2012 05:24 AM

Posts I've Made

In Topic: SDL collision detection!

02 June 2012 - 03:54 PM

I didn't quite get exactly what type of game you are creating and what exactly you are trying to achieve...
If you can answer those question I might be able to help you rethink your problem


Hmm, I am actually just doing this to train myself on sdl. But if i say mario? something like that.

In Topic: SDL collision detection!

02 June 2012 - 08:21 AM

What do you mean by strange? What are the exact problems you are facing?

Tile collision is pretty easy. Usually you have a 2d array representing the map, checking for collison simply invovlves getting the player position in the tile map
and indexing the array to check if this tile is passable.

Your code looks a bit overly complicated. Why do you have a for loop when checking for collisions?


Actually my map is stored in a 2 dimensional vector called map.

For the moment it works pretty well when colliding Up, Down and left. But i only get slowed when i collide from the right side. And if i push towards a wall i get pushed to the top of the wall without pressing up key. And sometimes i just fall under the whole map when colliding.

What i am really looking for is like a whole new structure for how my collsion should look like. I dont understand why it is over complicated? please tell me and i will try to explain.

Also when im colliding my ball is bouncing very quickly. Which it shouldnt because everything should be calculated and set back within one frame!

Ive been playing around with some stuffs and i updated the player::move() function. When it is like this the collision in the Y axis is working great. but the X axis collisions are super weird.

Please help me, i have no clue on how to continue. I cant stop thinking of those problems. its really anoying

PARTNERS