0 Favourites

How do I create enemy tank w/turret behavior?

  • I want an enemy tank with a turret that targets player objects.

    What I can't get is the turret to turn

    'base' of turret is container

    base on created --> turret1 pin to base (pos & angl)[/code:3a6fxekb]
    
    *base has bullet behavior and it's path set
    
    *turret1 has bullet, turret behavior (enabled)
    
    [code:3a6fxekb]turret1 on created --> turret1 add turret target player[/code:3a6fxekb]
    
    It will shoot at player but turret does not spin
  • I don't really understand the way you explained the tank object but i would go about like this...

    Make a tank body. Use the body as a base sprite.

    Next, make the turret and pin this onto the tank body in the correct place and add the 'pin-to' behaviour and 'turret' behaviour.

    Pin the turret to the tank but only set it to 'pin to position' not angle. This will mean that the turret will follow the tank body but can rotate at it's own accord.

    This does mean that when you turn your tank you turret won't rotate but, if you want, you can sort this out by pinning the turret (position and angle) to the tank body when the tank is turning and then just pinning the turret (position only) when the tank is not turning!

    Hope this helps!

  • base on created --> turret1 pin to base (pos & angl)[/code:40unr0x3]
    It will shoot at player but turret does not spin
    

    That's the problem, right there...

    pin to base (pos & angl)

    If you want your turret to be able to turn independent of the base, you must pin it position only.

  • >

    > If you want your turret to be able to turn independent of the base, you must pin it position only.

    >

    Pretty sure this does not work, i have tried.

    BUT i will try to make small project with just this when i get home to rule out something else in project is not affecting it.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • brunopalermo you seem to be right. I can only assume this has to do with using families *sigh*

    families and functions killin' me

  • If I had more detail on what exactly you're trying to achieve I may help finding a work around.

  • If I had more detail on what exactly you're trying to achieve I may help finding a work around.

    NW, I got this resolved, I simply started project over. It works exactly as you described

  • you mean like this

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