0 Favourites

New feature in familys

  • Dear Scirra Team

    First of all, I love Construct 2 and almost all of your weekly updates.

    I noticed a small thing, that isn't necessary but would be great in some of the new releases.

    I'm talking about an option to easy detect which kind of object of a family is acutally taken (e.g. in a foreach-loop)

    Here's an example picture i made (I'm really sorry about the bad quality of this picture and the fact I had to edit it (with Paint <img src="smileys/smiley5.gif" border="0" align="middle" /> ) instead of making a printscreen in Construct 2 but thats my only option at the moment...)

    dropbox.com/s/bv6v459bt6ci6hv/lulz.png

    Maybe you think this change would be useless (and maybe you're right in this example picture) but imagine:

    You detect a collision between a shot and the Enemy Family and each of the containing objects (EnemyBig, EnemyExplode) have different ways to deal with it.

    E.g. EnemyBig gets smaller, EnemyExplode shoots bomb fragments in each direction etc.

    Imagine Shot is a family too and just some kind of shots would hurt specific kind of enemys.

    I know there are some workarounds for this problem, but I think it would make things easier.

    And here a small code example of what I mean (ActionScript 3.0)

    foreach(Enemys)

    {

    var EnemyBig:Enemys = Enemys as EnemyBig;

    var EnemyExplode:Enemys = Enemys as EnemyExplode;

    if(EnemyBig != null) { Enemys.Health = 3; }

    if(EnemyExplode != null) { Enemys.Damage = 2; }

    }

    I hope you unterstand what I mean and you will implement it in a future release.<img src="smileys/smiley1.gif" border="0" align="middle" />

    Thanks,

    Geru

  • You can already do this with instance variables. Just make a text instance variable which is the same as the name of the object.

  • Haha Ashley you're right...

    Just stupid that I never thought about that easy solution <img src="smileys/smiley9.gif" border="0" align="middle" />

    Thanks for your help

  • You can it like this as well:

    <img src="https://dl.dropboxusercontent.com/u/8367729/construct/pics/pickInstanceFromFamily.PNG" border="0" />

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • You can it like this as well:

    <img src="https://dl.dropboxusercontent.com/u/8367729/construct/pics/pickInstanceFromFamily.PNG" border="0" />

    Super useful post - could this thread be moved to "How do I..."?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
0 Favourites
New Android Export Experiences
494 67,275
jabk's avatar
jabk
Unread hot topic
410 84,621
MrMegawatts's avatar
MrMegawatts
Unread hot topic
392 34,831
Joannesalfa's avatar
Joannesalfa