How do I handle bullet angles with a 4 directional sprite

Get help using Construct 2

Post » Sun Apr 10, 2016 1:57 am

So I have a top down arcade style game and I'm trying to implement a bullet into it however My character doesn't orient to different angles. He just walks up down left or right. so When I spawn a bullet it has no angle to go off of and defaults to 0 degrees.

How can I tell the bullet to fire from the correct angle when I have a sprite that doesn't orient to angles
B
9
S
4
G
2
Posts: 39
Reputation: 1,805

Post » Sun Apr 10, 2016 2:18 am

What angle do you want it to fire at? Or rather how do you plan to determine the correct angle? Do you aim with the mouse?
Mistakes were made.
B
53
S
27
G
114
Posts: 1,699
Reputation: 64,446

Post » Sun Apr 10, 2016 2:28 am

i would like it to be aimed which way the character is facing and its not aimed with a mouse.

The way my character moves is I have 4 animations Left, down, right, and up

Depending on which arrow key is held the different animation plays
B
9
S
4
G
2
Posts: 39
Reputation: 1,805

Post » Sun Apr 10, 2016 2:34 am

So you can move at angles, but your character only faces the four cardinal directions.

Are you using the 8Direction behavior?

Then you want to set the bullet angle to Player.8Direction.MovingAngle.
Mistakes were made.
B
53
S
27
G
114
Posts: 1,699
Reputation: 64,446

Post » Sun Apr 10, 2016 2:44 am

So the bullet still comes out at the 0 degree angle however when i hit the shoot button a second time the bullets direction changes midflight
B
9
S
4
G
2
Posts: 39
Reputation: 1,805

Post » Sun Apr 10, 2016 3:12 am

Okay so I figured it out and got the bullets working however I have a small bug with them if my player is not holding a direction the bullets will default back to angle 0
B
9
S
4
G
2
Posts: 39
Reputation: 1,805

Post » Sun Apr 10, 2016 3:20 am

Haha I solved my dilemma Thanks for your help though
B
9
S
4
G
2
Posts: 39
Reputation: 1,805


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 21 guests