frame

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 randomly spawn enemies in a specific area

im making a game in which u have to hit zombies with your car. originaly i just put zombies in the level, but now id like to make it random. if anyone can help me that would be awesome. here is my game so u can play and see

Comments

  • edited January 3
    also definatly look at the code

    also another thing, when u restart the game for a third time, u cant see the start button, why is that?
  • edited January 3
    @AgamemnonEX
    This is a pretty good game.
    You can try using a random set one to the X and one to the Y of the position.
    The min and max needs to be the width and height of the game separately.
  • i tyed to do something like that but it wont work. could u give me an example?
  • i got it to work, but its only spawning zombies at x0, y-3. can you help me trouble shoot? wierd thing is, is that when i play the code, im seeing random nubers that are in the playing space, but when i go to play the game, they only spawn at that exact point i just mentioned.
  • You are close, but to spawn something at a specific point, you need to first set the x & y, then trigger the spawn input.

    Also, keep in mind that the x & y spawn inputs are pixel positions, not grid positions. If you wanted to e.g., spawn a zombie at grid position (4,2), then you would do the following:

    set the Spawn block x input to 128 (4 * 32)
    set the Spawn block y input to 64 (2 * 32)
    trigger the Spawn block spawn input
  • thx alot. so can i only spawn things at a certain position, or can i spawn things at random positoins?
  • edited January 5
    Ok, I think I found a way that will help but its adding a bit that may get complex.

    I made the zombies spawn above the car just above the screen and anywhere across the screen.
    I added an extactor the the car to always see its Y position and messaged it to the spawner.
    The second timer is set to 1 just for a small delay so that they do spawn after the X and Y input.

    Random is set min: 0 and max: 530
    Expression is set A: 0, B: -250, and out = A+B

    (I aslo put a message to the click in car to the start on timer in spawner. To not start spawn unless started)
    2019.01.04-17
Sign In or Register to comment.

flowlab.io

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

Contact us

Get In Touch