How do i use Turret behaviors?

0 favourites
  • 8 posts
  • Hi there,

    I would like to use turret behavior, but it seem i canno't figure it out.Can anyone please assist me?The cannon is not rotating and not firing.

    Here is the event sheet:

    <img src="http://dl.dropbox.com/u/33225553/Untitled.png" border="0" />

  • If that's the totality of your turret's events, then you need to add targets for the turrets to acquire. Turrets need to know what to shoot before they'll do anything useful.

    Have a read through page four of my tutorial for an overview of the behaviour in action, and don't neglect the manual entry.

  • If that's the totality of your turret's events, then you need to add targets for the turrets to acquire. Turrets need to know what to shoot before they'll do anything useful.

    Have a read through page four of my tutorial for an overview of the behaviour in action, and don't neglect the manual entry.

    But i have added a target,or have i plan it wrong?

  • Got it working!Great tutorial GeometriX

  • For the record, your mistake was to use 'Add target' in the 'Has target' event. That will never run because you must add a target before a turret can have a target. Add your targets on 'start of layout'.

  • You can also do something like add a trigger that when the player/enemy/whoever gets within a certain distance of the turret that it aquires them as the target and then use "Add target".

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Got it working, i have changed the code and its ok now.If i will need anything else i will post here.Thanks both for a response helped alot!

  • From what I've seen, both the turret and the target must exist in the layout before adding a target will work.

    In my case, the turret is part of many actions that can be taken during the game, and the turret only exists as part of the project, not the layout.

    So when I add a target at the start it doesn't work, since neither the turret or the target exist.

    If I put the add in the "on created" for my enemy (the target), it only works if the turret exists before the enemy is created.

    So, I tried a family that includes my turret and my enemy, and a condition for the family "on created" to add my target if either the turret or the target is created. If I had the enemy on screen first, then created a turret, this didn't work. Only worked if I had the turret first, then created the enemy.

    So then I put them in an OR block instead, with an "on created" for the turret and enemy, and the same action of adding the target as when I had the family condition set up. This time it worked, no matter what order they were in.

    Not sure why it didn't work with the family condition set up, maybe I had it wrong. No big, the OR block works fine for my setup.

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