Howdy, Stranger!

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

Sign In Register

Spawning stuff randomly (Now crashing the Game!)

edited April 2019 in How To
@JR 01 i know your good with this stuff, other people can answer to.
in my game how do I make power ups spawn randomly and not spawn on spikes or enemy's in a place where the player can get to.
Please be detailed.


  • I would create a spawner that would extract (or being messaged) the Y coordinates of the player.
    Using an expression spawn the power-up just above the screen and keeping the X in the with of the screen. This will randomly spawn the power up.

    To make the power up delete, make the power up itself delete if its on top of something (either by collision or proximity). sending a message to spawn another power up after deleting that one would help to have a power up available.

    If your looking at specific spots to plant power ups, try setting the max and min of the X at certain heights (if player Y is above ##). Or just have have a random power up be at that spot.
  • How would make the power ups spawn at random times like either every 10 or 11 or 12 15 do I use a random then a filter and then which ever filter would start the certain timer for extracting?
  • Thanks I’ll try it out I might need some help on the way
  • edited April 2019
    @JR 01 when I place a power up on a spike its supposed to send a message and destroy itself.
    But instead it does nothing. I just figured out proximity works
  • edited April 2019
    Sorry, just got back on the computer @Johnny boy.
    I don't exactly know what your asking with the timers, but the random filter seems to do good.
    I guess you also fixed the power up on spikes issue?
  • edited April 2019
    @JR 01 I did the whole system but when the timer is done and its about to spawn, EVERYTHING turns white, and the game crashes!Please Help
    @grazer? @JR 01
  • edited April 2019
    Actually I think it might be when you touch a brain or maybe both!
    Edit: Nevermind its not when you touch a brain
  • Seems to work now but the power ups aren't spawning,
    was the power-ups the issue?
  • I just disabled it i will enable it in a second please reply soon!
  • @JR 01 I just enabled it Please try it again.
  • @Johnny boy
    power-ups still aren't spawning
  • @JR 01 yeah that’s because it crashes right before it
  • edited April 2019
    You also have to be 15 to 20 seconds into the game
  • edited April 2019
    I made it to 40 and no power-ups
  • @JR 01 try it right now I just fixed it Reload your page
  • @JR 01 when you go to trouble shoot it make sure you go into the object called spawner
  • I can't really tell whats going on, but we know it's the spawner.
    It doesn't show the signal to the spawn, but if I would have to guess;

    When it spawns on a spike, it deletes it and tells the spawner to spawn a another.
    This could be creating a loop and crashing the game for if each new spawn is on a spike.
    After a few loops in 1 frame the game could crash.

    I think instead of deleting the object, try to move it to the next spot until there isn't a spike.
    This way, it's the objects job to find a spot instead of the spawner keeps endlessly spawning.
  • Thanks I’ll try it
  • @JR 01 You are so helpful
  • @JR 01 It didn't work it still crashes
  • Maybe its something else
  • I... think you may need to remake your spawner...
    The system is very complex and hard to follow, you may be looping without realizing.

    Your extracting the player's location for everything which can also slow the game down,
    You shouldn't need an extractor for the x spawns for it could just be anywhere across the screen
    The power-up's also shouldn't need any positions from the player then from where the spawner says it should go, just move right until it's not on a spike.

    your making a new number in random several times when you spawn something, which could spawn several things at once.
    When you die the timers are reset without a new number so they don't spawn in the next game.
    Also, try to make the spawner independent without the messages from the power-ups.
  • That’s a lot I’ll try it
  • @JR 01 Can you send a picture I am really really lost
  • edited April 2019
    Ok, I completely remade your spawner and made a few changes in the power-ups.
    If you have any questions of what I did, just ask.

    -Random1 is to 1-4
    -Random2 is to 1-3
    -Random3 is to 1-17
    -Expression1 is a = input, b = 32 and are multiplied
    -Expression2 is a = player Y, b = 256 (8*32) and are subtracted
    -Most timers are set to 1 with a repeat of 1
    -The 4 timers in the middle are your different times (I set to 20, 30, 40, 50 but use what you prefer)
    -3 timers at the top right are set to 2 with a repeat of 1
    -The mailbox resets all timers upon death (I couldn't get it to work, try to use the right messages)


    -In the power-up's, I changed the spike proximity to 15 and turned off "only repeat once"
    -The mailbox deletes all objects upon death (I couldn't get it to work, try to use the right messages)


    The game doesn't crash anymore, but it does lag sometimes. You may be able to fix this in the power-ups if you find a better way to move them off of spikes. But overall, the game works with power-ups now.

    -Also change the brains collision from any to player, the power-ups were giving me free points
    -Also don't make the power-ups solid, but enable collision AND make the collision for Rise enemy 2 collision from any to spikes so it can go back and forth over the power-ups. Same with Rise enemy 3
  • @JR 01 I’m on mobile so I can’t do it right now but thank you so much!!!!!!!!!!!!
  • @JR 01 do you think if I add more power ups it will lag more?
  • edited April 2019
    @JR 01 how long are the timers that spawn the power ups.
    Nevermind i saw it
Sign In or Register to comment.

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

Contact us

Get In Touch