Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Space Fortress code

Sign in to follow this  


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?
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!