Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
General
»
sfml collision with textures
Print
Pages: [
1
]
Author
Topic: sfml collision with textures (Read 1717 times)
0 Members and 1 Guest are viewing this topic.
coolian
Newbie
Posts: 6
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
Logged
badlukk
Newbie
Posts: 4
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.
Logged
Print
Pages: [
1
]
SFML community forums
»
Help
»
General
»
sfml collision with textures