• entries
246
175
• views
153246

# Space Fortress code

160 views

if i had known it was going to turn out this way, i woulda started off as simply as possible. i'm working on the collision detection and response code again, and its just such a pain in the ass.

ok so i've gotten it so you can crash into the fortress and slide along its walls. there's no prob there anymore. the problem is more about aesthetic as far as i can tell right now. see, what i wanted to do was have a PreCollisionLogic and PostCollisionLogic bit, and have the collision be done by a generic collider in between. i overcomplicated it before it was even working, i know.

here's a general idea of what i'm doing in my game logic right now:

- move player along x.- check for collision between player and tilemap.- if colliding, reflect velocity in x and move player back along x.- move player along y.- check for collision between player and tilemap.- if colliding, reflect velocity in y and move player back along y.

now you can be sure this code works. if i could leave it be, i'd be golden. but i can't. i just can't. see, i'm going to need to do collisions between more than just one tilemap. for every object (or list) i need to collide the player with, i need to add the code twice. looking forward, every other object that needs to collide with the tilemap also has to go through this process. thats why i came up with the precoldet and postcoldet stuff.. but i can't seem to come up with a way to do the above code in a cleaner one-step manner. i have to move twice, and check for (and deal with) collisions twice.

anyone have any clues i could use?

There are no comments to display.

## Create an account

Register a new account