they're everywhere -- handling multiple enemies

0 favourites
  • 4 posts
From the Asset Store
Pixel Enemies for SHMUP consists of 45 enemy ship sprites to be used in your game.
  • so im trying to implement multiple instances of the same monster in my game, a slightly enhanced clone of ashley's snailstomper from the begginer's platform tutorial. these orcs of mine are to be a bit more complex than the snail though, so i used different sprites for the box and the animation, same as in the main char, as advised in the tutorial. everything good until i try to use two instances (crtl-click) of the same enemy...

    see, it (the box) moves for and backward in its platform, gots two edge-markers to tell it when to toggle an instance variable right-left, and mirror the animation... problem is, variables dont seem to work locally X( so my orc faces the wrong direction oft as not... even worse, there's some combat commands in the event of contanct with the hero, few animations etc, some implemented by instance variables (ie the monster's health), other just by events. unsurprisingly, both (stupid creatures) are triggered at the same time: if one attack both swing their swords, if you kill one the other one dies too...

    guess im doing something wrong with the variables :( but i cant figure it out. maybe this is more like a begginers question, well, its always hard to say... i thought it would get more attention here maybe :P

    capx attached. hopefully. my first one whohoho. feedback welcome. battle mechanics are rudimentary, any ideas will be hearkend to. creep death animation sucks specially, even when it actually happens. yes u are immortal. so far.

    thanks for your time and interest :)

  • I had the same problem some time ago.

    using for each will solve it.

    this was the topic I made back then:

  • for each, uh? sounds... plausible! ill have a look.

    thanks, mate!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • yep. works beautifully. managing both sprites (box&animation) was a bit tricky tho. here's what i came up to, maybe not the most elegant solution, but works.

    theres only trouble if the two instances touch each other, cos the mirror on the animation is triggered when it touches the box, so if it touches another box (with another value in the variable) it gets messy. oh, well. i can live with that.

    Derqs thanks a lot dude!

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