Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Register

How do I make a mechanic where if you kill all things on screen, it takes you to the next level?

I'm making a game like duck hunt-ish and I need to know this please.


  • It is pretty simple.

    Make a separate object off-screen

    Off Screen Object
    Mailbox (point) - number (1) - filter = (whatever the number of enemies there are in that level) - next level

    Message (point) to Off Screen Object

    If there are multiple levels like this, you have to keep making separate Off Screen Objects, and keep doing this chain of code.
    Hope this helps!
    - @ShadowAxeKid
  • Thanks this helps a lot. I've been using flowlab for a while, but this type of game is new to me. I usually make platformers. Have a nice day.
  • Glad to help! :)
  • I'm actually not getting it to work, could I see an example? I know I'm doing something wrong, I just don't know what.
  • edited October 2019
    Another Easy example is that you should add a health system of some sort using numbers and filters, then when the health reaches zero it will send a mailbox to you, add a filter saying the number of enemies there are so when all of the enemies are defeated you can progress to the next level. I don't know if it can help or if I explained it correctly, but this has helped me on some of my games.
  • Can you screenshot your code? I cannot do coding at this time, so I can only best help you by seeing what you did wrong.
  • @ManiacPumpkin hmm. Never thought of that example.
  • It's like your example, but more simplified. At least I found this out when testing out different designs on flow lab.
  • edited October 2019
    Another way to do this that is slightly more complicated but much more versatile is to have all the enemies on screen send a message to the player or an off screen object telling it to NOT go to the next level. You can pretty simply do this with a couple gates and filters. This way you can use the same code for each level no matter how many enemies there are. Also if you want to exponentially spawn more enemies this lets you. Idk just an idea.
  • Thanks all of you, this has all been great~!
  • screen clipping

    Here's a screenshot, I'm still not getting it, but i'm closer.
  • Ah, I see the problemas.

    first, attach the mailbox to in, not set.

    Next, get another number block, and put it at 0

    Hook the 1 number to the 0 number through add. Think that should do it.
  • @ShadowAxeKid that wouldn't work because of how the filter is set, try this instead.

    Mailbox>in-number--1>+-number-(however many enemies you want)>in-filter-0>next level
  • @my_name (<_>) ah, yes. A mistake from me. XD. That works too.
  • This helps, but It's still not working. I think I'm doing something wrong on the enemies.

    screen shot

    But, I think I'm closer. You guys have been a great help.
  • edited November 2019
    Here is what I did, just import it into your game

    Also how do you make it so it doesn't show the whole thing?

    {"data":{"behavior":{"v":"2","nodes":[{"inputCount":0,"outputCount":1,"name":"Mailbox","behaviorType":"logic.components.Mailbox","x":270,"y":192,"group":"","id":"276b05651e305d4b","msg":"death"},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":450,"y":192,"group":"","id":"276b4e3d1a027648","startVal":-1,"tag":""},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":630,"y":192,"group":"","id":"277042a3c2208146","startVal":5,"tag":""},{"gateVal":0,"mode":"equal to","inputCount":2,"outputCount":2,"name":"Filter","behaviorType":"logic.logic.Filter","x":810,"y":192,"group":"","id":"2773f34cfd7bad4f"},{"inputCount":1,"outputCount":1,"name":"NextLevel","behaviorType":"logic.gameflow.NextLevel","x":990,"y":192,"group":"","id":"27744dce8b45e940","levelName":null}],"links":[{"input_id":"276b4e3d1a027648i1","output_id":"276b05651e305d4bo0"},{"input_id":"277042a3c2208146i2","output_id":"276b4e3d1a027648o0"},{"input_id":"277042a3c2208146i2","output_id":"276b4e3d1a027648o0"},{"input_id":"2773f34cfd7bad4fi0","output_id":"277042a3c2208146o0"},{"input_id":"2773f34cfd7bad4fi0","output_id":"277042a3c2208146o0"},{"input_id":"27744dce8b45e940i0","output_id":"2773f34cfd7bad4fo0"},{"input_id":"27744dce8b45e940i0","output_id":"2773f34cfd7bad4fo0"}]}}}

  • @my_name (<_>) Click the thing on the bottom left corner of the screen. (Idk what computer you have, so I can't be specific.) Search the "snipping tool"
  • It still won't work, I imported the code. I am really lost at this point. Here's all my code if it helps. And, sorry if I don't get back for a while, I'm going to be away for the weekend.

    screen screen

    screen screen screen
  • Have an enemy's death add to a number, for example every death adds 1 to a total put that in a filter anything equal to 10 plugs that into next level, kill all 10 enemies per se and done.
  • @oliver.stanton, do you mind sending the game link?
    With this much help, I thinking it could be a personal error or possibly a bug.
    I can test a few things out myself with the link.

    ...Also in the screenshot, most of your NextLevel behaviors doesn't have a level selected for it to go to another level.

    Here's the link to the game @JR 01 I must be really bad at this or something, I've gotten so much help and haven't gotten it. Hopefully I get it soon.
  • edited November 2019
    @oliver.stanton, its a learning curve and its always the little stuff that get ya.

    Here's what you need in the "Big Bun" or "enemy" object:
    1 November, 2019 - Loom Recording_Moment

    And in the "Next Level Mechanic" or the "other thing",
    you just need to select a level in the behavior (if not "Level 2").
  • I tried all that and it STILL won't work. I did exactly what you showed. I think I have another problem somewhere else in the game that's effecting it. I can't believe that this is working so poorly. I think I need to do a deep dive into the code to search for the problem, and please if someone has an example or finds a way for it to work, send me the link to the game so that I can see it. But, thank you all for trying so hard and helping me.
  • edited November 2019
    So close but the message and mailbox are cap sensitive.

    Message says "point"
    Mailbox has"Point"

    point ≠ Point
    Point = Point

    Just capitalize the P in the message and it will work
  • Boy, this must be a big problemas XD.
Sign In or Register to comment.

| make games in your browser
@ 2017, All rights reserved.

Contact us

Get In Touch