How to change game attribute on loading a new sene.
sophisticated1024@hotmail.com
Member Posts: 14
Hi,
Im stuck, Im making this game where there are bricks in one scene and there is an attribute in game which is an integer which lets me keep a count of how many bricks are destroyed. When bricks on screen=0 the level complete banne shows up. Now what i want to do it is , when the player clicks on "next level" button/actor, the scene should change to the next scene. I have been able to do this, but in the next scene i think the game attribute of balls on screen = 0 , where do i change this attribute, should i make a game controller in the next scene which changes the bricks on screen to the number of bricks i want in the new scene.
Please note that there has to be different number of bricks in different levels.
When the scene changes to another scene, are all game attributes reset?
Please need help with this.
Thanks in advance.
Im stuck, Im making this game where there are bricks in one scene and there is an attribute in game which is an integer which lets me keep a count of how many bricks are destroyed. When bricks on screen=0 the level complete banne shows up. Now what i want to do it is , when the player clicks on "next level" button/actor, the scene should change to the next scene. I have been able to do this, but in the next scene i think the game attribute of balls on screen = 0 , where do i change this attribute, should i make a game controller in the next scene which changes the bricks on screen to the number of bricks i want in the new scene.
Please note that there has to be different number of bricks in different levels.
When the scene changes to another scene, are all game attributes reset?
Please need help with this.
Thanks in advance.
Comments
On the brick actor, at the top of the rules list, have a behavior Change Attribute game.brickCount to game.brickCount+1.
That way, if you have 4 bricks on the screen, each one will add one and game.brickCount will equal 4. If you have 710 bricks, they will each add one and game.brickCount will equal 710, etc.
The only caveat is that if you are checking for game.brickCount=0, be sure to wrap that rule in a timer set to after at least 0.1 seconds so that the rule doesn't trigger at the very beginning of a scene when game.brickCount does in fact still equal 0.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
So try if touch is pressed
Cheers
Elfizm
Please don't ask the same question twice. You asked it here, and in this thread: http://forums.gamesalad.com/discussion/51497/i-need-help-rule-only-works-once
This is the second warning - the first one was for bumping very old threads with useless comments.
One more time, and you will be punished with official warning in your profile.
I moved answers from the duplicated question.