Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


#Actualmypel16000

Posted 28 January 2013 - 01:20 PM

Hi, I am developing a top-down shooter and I have implemented walls on my map. I want my player to be able to move, but not go through the walls. I tried this method:

Move the player
If there is collision: undo the movement.

Problem is that sometimes my player got stuck, and other times, on touching the wall the player stopped completely (If the player is moving diagonally (up and right for example) and hots a wall on its right, I would like it to still move up like on all other games)

Any ideas on this?

Thank you,

Edit: As my walls are circles, "L" shapes and polygons, I have created a sprite containing the outlines and using pixel perfect collision, but the problem persists. Please, I need a consistent method and some code if possible please.

#2mypel16000

Posted 28 January 2013 - 01:20 PM

Hi, I am developing a top-down shooter and I have implemented walls on my map. I want my player to be able to move, but not go through the walls. I tried this method:

Move the player
If there is collision: undo the movement.

Problem is that sometimes my player got stuck, and other times, on touching the wall the player stopped completely (If the player is moving diagonally (up and right for example) and hots a wall on its right, I would like it to still move up like on all other games)

Any ideas on this?

Thank you,

Edit: As my walls are circles, "L" shapes and polygons, I have created a sprite containing the outlines and using pixel perfect collision, but the problem persists. Please, I need a consistent method and some code if possible please.

#1mypel16000

Posted 28 January 2013 - 01:18 PM

Hi, I am developing a top-down shooter and I have implemented walls on my map. I want my player to be able to move, but not go through the walls. I tried this method:

 

Move the player

If there is collision: undo the movement.

 

Problem is that sometimes my player got stuck, and other times, on touching the wall the player stopped completely (If the player is moving diagonally (up and right for example) and hots a wall on its right, I would like it to still move up like on all other games)

 

Any ideas on this?

 

Thank you,


PARTNERS