How do I go to the next level in a Breakout game?

0 favourites
  • 7 posts
From the Asset Store
The ultimate voice pack filled with 1,536 files of .......wav and mp3 of individual numbers, letters, and words (that go
  • This is probably simple, but here goes: I'm making a Breakout-game, where you bounce a ball to smash blocks, and stuff like that. I've found tutorials to do most things, but strangely, none of them shows how to change the levels once all the blocks are gone. So how do I do that?

    I know I can make seperate Event-sheets for each level, but I prefer to use a single Event-sheet as much as possible, to avoid having to copy and paste a ton of stuff (ball movement, power-ups, pad-movement etc). I use a sprBlock.Count to see if there are any blocks left, then move to Layer 2 if there's no more blocks. However, is it possible to simply go to the next layer instead?

    Also, is it possible to use two event-sheets for a single layout? If so, I can use one common Event-sheet and one specific to each level. And if that's possible, which one takes priority? So if I move the pad one way on the common sheet (like only left/right), can I move it differently on the level-specific Event-sheet (like up/down?)

    Thanks for any help. As you can understand, I'm new to all of this. This is my first project, in fact.

    EDIT: Sorry, I just noticed there is a Beginner's Question subforum here. I'll be sure to post there next time.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It just so happens I'm making something similar! You can take a look here: http://www.madladdesigns.co.uk/game/invaderoids.

    To change levels when all blocks are gone: place all the bricks in a Familiy (e.g called 'bricks'), and use bricks.count = 0. That's how i do it.

    you can include other event sheets into one. I've created a Player Event Sheet which holds all the bat and ball movements which i then include into all the other event sheets.

    Hope that helps.

  • Interesting. Right now I don't use Families to change levels. A simple sprBlock.Count = 0 does the trick quite well. The only problem is, as I said, that I don't know how to add other event-sheets into a single layout, or how to move to a new level. I can go from level 1 to 2 by telling the game to go to Layout2, but I can't seem to find a Go To Next Layout or anything like that. You would think it would be that simple, but... no. Or is it just me who's missing something?

    EDIT: D'oh... I tried right-clicking the Event-sheet, and it says right there "Include Event Sheet". So I made three new Event-sheets: One for level 1, one for level 2, and one for level 3 (each a different layout). Then I changed the name of first Event-sheet (with the pad, ball and blocks) to "General Stuff", and added a simple sprBlock.Count = 0 to each of the level-event sheets. So if the sprBlock.Count = 0 in event sheet 1, go to layout 2. If it's 0 in layout 2, go to layout 3. Now when I smash all the blocks in level 1, it continues to level 2, and when I smash the blocks there, it goes to level 3. Problem solved.

  • Glad you got it solved but beware that if you have different blocks with different attributes, e.g: sprBlock, sprDoubleHitblock, sprPowerDropBlock, sprTripleHitBlock, and so on then you'll have to have something like:

    if
      sprBlock.count = 0
    and
      sprDoubleHitblock.count = 0
    and
      sprPowerDropBlock.count = 0
    and
      sprTripleHitBlock.count = 0
    ...
    and
    ...
    then go to next layout[/code:2k2znn8w]
    Better to put them all in one family to make it easier.
  • Thanks, I'll try the family stuff. Howeve,r now I have a new, weird problem. I deleted the layout for level 2 and 3, then duplicated level 1 twice to make a new version. This works fine, except that when I change the event-sheet for one layout, it changes it for all of them. How can I assign individual event-sheets? Strangely, it worked fine the first time, so is it a bug? Or am I just missing something obvious again?

    EDIT: Solved the event-sheet issue, but now the game refuse to get past level 2. Even when all blocks are gone, it doesn't go to level 3, despite the event-sheet telling it to go there when all blocks are gone. It's the exact same code I've used all along, except now it doesn't work. Weird.

    EDIT 2: I cleared out all of Level 2 and put everything back, and now it works. Must have been an invisible block somewhere, I guess.

  • Lol! Sounds like you're having fun!...

    "Ahh.. I have this problem...."

    "Wait, no I haven't..."

  • Hehe, I'm having a lot of fun, yes. And while it sounds weird with "I have a prob... wait, I don't... actually I do...", there's a reason for it. When I get a problem I can't solve, I ask for help here. But that doesn't mean I give up trying to solve it. Sometimes it's a big problem, and I can't solve it. Other times, I'm missing something obvious. Like a stupid, invisible block.

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