Skerrcrow's Forum Posts

  • 6 posts
  • Thanks dop, I'll give that a whirl too. I found the example project for function mapping, but I do find it a bit confusing to figure out, not gonna lie!

  • Awesome, thank you for pointing me in the right direction lionz.

  • I'm working on a turn based battle system, wondering if something like this is possible;

    I'd like to have, say, 5 string instance variables per enemy called 'Attack Slot 1' through 'Attack Slot 5'.

    The slots/string variables would each contain strings of different attack names, which in turn would be paired to corresponding functions with those names that would then trigger.

    When it's an enemy's turn to attack, a random number (1 - 5) generates and calls whatever function's name appears in that specific enemy's corresponding attack slot.

    For example;

    Enemy A may have the 'Punch' function listed in it's Attack Slot 1, while enemy B may have 'Kick' listed under it's attack slot 1. These would always be different depending on the type of enemy that is attacking, so I'm trying to develop universal attack calling logic that works regardless of the type of enemy via family instance variables.

    I'm digging into mapping functions and 'map function to string' but I'm getting confused as to how I could actually make that reference the string name in the enemy sprite's instance variables. Maybe I should instead be looking at arrays?

    I've attached a screengrab of how I'm trying to attempt solving this so far.

    Any help is appreciated, thanks gang.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well, there you have it. it works. Thank you AllanR!

  • I have 2 enemy sprite objects, both in the same family, sharing a number instance variable; 'Speed.' En_Red has a higher speed than En_Yellow.

    On start of layout, System creates En_Red. On the next line, System creates En_Yellow.

    I have a function created to fire a bullet, which creates the bullet object at enemyfamily.x, enemyfamily.y ...sort of.

    I get enemyfamily to pick the instance with the lowest speed (which should be En_Yellow) and then run the bullet function.

    Instead of the bullet originating at the enemy with the lowest speed, the bullet instead appears to be created at whichever 'create enemy' line happens to be above the other in the 'on start of layout' instruction.

    Why does that happen?

    If I add a 'set colour' instruction, I can confirm the family is indeed picking the instance with the least speed, yet the bullet still originates at the first enemy spawned in the layout, even if I swap the placement of the spawn lines back and forth.

    I'm really just trying to get my head around picking a specific instance within a family and having a bullet function originate from the instance I'm picking, but, well, you know... I'm a noob.

    Any help is appreciated, thanks folks.

  • 6 posts