Reset Turret rotation.

0 favourites
  • 11 posts
  • 2 things i want to learn next.

    1. How do i reset the angle of my turrets when out of range?

    Once my turrets are out of range, they should reset their position, not so hard for placed turrets. But what about those i have Pin'ed to my ship?

    I have tried with Imagepoint's of the ship. But since the ship is moving, the turrets kept rotating.

    I need to somehow rotate them back to default once they are out of range.

    2. Make turret only fire when Target is within angle.

    Again.. not so hard for standing turrets, but no clue for the ones on the moving ship since the image-points and angles change while moving.

    <img src="http://img338.imageshack.us/img338/383/turrentexplainanglerang.png" border="0">

    Game

  • You can try this:

    turret behavior

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Nice. Trying it out right now :)

    Can't seem to get it to turn yet.

    Still i am open for other ideas as well <img src="smileys/smiley1.gif" border="0" align="middle" />

    This might fix   NR 2. but not NR 1.   <img src="smileys/smiley17.gif" border="0" align="middle" />

    Because it does not solve the Movement problem.

    Also i still need to turn the turret back to it's start position, "rest" is not doing that for me... what exactly is "rest" for?

  • When the turret has no targets, it returns to it's starting position.

    Is that what you want?

  • When the turret has no targets, it returns to it's starting position.

    Is that what you want?

    No i can do that with a event.

    I want it to Rotate to the Start Position Relative to the ships Rotation.

    Cool as it is, i don't think your Turret Behavior can do it..

    The Heading and Arc can't be changed in events.

    <img src="http://img685.imageshack.us/img685/6038/shipdefault000.png" border="0" />

    See what i mean? The rotate back is one thing.. Mostly Cosmetic.

    But i REALLY need the turrets Aim Area to Follow the Ship.

    I think i need another way to do it <img src="smileys/smiley12.gif" border="0" align="middle" />

  • Just add the ships angle into the equation.

    The usual setup is to have "right" as an angle of 0.

    So the turret angle range would be:

    Ship.Angle+45 to Ship.Angle+135

    Then to reset the angle of the turret like your image set the turret's angle to Ship.Angle+90.

  • If I'm understanding the problem correctly you could try taking the ship's current angle and subtracting 90 degrees. So, when you want to go back to default you would set the angle of the turret to Ship.Angle-90.

    Regarding your second question, you just need to add a condition to your firing event that checks to make sure the enemy is within a certain angle of your ship's. Here's a snippet of code from a project I'm working on that seemed to work.

    <img src="http://dl.dropbox.com/u/31346541/C2/FireInRange.PNG" border="0" />

  • R0J0hound

    Sadly i can't take Ship Angle into the Equation in the Turret Behavior.

    But i will just create my own Turret with Events :)

    R0J0hound

    Mastasurf

    I will try out your ideas, thanks a lot <img src="smileys/smiley2.gif" border="0" align="middle" />

    I just find it weird that i can't simply make it face a ImagePoint..

  • First part done :)

    <img src="http://img819.imageshack.us/img819/1328/turretsshow1.png" border="0" />

  • I could add "bind to object at point" as an action, but that would be deprecated by the container feature.

    I'll resume working on the turret behavior on monday, and I'll see if I can add something to the extension or code a "hardpoint" behavior that attaches objects to other objects (while keeping angles relative)

    Meanwhile keep this topic updated, my goal is to have the turret behavior be able to do everything you want.

  • I could add "bind to object at point" as an action, but that would be deprecated by the container feature.

    I'll resume working on the turret behavior on monday, and I'll see if I can add something to the extension or code a "hardpoint" behavior that attaches objects to other objects (while keeping angles relative)

    Meanwhile keep this topic updated, my goal is to have the turret behavior be able to do everything you want.

    FSM bless you     <img src="smileys/smiley4.gif" border="0" align="middle" />

    Thanks for the help! The thing i was trying that was impossible was to change the behavior stats to something else than Numbers.

    I don't know if that is possible to change, but it would be nice if i could set the Heading towards an angle and other syntax.

    Example:

    Heading - Ship.Angle

    Arc     - 45

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