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

Author Topic: Idea for Collision  (Read 1119 times)

0 Members and 1 Guest are viewing this topic.

MarbleXeno

  • Guest
Idea for Collision
« 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?
« Last Edit: July 24, 2020, 02:21:46 pm by MarbleXeno »

Stauricus

  • Sr. Member
  • ****
  • Posts: 369
    • View Profile
    • A Mafia Graphic Novel
    • Email
Re: Idea for Collision
« Reply #1 on: July 24, 2020, 03:04:34 pm »
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.
Visit my game site (and hopefully help funding it? )
Website | IndieDB

MarbleXeno

  • Guest
Re: Idea for Collision
« Reply #2 on: July 24, 2020, 03:33:35 pm »
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?

Stauricus

  • Sr. Member
  • ****
  • Posts: 369
    • View Profile
    • A Mafia Graphic Novel
    • Email
Re: Idea for Collision
« Reply #3 on: July 24, 2020, 03:55:16 pm »
Visit my game site (and hopefully help funding it? )
Website | IndieDB

MarbleXeno

  • Guest
Re: Idea for Collision
« Reply #4 on: July 24, 2020, 07:18:11 pm »
okay thanks, i'll look at this.

 

anything