Spawn To Random Location

Discussion in 'BBNodes' started by Hanomax, Aug 29, 2019.

  1. Hanomax

    Hanomax Avid Boxer

    Joined:
    Aug 24, 2018
    Messages:
    157
    Likes Received:
    85
    I modified spawn node. In this snake game template, goal was to spawn food to random places, after colliding with it.

    [​IMG]

    And it must spawn inside this blue frame, not outside somewhere. For that, game objects are all in positive X and Y axis. It works with negative numbers also (like start X coordinate is -10 and end X coordinate is 10 etc),
    Modified spawn node looks like this:

    [​IMG]

    This is for X and Y axis, but it is easy to add Z axis also.
    Here I set minimum and maximum coordinates for X and Y axis, and it must spawn inside of those values.

    You can find spawn node inside actor's asset.
    BB DOC file is here: https://www.hanomaxgames.com/Downloads/Snake.bbdoc
     
    Last edited: Aug 31, 2019
    itzonator likes this.
  2. landofgreendev

    landofgreendev Boxer

    Joined:
    Nov 9, 2018
    Messages:
    85
    Likes Received:
    18
    That's awesome! Good job!

    I'm currently trying to figure out how to spawn an object on/in my actor. Currently I have an actor constantly moving forward but whenever I use the spawn node it will spawn the object but won't stay attached to the actor. Any idea on how to make it so the spawned object will move along with the actor?
     
  3. Hanomax

    Hanomax Avid Boxer

    Joined:
    Aug 24, 2018
    Messages:
    157
    Likes Received:
    85
    Check @Trapix Games Weapon + Bullet Node:
    https://www.buildbox.com/forum/index.php?threads/weapon-bullet-node.17472/

    There you can pick up a weapon, and it is attached to character.

    Maybe "Follow" node works also, but I don't have any examples yet, how to use it.
     
  4. JSeeger6

    JSeeger6 Avid Boxer

    Joined:
    Aug 29, 2018
    Messages:
    100
    Likes Received:
    12
    Is there a way to make it so that this spawn feature happens at a random time as well as location?
    For example, I am looking to place a power-up in my game, and I'd like it so that the power up spawns both randomly in time and in location. The location part is explained above I believe, however what about timing-wise?

    Thank you SO much!
     
  5. Hanomax

    Hanomax Avid Boxer

    Joined:
    Aug 24, 2018
    Messages:
    157
    Likes Received:
    85
    You could modify timer node with random function.
     
  6. TheGameAppStudio

    TheGameAppStudio Serious Boxer

    Joined:
    Nov 2, 2016
    Messages:
    927
    Likes Received:
    318
    @Hanomax If you have time could you please do it with the latest spawn nodes? I tried to do it but it spawns outside the walls.
     

Share This Page