Random positions

0 favourites
  • 4 posts
From the Asset Store
Vector illustration of a UFO with an alien in three different positions.
  • I want to make an item to spawn at a random position on the right side of the map.

    I want it spawn at random position on the right side only please!

    Help will be appreciated.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • creat object

    set position to x = random(scrollx, scrollx + originalwindowwidth / 2); y = random(scrolly - originalwindowheight/2, originalwindowheight))

    Or if you mean the right edge of the screen for x it is not random, but just scrollx + originalwindowwidth / 2

    hope I didn't make a mistake. scrollx and scrolly should be the middle of your window and half of the screen width added, you will be at the edge; for your understanding.

  • I am sorry i didn't explain that,i meant it would have a bullet behavior then spawn on the right of the layout then move to the left of the layout.

    Help again please!

    creat object

    set position to x = random(scrollx, scrollx + originalwindowwidth / 2); y = random(scrolly - originalwindowheight/2, originalwindowheight))

    Or if you mean the right edge of the screen for x it is not random, but just scrollx + originalwindowwidth / 2

    hope I didn't make a mistake. scrollx and scrolly should be the middle of your window and half of the screen width added, you will be at the edge; for your understanding.

  • you can use wrap behaviour

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