Sent instance variables another layout

0 favourites
  • 3 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Hello,

    I have many layouts of game levels. Then I need to pass a instance variables of player, who can take a gun and lose the gun, to another layout. How can I do this?

    Thanks in advance.

  • Try Construct 3

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

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

    Think you can do it several ways.

    If you give all your weapons an ID, so pistol = 1, Rifle = 2 etc. Or just strings whatever you prefer. And then store that value as a global variable, like "Player_active_weapon", then you could simply check on layout startup, what value is in "Player_active_weapon". And set that weapon to active on the new layout.

    A way that would work i think, is if you make an empty event sheet and call it "Player stats" or whatever, then you can add all the player stats like health, weapons, ammunition or whatever you need in there. These values can be used in any layout you have. That way you can simply update that event sheets variables everytime the player interact with the surrounding.

  • Thank you,

    It's impossible to pass instance variables?

    Cause there are many shooting variables. Gun_1, Gun_2, Gun_3... etc,

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