How do I apply an event to various instances of an object

0 favourites
  • 5 posts
From the Asset Store
Human/Character Base Pixel Art Sprites in various poses (nearly 100 files)
  • Happy New Year to all!

    I have started dabbling in Construct2 again with the Free Edition, sitting at around 40 hours usage however my time has been consumed with just trying out different mechanics and essentially learning some of the programming. At the minute I am attempting to utilise the path finding and line of sight behaviours to create a 'smart' alerting system (smart being a complete overstatement as this is probably simplistic to most people).

    In my head, my problem is pretty simple but trying to find a resolution for this is proving to be a pain.

    What I want to achieve is whenever the Zombie has line of sight to the player, I need the losIcon to show on each zombie that has line of sight. The way the capx is currently working is that the icon can only be show on one zombie at a time which is not intended.

    Please do excuse the everything except the event sheet, the layout is terrible as I am just trying to nail down some behaviours prior to actually doing anything 'nice looking'.

    Any help is appreciated!

  • your code is pretty much just garbage, dont use "every tick" all the time and if you add "every 1 second" and put a "every tick" as a sub event it pretty much doesnt make sense because your code will only triggered every 1 sec.

    Try to spawn the icon on the image point and pin it to the zombie and if its not on LOS you just unpin and destroy it. becareful to pick the zombie with "pick by uid" other wise it can happen that the wrong zombie will get the icon etc.

  • Hi EyeForcz,

    I appreciate your honesty .

    [quote:2l1vyi07]your code is pretty much just garbage

    Looking at it now, yeah you are correct having an event occur every tick within a event which is only active every second does not really compute. I have amended this and it is still working as expected.

    I am now working on the LOS Icon on each individual enemy, however I am still having some problems. I shall perceiver and try to get this working, I will edit this post once either I have worked it out or I am still in dire need for assistance

    Thanks

  • C2 is going to choose the first instance closest to you to perform your "Chunk" of code to....

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • that's not honesty, that being a douche bag. If that's your real pic, how about you cut your hair you effin mop head? Honest?

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