How do I spawn the object in different constant position?

0 favourites
  • 2 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hello, I'm a beginner and new here. Started making simple game like wreck-a-mole game.

    There are 9 constant-positioned holes. So, I thought that was easy to use "Choose" method by choosing both X and Y for appearing moles. Like this

    But that's not easy at all. With this method, it will make some moles overlapped/collided with already-spawn mole.

    Luckily, when I hit the mole, it shows that I hit only 1 mole. (I don't know why, but yeah...)

    Later, I decided to make game instantly over when the playfield is full of moles. (Every hole has a mole in it).

    I use molecount variable and set it when molecount is greater or equal to 9, set the timer to 0.

    And problem occurred again. The game was over before the playfield is full of moles.

    I slightly know why but still don't know how to fix it. Maybe I was wrong at the beginning that used "choose" method, was I?

    If so, what method should I use instead? The method that random the constant position (like choose) to spawn moles in different holes (a.k.a. any hole except the hole with mole) to not be overlapped or collided at any time, so I can make it instantly game-over when the playfield is full of moles as I wish.

    I appreciate every help, thanks! :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Set up 9 moles and make them invisible. Give them an instance variable and ID number so you can identify them. Then choose 1-9 to pick them at random and make them visible for a few seconds, animate then invisible again.

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