I can't get the angle right.

0 favourites
  • 10 posts
From the Asset Store
Awesome drifts on auto generate way,tap to steer right.
  • 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 know how to upload a Capx

  • Top 15 Most Popular File Sharing Websites

    upload capx ..post link..

  • 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.

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

    2pointSpwnBullet.capx

  • 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!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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!

  • 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.

  • C-7 I was thinking of that, thanks. You helped me a lot.

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