I can't get the angle right.

Just started using Construct 2? Post your questions here

Post » Sun Mar 13, 2016 8:11 pm

In my game I have a ship in the sky with 8 direction movement. I changed it to 4 direction movement and no angles are being changed. Because he has animations for Up, Down, Left, Right. Sort of like a RPG character, but with a flying boat. Now I want the ship to shoot, except there is one problem. If am MOVING up, and I press D to shoot out the right side of my ship it will move right because that's what the bullet behavior does. But if i'm moving the ship right, it will shoot out of the front instead, I tried many ways to fix this, such as rotating or adding degrees and they work, but if i shoot one cannon ball, it will go the right way, if i shoot again it will go the right way as well but the previous ball redirect back to the angle again. To make matters worse i'm trying to shoot out the LEFT & RIGHT side of my ship, which makes things harder for me. I'm not good at explaining problems... Can anyone help?
I don't think I could ever stab someone, I mean, let's be honest. I can barely get the straw into a Capri Sun.
B
26
S
10
G
7
Posts: 91
Reputation: 6,420

Post » Sun Mar 13, 2016 8:12 pm

I don't know how to upload a Capx
I don't think I could ever stab someone, I mean, let's be honest. I can barely get the straw into a Capri Sun.
B
26
S
10
G
7
Posts: 91
Reputation: 6,420

Post » Sun Mar 13, 2016 8:18 pm

B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Sun Mar 13, 2016 10:25 pm

I don't think I could ever stab someone, I mean, let's be honest. I can barely get the straw into a Capri Sun.
B
26
S
10
G
7
Posts: 91
Reputation: 6,420

Post » Sun Mar 13, 2016 11:32 pm

Yes, @Potato23 that link wored.

Here's a fix for you.

I added comments to the event sheet to show you what I was doing. Firstly, I had to fix your right-facing image points. Did you know you can right-click on an image point in the image editor and apply it to the whole animation? That way, the cannonballs spawn correctly. I also set your animations to loop (it comes up on the left side of the screen in the image editor), so just change it back over there if that's not what you wanted.

Anyways, I added a private variable to your ship so the game keeps track of which way it's facing. I made sub-events to yours that change the bullet angle of motion for your cannonballs based on the direction of the ship. Remember, 0 degrees is → and it rotates clockwise from there.

Lastly, I moved your firing actions to functions so you can use the same actions for all of your events. This makes it easier to maintain stuff and not copy+paste a bunch of stuff.
B
103
S
38
G
19
Posts: 962
Reputation: 17,996

Post » Sun Mar 13, 2016 11:50 pm

I tried to put all of this in only one event....renamed animations to 0_Right ; 180_Left ; 270_Up & 90_Down

Image

2pointSpwnBullet.capx
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Mon Mar 14, 2016 12:15 am

C-7 wrote:Yes, @Potato23 that link wored.

Here's a fix for you.

I added comments to the event sheet to show you what I was doing. Firstly, I had to fix your right-facing image points. Did you know you can right-click on an image point in the image editor and apply it to the whole animation? That way, the cannonballs spawn correctly. I also set your animations to loop (it comes up on the left side of the screen in the image editor), so just change it back over there if that's not what you wanted.

Anyways, I added a private variable to your ship so the game keeps track of which way it's facing. I made sub-events to yours that change the bullet angle of motion for your cannonballs based on the direction of the ship. Remember, 0 degrees is → and it rotates clockwise from there.

Lastly, I moved your firing actions to functions so you can use the same actions for all of your events. This makes it easier to maintain stuff and not copy+paste a bunch of stuff.

Thx for the fixes, nice way to solve it, but I missed the recent update. U know where I can get it? (Can't open it without it) Never mind, found it!
I don't think I could ever stab someone, I mean, let's be honest. I can barely get the straw into a Capri Sun.
B
26
S
10
G
7
Posts: 91
Reputation: 6,420

Post » Mon Mar 14, 2016 1:00 am

@C-7
I looked at the capx, you did think it the right way and fixed it, but as I said i'm not good at explaining stuff. I wanted the ship to shoot outward not forward like a real ship. But i fixed the angles. Quick question, when I hold down the up arrow, it plays that animation, if i hold up and any other one at the same time the animation cant choose. How can i fix this? Thx for the help!
I don't think I could ever stab someone, I mean, let's be honest. I can barely get the straw into a Capri Sun.
B
26
S
10
G
7
Posts: 91
Reputation: 6,420

Post » Mon Mar 14, 2016 1:37 am

@Potato23 Just add inverted "key is down" conditions to your current commands. Right-click on a condition to invert it

Up is pressed
left is NOT down
right is NOT down

and do that for each event.
B
103
S
38
G
19
Posts: 962
Reputation: 17,996

Post » Mon Mar 14, 2016 10:54 am

@C-7 I was thinking of that, thanks. You helped me a lot.
I don't think I could ever stab someone, I mean, let's be honest. I can barely get the straw into a Capri Sun.
B
26
S
10
G
7
Posts: 91
Reputation: 6,420


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 2 guests