How do I get a Total money variable for all levels of a game

0 favourites
  • 5 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • I have a variable called "money" where in each level the player win some money killing enemies. I want when I go to another layout, example the level 2 layout, then the money earned during first level go to other variable called "TotalMoneyEarned". My problem is when I finish the first level (layout level 1) and go to another, the "money" variable restart and don't add to the TotalMoneyEarned variable... Can anyone help me? Ty!

  • It shouldn't be a problem. Global variables are persistent between layouts. Can you share a capx.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It shouldn't be a problem. Global variables are persistent between layouts. Can you share a capx.

    Sure!! I think I have a problem because the variable "money" restart when I finish first level and I don't find the error. Here is the capx ... hmm I have to say is a crazy project and it is very bad organized at moment

  • The capx is a bit confusing. But it seems to me the main problem is you reset global variables on ES_GameOver and you try to add Money to Total money Earned on the begining of the levels. You should add it BEFORE reseting the variables.

    Besides that, there's a lot you could easily improve in your capx. Specially in regards to structure. You could do without it, but most probably it will bring more problems similar to this one in the future. It may be wise to just pause development right now, design the screenflow and everything on paper, then go back and implement it. I could help you with that. Feel free to contact me via private message. And you can do that in spanish, as I speak spanish quite well.

    Cheers!

  • The capx is a bit confusing. But it seems to me the main problem is you reset global variables on ES_GameOver and you try to add Money to Total money Earned on the begining of the levels. You should add it BEFORE reseting the variables.

    Besides that, there's a lot you could easily improve in your capx. Specially in regards to structure. You could do without it, but most probably it will bring more problems similar to this one in the future. It may be wise to just pause development right now, design the screenflow and everything on paper, then go back and implement it. I could help you with that. Feel free to contact me via private message. And you can do that in spanish, as I speak spanish quite well.

    Cheers!

    Yes, you're right!! the problem was found in ES_GameOver... I don't know how I didn't see it before... I suppose the reason is you said before, the project is very confuse and I have to organice well all the project!

    Thanks for your help!!!

    I'll send you now a private message

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