Lose 1 Health per Enemy = (For Each?)

0 favourites
From the Asset Store
Per Pixel Destruction like in "Worms" (perfect performance, no third party plugins)
  • Here, a bit more advanced example ...

    arrows move, space for weapon.

    EDIT:

    Note I added a cooldown timer to the player and make use of a boolean to detect being allowed to get hit or not.

  • I had a similar problem, the turrets would spawn many on touch of my Turret tower, which was not what I wanted, in like 1 tick I had something like 14 towers on one spot. The way I fixed it was to check on touch, the turret type, plus whether something is overlapping, granted this isn't a solution for you without modification, but it is a sample, maybe later tonight I can work on a working sample to help fit your problem directly.

    Here is an image of how I have mine set up.

    cyborgsattack.com/files/overlapcheck.jpeg

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks everyone!

    I tried the different ways suggested here, and I found that the use of Boolean for overlapping was the easiest to use.

    I'm still curious why the "FOR EACH" didn't work, and wonder when I will need to use it if not in such case. I didn't find many video tutorials about it and the documents didn't really help me understand because I didn't come from a programing background I don't know much about loops in general but can't wait to start using them in Construct 3.

    So thanks once again everyone, this community is amazing! :)

  • Remember, the engine runs about 60 loops a second or more, so a loop in a loop is something you use sparingly, each object is a container, so your enemy is a container, you just need to check for a local event or variable against that object, and only objects that match a condition, its overkill trying to check all in the layout, and from my experience, so far no real need of using foreach yet, all personal opinion of course

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