How to change game attribute on loading a new sene.

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.

Comments

  • ummm i fixed the problem...thanks for reading :P
  • @admin delete this if required, thanks.
  • And so i thought, no im not able to fix the problem as of yet, please help needed. Need to declare game attribute "bricks on screen" at the start of each scene. How do i go about this. Since in the last scene number of bricks becomes zero on level completion and i destroy everything in the level when bricks on screen=0.
  • fixed!!! lol
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Sounds like you solved it, but I thought I'd offer one suggestion: instead of counting the bricks and then assigning that value to the attribute, have each brick count itself as follows:

    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

  • @tatiang Awesome reply.....your logic makes more sense to what im implementing right now. Thanks :)
  • @tatiang btw noone has answered my question, which to me is very important as im new and i am learning gamesalad. So this question is of great importance to me, so maybe you can give me an answer that im looking for. When a new scene is triggered, the game attributes reset or remain in a state as they were in the end of the last scene?? thanks a lot :)
  • IsabelleKIsabelleK Member, Sous Chef Posts: 2,807
    @tatiang btw noone has answered my question, which to me is very important as im new and i am learning gamesalad. So this question is of great importance to me, so maybe you can give me an answer that im looking for. When a new scene is triggered, the game attributes reset or remain in a state as they were in the end of the last scene?? thanks a lot :)
    Game attributes stay the same (if you don't change them in the beginning of new scene). Actor (self) attributes are back to start value.
  • @themoonwalls thanks for clarifying that up. Another question to bug you with :) im putting an actor onto a scene. The actor name is "Reset" and in its rule i have "mouse down" set to "reset scene" when i play the scene, anywhere i click on the scene the game is reset, instead of only clicking on the reset button/actor. Plus the game doesnt play, rather it resets after every second. Any tips??:)
  • ElfizmElfizm Member Posts: 489
    You need to have the rule saying if touch is pressed which should mean in that area. I am not at the computer right now to give exact answer but mouse button down means any where. Which is your problem I do believe.

    So try if touch is pressed :)

    Cheers
    Elfizm
  • famekraftsfamekrafts Member, BASIC Posts: 834
    If touch is pressed and mouse is inside
  • IsabelleKIsabelleK Member, Sous Chef Posts: 2,807
    edited December 2012
    @sophisticated1024@hotmail.com
    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.
Sign In or Register to comment.