0 Favourites

Use text variable for object in a function?

  • Hi everyone,

    I'm planning on making an rpg similar to pokemon - in that you have 9 monsters that you can summon during a battle (only 1 at a time).

    What I would like to know is, if it is possible to use a text variable inside a function.

    for example: I have a knock back function

    global var: current_monster = "monster_1" (and I have a sprite called monster_1 and monster_2)

    global car: enemy_monster = "monster_2"

    +on function "knockback"

    current_monster set bullet enabled

    current_monster set speed round(random(100,300))

    current_monster set angle of motion to angle(enemy_monster.x, enemy_monster.x, current_monster.x, current_monster.y)

    ...

    Etc, etc

    At the moment I'm pretty sure it is not possible, however I am only using the free version. Is this possible with the full version or not at all?

    Thanks.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Object referencing is usually done via UID. But you need families to be able to reference through multiple kind of object at once, thus the need to upgrade to the paid version.

    There IS a way without it though, but you'd have to do one of the two possible alternatives :

    -All "monsters" are the same sprite object (with multiple animations)

    -Duplicate all events for each kind of monster

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