SFML community forums
Help => General => Topic started by: MarbleXeno on July 24, 2020, 02:18:06 pm
-
Hello awesome people of the Internet, I'm learning C++ and SFML, and now I have a problem. I've created collision detection script which return bool if colliding, now I wan't to make my player stop, when colliding, i've created PlayerCollision script, and i don't know how to make my player stop when colliding with primitive shape, i can't find good tutorial, could someone help me?
-
well... the logic is simple:...
BEFORE the player move, test if he is going to collide with something. if true, the player don't move. if false, he moves.
so you don't move the player right from the start. you first test for collisions.
-
Okay, but how i can later implement a gravity to that, you know, player needs to move when standing on the platform. Maybe something with a velocity?
-
this covers everything you want, i guess:
https://gamedevelopment.tutsplus.com/series/basic-2d-platformer-physics--cms-998
-
okay thanks, i'll look at this.