Individual enemies

This forum is currently in read-only mode.
From the Asset Store
Pixel Enemies for SHMUP consists of 45 enemy ship sprites to be used in your game.
  • I've got some snowman enemies in my game.

    If the snowman is in collision with a snowblock, then the snowman will jump on it untill it's broken.

    The problem is: all snowmen in the map are jumping if ONE of the snowmen is touching the snowblock!

    So, I'm actually looking for a way to make all the snowmen individual of each other.

    I hope you can help me! :) Here's a screen of the three main events.

    <img src="http://img269.imageshack.us/img269/7528/problemwy.png" border="0" />

  • On multiple objects to specify to construct which one you want to work on, you should use that object on event.

    Like, if you use smth "on collision between something and snowman => jump snowman" than your action works. But if you use like " on collision between a and b => jump c" than construct jumps your all c objects. Beceause there is nothing to specify any c object.

  • All You need to do is filter the "picked" instances of the snowman object.

    The "For Each Object" loop is very helpful here.

    It will check for each of the snowman objects individually and in its current check only apply to the current picked snowman instance in the loop.

    So if You did something like:

    + For Each Object("snowman")

    + Snowman: On Collision with ("snowblock"?:

    -> Do whatever You want that particular snowman, who is currently colliding to do.

    You need to remember, that the Events will filter the picked instances of any object.

    Then the Actions next to the Event will only be executed on the Objects/Instances filtered/mentioned by the Events.

  • 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 quite the actual problem here. The "on collision"-condition will select any two instances involved in a collision, not every instance. For example, if you have two sprites, "red" and "blue", and both sprites both have 10 instances, and you create the following event:

    + Blue: On collision between Blue and Red

    -> Red: Flash for 1 seconds with 0.1 seconds interval

    -> Blue: Flash for 1 seconds with 0.1 seconds interval

    then only those instances who are currently colliding, will flash. If only one blue instance collides with one red instance, only those two will flash.

    However, in event 21 of Thijsku's image you can see that not the snowman and the snowblock, but a third sprite and the snowblock are tested for collision, so only those two are picked and not a snowman. The right snowman instance has to be picked manually in addition. For example by using

    ++ Snowman: Pick closest to: Sightsnowpop.X, Sightsnowpop.Y

    --> (paste actions from event 21 here)

    but that depends on what purpose Sightsnowpop serves.

  • That's not quite the actual problem here. The "on collision"-condition will select any two instances involved in a collision, not every instance. For example, if you have two sprites, "red" and "blue", and both sprites both have 10 instances, and you create the following event:

    + Blue: On collision between Blue and Red

    -> Red: Flash for 1 seconds with 0.1 seconds interval

    -> Blue: Flash for 1 seconds with 0.1 seconds interval

    then only those instances who are currently colliding, will flash. If only one blue instance collides with one red instance, only those two will flash.

    However, in event 21 of Thijsku's image you can see that not the snowman and the snowblock, but a third sprite and the snowblock are tested for collision, so only those two are picked and not a snowman. The right snowman instance has to be picked manually in addition. For example by using

    ++ Snowman: Pick closest to: Sightsnowpop.X, Sightsnowpop.Y

    --> (paste actions from event 21 here)

    but that depends on what purpose Sightsnowpop serves.

    Yeah, You're absolutely right. I forgot, that the collision event already filters the instances. But I also couldn't see the image he posted, again because almost every foreign image hoster is blocked here (China), unless I unblock them (on a side note, lol).

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