Stop Towers from targetting themselves?

  • I am trying to create a TD game with a more complex aiming behaviour...

    not only should towers (and enemys) be able to damage others of the same instance but also heal them later (in different cases of course <img src="smileys/smiley2.gif" border="0" align="middle" /> )

    Problem is... I cant even get them to Target each other properly =D

    Example file:

    dropbox.com/s/9w79dpe1zq0745q/Towerbehaviour.capx

    -Drag and drop Green or Red boxes to place green or red towers

    -Green Towers Target Red Towers and vice versa

    -on clicking a red Tower (not the "buying box") this Tower should be toggled "confused" (Instance boolean)

    -Confused red towers are supposed to target other red towers

    Problems:

    -On Clicking a Red Tower EVERY Red gets "confused"

    -Confused Reds seem to Target themselves as they rotate to 0 degrees

    If anybody would be able to help me?^^ I'm Confused!!   <img src="smileys/smiley17.gif" border="0" align="middle" /> <img src="smileys/smiley17.gif" border="0" align="middle" />

  • I believe you need to look into IID and UID to specify specific instances of the tower... Sorry not in front of construct right now so can't provide a better example. Check the manual on using UID and IID. Unique ID and Instance ID.

  • Check the manual on using UID and IID. Unique ID and Instance ID.

    Thank you for your reply:

    I cant see a way to integrate UIDs into the default turret behaviour.

    I tried to script the targeting without behaviors but couldnt find the possibility to check on a list of instances instead one.

    I think that would be needed for terms as:

    if - distance

    (Sprite(self).x,Sprite(self).y,Sprite(notself).x,sprite(notself).y)

    < range ----> fire at (notself)

    Any Tips on that?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi,

    I'm using the free version and thus am not able to use "families" could anyone spend a few minutes and try if using this option could help me out?

    If yes i'll finally have to go for the full version. <img src="smileys/smiley2.gif" border="0" align="middle" />

    Thanks a lot!

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