Multiply enemies with the same instances

0 favourites
  • 12 posts
From the Asset Store
Pixel Enemies for SHMUP consists of 38 enemy ship sprites to be used in your game.
  • Hello C2 community...

    I have another issue, hopefully I can explain this correctly;

    I do not want to respawn enemies for my "platform" game... I followed the manual's instruction:

    "Object instances are the actual objects you see in a game: an instance of an object type. For example, if there are four TrollEnemys in a layout, those are four instances of the TrollEnemy object type.

    It is instances which have a position, angle and size in the layout. Object types do not have these properties - they simply define a 'class' of object."

    So according to this logic, I'm assuming if I place all my enemy sprites and "box" (referencing the manual again by placing an invisible box on the layout and adding a pin for the enemy sprite) I'd have to use the event sheet to manage each enemy individually so I don't destroy the first "trollenemy" and in the process destroy all the other trollenemies... Now my problem is how would I go about coding this? In the event sheet I mean, not JDK...

  • Yeah there are a few Snafu's like this.

    Use the Containers for the sprite and the sprites "trolly" they will spawn and destroy in sets.

  • jojoe

    Thank you for the reply! Someone else suggested this to me last night(I live in the states) but there's a problem with said "trolly" box sprite(s)... The box sprites "do not" have a "UID"(or at least I did not see it in the property bar) so when I select the "box" sprite on the layout, It automatically selects the multiply "trolly" box sprites at the same time... So how would using containers fix this??? I tried finding something on containers last night(via the manual) and I did not get much information on how to use it for what I want to achieve... An explanation could seriously help me out... Sorry , but I can't upload a capx file to further help explain my dilemma...

  • Not sure exactly what you are trying to do.

    You can use collision-overlaping to select which it is overlapping. You can also anso do a "select nearest"

  • Ahh... Selecting nearest may work, but it seem that no one is getting what I'm trying to accomplish... I'm creating a "platform" game... all my enemy sprites have "boxes" attached, or pinned for platform movement (enemy sprite box has the platform behavior attached to them) "Select nearest" would most certainly work if all I had on screen were just instances of the enemy sprites... But since I'm using "platform mechanics" I had to pin the "invisible box sprite" to each enemy object type(I have two different enemy object types in my game so far)... So that's the issue... I mean I could just delete the invisible box and take my chances with the collision detection upon start of layout, but if I can use the invisible boxes for all my enemies, I rather do that instead... The walking animation of my enemies will suffer but I think I could fix that with events(like setting the X and Y position of all the enemies)... I hope this fully explains things jojoe

  • See if this helps:


    Containers actually don't work well if the elements are already in the layout as you aren't guaranteed to get them in the right order. This does the same thing manually. Very little extra code is actually needed.

  • If I understand you right it can be done without containers pretty simply. You could also add families to the concept allowing you to use any number of enemies with no extra events.

    here is an example.

    Example CAPX

    Example DEMO

    Pic of the important events.

    <img src="" border="0">

    [Edit] I made my example File to slow. looks like blackhornet pretty much answered it the same way. only difference is I used Pin.PinnedUID and stuck in all in familes. But it's the same idea.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • blackhornet onzephyr

    THANK YOU SO MUCH GUYS!!! Appreciate the example capx files too... I wish I didn't delete the code I had already but it's a small inconvenience to recreate it... I'll apply what I've learned from the example(s)... Again thank you for the replies and uploads <img src="smileys/smiley32.gif" border="0" align="middle" />

  • Oh! I see what you are trying to do now @BlACKMASKCEO.

    You can do that with 1 block like this:

    <img src="" border="0">

    here is a file you can try to test it:

    I really wish Scirra would add a "ON destroy Kill children" to the pin behaviour.

    Doing all this elaborate testing for a simple task like this is really asinine.

  • Dude, I TOTALLY agree with your observation... It's great that the system object is as accessible as it is, but the most "rudimentary" features of programming should be(in theory anyway) fairly straightforward to understand so that execution isn't a tall task for a beginner...

    Appreciate the link btw

  • Dude, I TOTALLY agree with your observation... It's great that the system object is as accessible as it is, but the most "rudimentary" features of programming should be(in theory anyway) fairly straightforward to understand so that execution isn't a tall task for a beginner...

    Appreciate the link btw

    The reason they added Behaviors is so beginners do not have to deal with complex things.

    A small thing like "Destroy when parent is destroyed." added to the pin behavior would really make things simple on people. The Blender Game engine does this with its child to parent relationships. Kill the parent, means you kill everything attached to it.

  • jojoe

    These Editors all seem to have things in common (i.e. features and so on) but they mostly differ in scripting preference and so on... I'm no expert by any means in any scripting language of any kind, but it seem that they all attempt to "achieve the similar goal" but they way to the solution depends heavily on what scripting language you are using... It would be nice if all these language could be interchangeable with each other, but I guess that's the reason for why they are all different...

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