random halpe

0 favourites
  • 3 posts
From the Asset Store
Easily generate many levels from a set of pre-built scenes (Construct 3 template)
  • Hello, I am really trying to do the following without success

    Please need help.

    I do it every 5 seconds to create random an object on the whole screen so far it's excellent. What I want is that in a certain territory it will not affect him.

    That means it won't do randomization on the area I wanted

    Tagged:

  • What you can do is check if the sprite is overlapping the grey area, and if it is then just reposition it to a new random position.

    Here's one way to do it, but the sprites may be in the grey area for a few frames sometimes.

    every 5 seconds
    -- create sprite at random(640), random(480)
    
    sprite: overlaps grey
    -- sprite: set position to random(640), random(480)

    Alternately you can do this to do it when the object is created. I used -- to indicate sub events.

    every 5 seconds
    -- create sprite at random(640), random(480)
    -- while
    -- sprite: overlaps grey
    -- -- sprite: set position to random(640), random(480)

    Or you could do this to not use sub events at all. It comes out the same.

    every 5 seconds
    -- create sprite at random(640), random(480)
    
    sprite: on created
    while
    sprite: overlaps grey
    -- sprite: set position to random(640), random(480)
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ty alot perfact work

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