Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: sfml collision with textures  (Read 1719 times)

0 Members and 1 Guest are viewing this topic.

coolian

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
sfml collision with textures
« on: February 15, 2019, 10:44:29 pm »
so my problem is i have a tilemap which loades the textures from a tile set and i have a player which starts at the corner the player can be moved with wasd and shoot with the left mouse button now if i move the player i can move into walls and i dont want that but if i make the whole tilemap collidable it wont work because only some tiles are walls but since the tilemap is one sprite i cant do anything different so how can i implement collision my source code:https://pastebin.com/MzLFZBfK btw the tilemap and loading the textures and all that works fine i just need collision

badlukk

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: sfml collision with textures
« Reply #1 on: February 28, 2019, 08:42:06 pm »
Before your player moves, you need to check which tile they will move to and see if it's a wall, and then only move them if it isn't.

 

anything