Bullet Direction

Hey all! I recently started using GDevelop to create my first game. It’s a fun experience, but I’m a bit confused about bullet direction in my platformer. When I create bullets they always fire to the right even if the player is facing left. What am I doing wrong :confused:

The bullet has no information about the player or what should it do if the player is facing to the left, you have to tell it :slight_smile:
When you shoot, add two sub-events, one for the player non-flipped and the other for the flipped player

[code]Conditions: Left mouse button pressed
Actions: Create Bullet at Player.PointX(Gun) ; Player.PointY(Gun)

// sub-event
Conditions: (NOT) Player is flipped horizontally
Actions: Add a force to Bullet X = 200 ; Y = 0, Permanent

// sub-event
Conditions: Player is flipped horizontally
Actions: Flip Bullet horizontally
         Add a force to Bullet X = -200 ; Y = 0, Permanent[/code]

The (NOT) Player is flipped conditions means that you have to invert the condition, there’s a switch for it. Note that the force in the second sub-event is negative in X.

1 Like

Wow, thanks a lot! I’ve been stewing over this for days lol. I appreciate your help