# Need help with shooting mechanic in orbit game.

0 favourites
• 4 posts
From the Asset Store
Shoot balls to destroy as many blocks as possible, at each stage the game will become more difficult.
• I am currently working on a game which an object orbits the player, and allows the player to shoot the object in a straight line from what angle the object is from the player.

So say if the object is 90 degrees (from the top) of the player, the object will shoot off to the right of the player, if the object is 225 degrees (again from the top) the orb will shoot off down left of the player and so on.

The problem is that I have no idea where to start programming for the shooting mechanic, I already have a build where the object orbits the player, so that part is done, it's just the shooting part that I am stuck on.

• You can get the angle with expression: angle(player.x, player.y, orbiter.x, orbiter.y). You could spawn a new bullet object at the orbiter object, and set it's angle towards angle(player.x, player.y, orbiter.x, orbiter.y)

• ## Try Construct 3

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

Construct 3 users don't see these ads
• It have many possible solutions, one of the simplest is:

conditional:

System > Compare two variables > angle(obj.X,obj.Y,player.X,player.Y) = 90;

Actions:

obj Spawn shot.sprite;

And so on.

• Thanks for the replies, I tried doing these and I completely forgot to ask for help for the major part of the mechanic, it is whenever the player presses a button it will shoot off from that angle, sorry.

So when any key is pressed, the orbiting object will shoot off from what angle it is from the player, so say if it is 90 degrees, it will shoot off right from the player and if it is 180 degrees it will shoot down from the player, etc.

Again sorry, but thanks for your input, if you know how I can do this it would be greatly appreciated.