Shooting-direction

Hello everyone,

This is probably a really stupid question but I really can’t find the solution.

I’m doing a plateform game and the Player is able to shoot when he press a key.

It’s working really well when the Player is walking to the right. The Bullet comes out of the gun canon well and go to the right.
But when I walk to the left, the bullet still go to the right.
I understand that this is normal, but I have no idea how to invert the direction…
Here is what i have :

Create object Bullet at position Player.PointX(Canon);Player.PointY(Canon)
Add to the Bullet a force, angle: Player.Direction() degrees and length: 400 pixels

So I’m looking to do something like -Player.Direction() or something like that.

Thank you in advance for your answers !

i am using 8 directional movement but it should work in the same way, here is how i got it to fire the shell/bullet in the direction the tank was facing

hope this helps

Thanks for your answer !

I managed to make it work ! I did it a bit different that what you showed me but it worked at the end !

Here it is :GDevelop Forum - Help and discussions about GDevelop and game development.
shooting.JPG

no problem i got alot going on in my game so got examples for quite alot of stuff :slight_smile: