Any suggestion about the mole movement in whack-a-mole

Hi guys,
I’m starting using gdevelop to prepare my first small game- whack-a-mole.

Now I have stucked to show the enemy-mole’s the positions.

Assuming there are 5 holes with the fixed positions (x1,y1),(x2,y2)…(x5,y5), so How I can show the mole in a random hole and then disappear?
and if I want to fast the pace when the game is reaching ending, how I can do that ?

Thanks very much.

1 Like

If you holes are objects, then pick a random hole and show the mole there. When you select a new condition, choose the hole object, and find the `Pick a random object’.


Reduce the time delay when selecting a random hole.

Thanks MrMen.
unfortunately those holes are not objects.
Do you have any other suggestions ?
Thnaks again

Is the board one image with 5 holes in it? You could create a hole object, position instances of it in the centre of the holes on the game board and just hide the new hole objects

oh ye, you are right I could create 5 objects then hide them.

so for the “pick a random object”, do i need to create a object group firstly ? then choose it from the group randomly.

as for to reduce the time delay, may I ask how to operate it? I cannot find the time delay part. thanks very much

Don’t create 5 different objects. Create 5 instances of the same object in the scene.

sir , I have put 2 instances of the same objects on the holes , and create events too.
see the attahced screenshots.

However, nothing happened. Would you mind help to have a check ?

Reallly appreciate it.

1660643353(1)

Thanks sir
I have created instances for testing however it didnt work.
There should be somewhere wrong in my events setting .
Would you please take a look ? thanks

  1. You aren’t positioning moleDown at all - does it exist, or do you need to create it?
  2. You need to reset the timer in that event
  3. You need to start the timer at the start of the scene, and
  4. Include a hidemole at the start of the scene event :

image

Thanks sir.

  1. the moleDOWN spirit is already created by me. I’m confused now how I can position it to a random hole? I tried “Create an object” but it needs X,Y coordinates. if in that way, then it looks not in a random way.

If the modeDown already exists, just change it’s position to the co-ordinates of the hole :

Thanks very much, Sir, it works. Now the mole can change the positions randomly.

would you mind 2 more questions please:

  1. first one is very wierd. when I hit the mole, the point should add 1; however the point add 9 or 10 or 8 for each hit. Do you have any idea why ?

  2. I still dont get how to make the mole move faster at the ending of the game than at the beginning?

Forget to add that I’m using the keyboard to control the hammer to hit.
Left key could move hammer to Left hole; Up key to up hole… etc.

when I press the key with longer time than each hit could have more points, while eahc hit should have only 1 point. This is what I found so far.

I think I found the reason why the points number is not correct.
Now I fixed it