How do I ensure bullet does not turn in flight?

0 favourites
  • 10 posts
From the Asset Store
A well commented RPG game template to learn from or use as a base for your own game!
  • Hiya folks, back with another question.

    I've got a basic lil run and gun platformer, and I'm pretty happy with how it works even at such a basic stage- except for one thing; when I fire while facing right, I can turn my player and make the bullet zip around the opposite way.

    This behavior does not work the other way around.

    I'm not quite sure what I'm doing wrong, and in my attempts to change it, I often only wind up making every bullet fired face+fly right, which is not ideal.

    Any ideas?

  • I don't know if it is better, but I think you can simplify your code, and just add a variable to insert the angle of the bullet...

    capx: drive.google.com/file/d/1ZgslZV1abEbFAq5GpYJvV8qp0NGAnqUL/view

  • You are setting your bullets angle over and over again every tick. You should just set them with an on bullet created - set angle

  • Thank you both! :) I'll try each and see if I can't get it to work.

    For some reason, I find that the "on create" event doesn't always seem to be available to use- which is strange.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I don't know if it is better, but I think you can simplify your code, and just add a variable to insert the angle of the bullet...

    capx: drive.google.com/file/d/1ZgslZV1abEbFAq5GpYJvV8qp0NGAnqUL/view

    So I gave that a shot, and while the function itself works great- the angle does not. No matter how I set it, the darn thing refuses to fire in the left direction- I've tried every angle, and nothing seems to work.

  • On created is a trigger condition. It can't be used with other trigger conditions unless the event is converted to an "or" block, or in a subevent.

  • Huh, interesting.

    Well, try as I might- I still cannot get the stupid bullet to fire in the opposite direction using a function. I've tried every angle, and no dice.

    I don't know what I'm doing wrong, and I want to just go back to what I had before.

  • Give me a c3p file with your game and I will figure your bug out for you and tell you what to change and why.

    My Discord:

    discord.gg/BWeGnTUT

    If suggest sending it in a DM so less people have access to it, since it is your project.

  • You have an event in your screenshot that sets the bullet to travel left whenever the player is mirrored.

    So whenever you turn your player, the bullet will turn.

    I think that code should only run when the bullet is created, as a sub-event of the user pressing Space. Right now now it's running every tick, which will change the bullets direction anytime the player is mirrored.

  • Thanks, I figured that part out :)

    What I don't understand is why it only affected one angle, and only during one animation- not the others.

    I've gotten it to stop turning, but now I have a different problem that I already solved- the bullet only travels to the right.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)