How do I make a bullet rotate on its origin?

0 favourites
  • 11 posts
From the Asset Store
Simple resize and rotate events for any sprite, quick and easy event sheet that you can use for your own projects.
  • When I use the bullet behavior in conjunction with the rotate behavior I have sprites rotating not on their origin point but in circles. How do I make an object move like a bullet but rotating on its center along the way?

  • Turn off "set angle" in the bullet behavior properties and it should be fine.

    Normally that just makes bullet objects automatically point in the direction of their natural angle of motion, but having Rotate on there forces it to turn at a fixed rate while the bullet keeps moving forward at the constantly changing angle. So it's still rotating around its origin, but it's steering in a circle.

  • I think with the bullet Behaviour, the sprite will move forward only. So, I guess you need to remove the "Bullet" behaviour and make your own bullet system. You should give it a shot, it's not too much work.

  • Turn off "set angle" in the bullet behavior properties. Normally that just makes bullet objects automatically point in the direction of their natural angle of motion, but forcing it to rotate makes it fly in circles.

    I tried but the object no longer moves towards the moving target I set with the option set angle towards position. It's like setting off the angle option conflicts with the action set-angle-towards-position.

  • Pin a rotating sprite to an invisible bullet.

  • I tried but the object no longer moves towards the moving target I set with the option set angle towards position. It's like setting off the angle option conflicts with the action set-angle-towards-position.

    Oh right, you'll have to use the bullet's Set Angle of Motion instead.

    Since you can't use the specific Set angle Towards Position action, you can just use this when setting the angle of motion.

    angle(x1, y1, x2, y2)[/code:3gkek9zq].
    Replace the first set of X and Y with your bullet's position and the second set with your target's position.
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • beguinner Try my tutorial it might help you out a bit! https://www.scirra.com/tutorials/9548/c ... -mechanism

  • > I tried but the object no longer moves towards the moving target I set with the option set angle towards position. It's like setting off the angle option conflicts with the action set-angle-towards-position.

    >

    Oh right, you'll have to use the bullet's Set Angle of Motion instead.

    Since you can't use the specific Set angle Towards Position action, you can just use this when setting the angle of motion.

    angle(x1, y1, x2, y2)[/code:2767oukj].
    Replace the first set of X and Y with your bullet's position and the second set with your target's position.
    

    I tried but I get the same result as before.

  • Pin a rotating sprite to an invisible bullet.

    looks like this is the only viable option.

  • beguinner

    Instead of using the bullet behavior, use rexrainbow's MoveTo behavior to get the movement you want.

  • Without seeing your capx I can't say why my solution isn't working, but here's a clean example if it's still worth your while. It's real simple, just pay attention to the projectile object's settings and take a look at the event that sets the angle of motion. There shouldn't be any need to pin your sprite to another object. https://www.dropbox.com/s/aeq5cyp0mv6nb ... .capx?dl=1

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