0 Favourites

How do you make a bullet sprite move towards a sprite?

  • I thaugth that you used the set angle Sprite.Angle to make a bullet sprite move towards a sprite but it still doesn't do that. It seems more like it moves in the Sprites angle rather then it's position if you use that. I tried using Sprite.X, Sprite.Y and both at the same time but the bullet sprite still doesn't move towards the player. It doesn't seem to be a Sprite.position in the Sprite.Angle options so how do you make it work? I know that the way you make a bullet sprite move towards the player is different depending on if it's not spawned from a sprite whit the turret behavior and if it is spawned from a sprite whit the turret behavior so i would want to know how you make it work whit both.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Sprite > Bullet > Set angle of motion to angle(sprite.x,sprite.y,player.x,player.y)

    Every tick if you want it to act as a kinda 'heatseaking' never missing bullet.

    Once while true if you want to shoot at the place where the target is at the moment of shooting.

    With turret, you just can use the predictive aim, this will alter the angle of the turret on the moment of shooting, and it will only work if the target keeps moving in the same direction at the same velocity. (and if the bullet is given the speed as given by the turret behavior)

    If that is what you want. Fire the bullet straight to the place where the target will be in the future. Then indeed the most easy thing to do is use the turret.

    Or calculate where the target will be in the future. With or without the help of this plugin.

  • That answher is still not near to complete.

    Got to start with the difference between 'system > create' and 'sprite spawn'.

    Create just creates a sprite in a given position with the same angle as the first made instance in the layout.

    Spawn creates a sprite at a given position and aligns the newly made sprite with the angle of the spawing sprite.

    A turret 'spawns'.

    So, using 'system create' you have to Set angle of motion (or the angle) towards a target, using one of the above methods. And you can steer the bullet on its way using same methods.

    Using spawn, you can rotate the spawner towards the target, using one of the above methods. And you can steer the bullet during its way using same methods.

    Right, now i hope it stands.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
564 105,211
rexrainbow's avatar
rexrainbow
Unread hot topic
0 Favourites
Sprite Font Generator - v3
368 112,316
RetroDaddy's avatar
RetroDaddy
Unread hot topic
167 14,498
DMT2005's avatar
DMT2005