How do I prevent creating an object between certain coord's

0 favourites
  • 3 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • Basically I am making a game whereby objects spawn randomly on my layout (1280*720) but I have the "player" in the centre of this layout and I don't want any objects to spawn on it.

    I am currently randomly spawning the objects using System --> Create Object --> random(5,1270), random(5,710)

  • you could try:

    Create at:

    X = choose(random(5, 630), random(650, 1270))

    Y = choose(random(5, 350), random(370, 710))

    I don't know how well that will work, but what it's basically doing is:

    Choose () = pick a random option from list of options

    so for X: spawn on left side of player, or right side of player (assuming player is at center 640, 360) and about 10 pixels away from exact center

    then for Y: spawn on top or bottom side of player

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • you could try:

    Create at:

    X = choose(random(5, 630), random(650, 1270))

    Y = choose(random(5, 350), random(370, 710))

    I don't know how well that will work, but what it's basically doing is:

    Choose () = pick a random option from list of options

    so for X: spawn on left side of player, or right side of player (assuming player is at center 640, 360) and about 10 pixels away from exact center

    then for Y: spawn on top or bottom side of player

    Thank you! Didn't realise you could set 2 conditions for each coord

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