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

Author Topic: Bullets turn direction failure  (Read 644 times)

0 Members and 1 Guest are viewing this topic.

Jan666

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Bullets turn direction failure
« on: May 30, 2022, 10:44:57 am »
Hello, i have a bullet direction Problem. I want that my Player can shot bullets to the right and left direction. I used this piece of code for that (I used setScale for flip the Players Direction):
bulletVec[i].bltFire(0, 2 * plr.plrSprite.getScale().x);
 
The Problem noq is that the firing Bullets always turning the direction when i turn the players direction, how i can change this?
« Last Edit: May 30, 2022, 11:17:57 am by Jan666 »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10819
    • View Profile
    • development blog
    • Email
Re: Bullets turn direction failure
« Reply #1 on: May 31, 2022, 09:44:40 am »
Don't make the movement depend on the player's current orientation.
The bullet should know their own speed and movement direction and the direction should only be set once when the bullet is created.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/