Trying to change to next level

eddysparkseddysparks Member Posts: 24
edited November -1 in Working with GS (Mac)
Im useing the asteroids template and trying to make it so when you destroyed all asteroids, you move on to another level with more asteroids. I thought it would be sumfin simple as adding CHANGE SCENE to the Win rule. But it changes the scene but does not start as a new level and does not allow to spawn a new ship. Can someone point me to what i have to do?

Comments

  • butterbeanbutterbean Member Posts: 4,315
    You should create a new actor prototype and name it "Change Scene"

    You should also create a global game attribute (integer) and call it "score" (or you could create one called "enemyshipsdestroyed" see below)

    Create a rule within that actor prototype, when game.score=5,000 then change scene to "scene 2"

    You can create different types of global attributes depending on what it is you want the player to accomplish in each level

    You could create one called "enemyshipsdestroyed" and make it integer

    Make sure you place a rule within the enemy ship that each time it's destroyed, add change attribute, game.enemyshipsdestroyed to game.enemyshipsdestroyed+1
    (Each time a player destroys an enemy ship, it adds 1 to that attribute.)

    Then you could create a rule within the invisible actor that, when enemyships destroyed =20, change scene to... Scene 2

    You need to have an attribute stating what goal it is you want your player to accomplish before moving to the next level...

    Also, make sure you place the actor prototype somewhere on the scene and make sure you make it invisible using the color icon and dragging it to 0% so the player can't see that box.

    Hope this helps!
  • eddysparkseddysparks Member Posts: 24
    So im changing the template so that the level does not end when all Asteroids are destroyed, but rather the level ends once the player has shot 12 ships?
  • butterbeanbutterbean Member Posts: 4,315
    Yeah, if you have only 12 ships on the first level, the way to track that is by creating a global game attribute called "ships destroyed" and make it integer

    So each time a ship is destroyed, create a rule within that enemy ship that Game.Shipsdestroyed = Game.Shipsdestroyed+1

    Then within another actor prototype (make it invisible and you can name it "change scene"), create a rule:

    When game.Shipsdestroyed=12, Timer, after 3 seconds, Change Scene to "Scene 2"

    You can also within that invisible actor prototype say, You Win! Timer, after 3 seconds, change to scene 2 etc...

    Also, within that same invisible actor "change scene" you can also place other rules in there, like if the player dies, then display text: Game over, and reset the game or go back to initial scene

    Hope this helps!
  • eddysparkseddysparks Member Posts: 24
    I tried but failed, ill come back to it another time see if it makes more sense then :) i need a coder to do it for me :-p
  • eddysparkseddysparks Member Posts: 24
    http://gamesalad.com/game/play/13224 i uploaded it anyways
  • quantumsheepquantumsheep Member Posts: 8,188
    Haha! Eddy, that's brilliant!

    CUBE!!!

    Don't worry mate, we all start somewhere, and the templates are as good a place as any.

    Once I'd grasped a few of the basics I never went back to them, but they're invaluable to new people trying things out.

    Why not try and make a game 'from scratch', without the template? Look at the behaviours - they're self explanatory most of the time, and when they're not, they have little notes that tell you what they do.

    Seriously, you'll learn a lot just from mucking about :)

    Good luck!

    CUUUUUUBE!!!!

    QS

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • superNESsuperNES Member Posts: 166
    Hi Eddie. I have a very simple test project that demonstrates how Change Scene works. If you like, please go to our contact page and submit a quick note with your email address and I'll forward it to you.

    http://www.gamesalad.com/landing/contact
  • harrioharrio Member Posts: 234
    what's cookin,

    i've published a rule i use to change scenes. hopefully it will help you.

    http://docs.google.com/View?id=dcrvmt6h_59dnzzdrcc

    the key parts to pay attention to are the rules at the top, and the scene behavior at the bottom. that pretty much does it all. all the variables are just stuff i wanted reset to certain values if you go back to the start of the game.

    hope it helps.

    noodles...
  • eddysparkseddysparks Member Posts: 24
    I think perhaps there is sumfin sumwhere else in the game that is preventing the Change scene command from doing its job. will have a little play around this morning see if i can stumble upon whats doing that :p

    Thanks everyone for your help.
  • eddysparkseddysparks Member Posts: 24
    Ok i had another play with it. I've reverted back to having the scenes change when there is no longer any enemies on screen. Except when all enemies are gone the screen freezes and flickers. So i changed it so scene changes when there is only one enemy left which works. Except now when the next level loads it does not come up with the 'press n' option to spawn a player, why is level 2 not doing the same as level 1?

    updated game http://gamesalad.com/game/play/13224
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    Looking at your game, it looks like your player disappears(gets destroyed) when you have one CUBE left on the screen. Do you reset 'Player On Screen?' to false somewhere so you can be able to Display Text the "Press N..."?
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    "Coding" in GameSalad is not that hard if you can think in the way that you do something else well.

    So if you are an artist and you are drawing speed lines on a fast moving car for a flipbook, you keep adding one speed line until you have enough. Then you go to the next page to draw speed lines on the next image.

    Rule: When mouse button down
    --Spawn Actor: Speed line
    --Change Attribute: game.totalSpeedLines = game.totalSpeedLines + 1

    Rule: When game. totalSpeedLines ≥ 12
    --Change Attribute: game.totalSpeedLines = 0 (because the new page has no speed lines)
    --Change Scene: nextPage
  • eddysparkseddysparks Member Posts: 24
    ok i think i learnt about the setting player to faulse. It now allows the player to appear on next level.

    Next issue is if i loose all 3 lives i made it so i goes back to start screen, but then on first level you still get the 'YOU LOOSE' text on level 1. I'm not seeing big obvious thing. I thought maybe using the reset Scene, or reset game but they dont seem to do anything.
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    So if you look at the rules in your game controller, it spawns your player when 'Player On Screen?' attribute is false and your number of lives is > 0 and you press 'N'.

    Somewhere between changing scene and entering the new scene, you need a Change Attribute behavior on the 'Player On Screen?' game attribute to be false.
  • eddysparkseddysparks Member Posts: 24
    Yeh ok i got the player working now but i got a whole lot of other problems now.

    http://gamesalad.com/game/play/13224
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    Check which rule is doing the change scene behavior. The condition is probably having to do with the number of cubes destroyed. Which means, you will need to reset that value as well.
  • eddysparkseddysparks Member Posts: 24
    so scene spawns cubes, player shoots the cubes, cubes goes down to zero. wen it gets to zero an action activates to send to next level where more cubes spawn.

    Scene spawns player, player dies 3 times, wen player lives reach zero, action activates to change to start of game. Plaer lives still zero becos no action to say its 3 again?
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    I could give a guess that you use a Change Scene to go to the first scene when you run out of lives. This does not necessarily reset the number of lives unless you have an actor that resets the lives. There is a Reset Game behavior that will take you to the first scene and reset all the attributes except for game.Time.
  • eddysparkseddysparks Member Posts: 24
    thanx
  • eddysparkseddysparks Member Posts: 24
    thanx for all the help, i've gotton a lil bit further today,

    http://www.gamesalad.com/game/play/13224;jsessionid=7BF62726B0FAD2F77FE04F252E80E3CD
  • eddysparkseddysparks Member Posts: 24
    next problem is amount of enemies.

    The over all game attribute starts with 'Enemies On Screen 4' which means thats how each level (scene) will start, with 4. So what happens if i want 4 enemies on Level 1, then 6 enemies on level 2? how can i change the 'Enemies On Screen' attribute according to the level (scene)?
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    On each individual scene, or the intro before the level starts, you can have the actor that controls when the Change Scene happens, to also do a Change Attribute on the Enemies on Screen attribute
  • eddysparkseddysparks Member Posts: 24
    so to do that i need to change 'enemies on screen 0' then put 'enemies on screen +4' inside the Actor that changes scene?
  • eddysparkseddysparks Member Posts: 24
    no idea what ive done now to prevent the 'N' from spawning player :-s
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    Depends on which Change Scene Actor you put it in.

    Double check what the conditions of your rules have, Use the Display Text behavior to show the value of any attributes you may be checking.
  • eddysparkseddysparks Member Posts: 24
    use what?
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    There is a behavior called Display Text. http://gamesalad.com/wiki/display_text_behavior
  • eddysparkseddysparks Member Posts: 24
    The problem is, i can double check the rules as much as i want, i dont know if they are right or wrong, i dont understand them. I thought they were right, but one is wrong, so god knows which one is wrong. Maybe they are all wrong. And why should i have to PROGRAM the software to show me the values of any attributes. What if i get that wrong to, might start showing me wrong attributes.

    I appreciate the effort to help me with this though.

    Im just a little frustrated now, and perhaps should have a cup of tea
  • superNESsuperNES Member Posts: 166
    Hi eddysparks. I think some of the difficulty you are experiencing stems from trying to, not only reverse-engineer, but at the same time re-manufacture a game project you may not be very familiar with.

    It's somewhat like trying to change a lego sculpture into a different one after it's been built. There's layers and interlocking pieces that, unless you know the reasoning and dependencies in the structure as well as the fundamentals of lego construction, make it difficult to change it into something else if you are still a novice. It'd be much easier to carefully study the original, decide what you need or don't need, then build your own from scratch. Then you know full well what a specific piece (behavior, attribute, rule, etc.) does and how it can be used.

    So my suggestion to you is to take what you've absorbed about GameSalad from playing around with the template, and start an empty project your own way. If the logic for keeping track of lives or restarting a level do not make sense, then create it in a way that does. Start from the bottom and build your game piece by piece. GameSalad will not remove the need to think of how things are put together, however it will make the act of putting them together much easier.

    That said, we will continue improving our templates and creating tutorials in the future that help new users understand how they were built. In the meantime, continue working with CodeMonkey and the rest of the community and I'm sure you'll be a pro in no time!
  • butterbeanbutterbean Member Posts: 4,315
    Eddysparks,

    If you need help, my twitter account is butterbean_21 I'll see what I can help you with, just direct message me, or send me a message through gamesalad messaging system, you'll get there, you're already doing a great job with your game, and you've just started out
Sign In or Register to comment.