problem with global variable

0 favourites
  • 3 posts
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • hi everyone i have in my game 2 layers (layout1 and battle), i have in layer1 an enemy with an instance variable called aux that have a string with a number, when you collide with him it will set the global variable(variable3) to the value of aux, i have a text to debug and that shows the value of the global variable, then it will change to the battle layer and, i dont know why, variable3 wont have any value, i need to fix this because i need that value to pass to the battle layer to trigger some events.

    here is my capx dl.dropboxusercontent.com/u/85479859/dabestgeim.capx

    you need to delete the action set variable3 to 12 on start of layout in the event sheet 2 to trigger the bug, i used that to test some functions that i made because of the bug with the global variable

    thanks.

  • In the last event on eventsheet 1 you are resetting all global variables to default. Take that away and the variable will transfer to battle-layout.

    Why is global variable 3 set to text instead of number?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • lol thanks i didnt saw that xD, well that is a text because i need to read for example this 1234, in my game that numbers are different types of enemies, so i need to separate that number in 1 2 3 4 to spawn them in the battle layer, i thought that using a text variable and the functions left() mid() and right() to cut the number would work, and it does.

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