Timer start by first mouseclick only

starting a scene there are e.g. 5 objects visible.
each object can be clicked.
now a timer should start by the FIRST mouseclick on an object only.
in this example the following 4 mouseclicks should be ignored by the timer, which means the timer should continue from the first click till all other objects are clicked.

(problem: at the moment in my script the timer starts again from the beginning by each click…)

you could make a counter variable that tracks the number of clicks. If you have 5 objects, the timer will be reset when the variable is 5.

could you please advise with a step by step procedere?
as a newbie and no-programmer i cant program this…
and: in this example there can be a lot more clicks like 5, nobody can know how much.
so the simple counting would not help.

Alright. My example shows just one way to do that in a very basic way.

At the beginning of the scene:

  • I create and pause the timer (the creation happens with the pause action),

  • I create a scene variable click_count and set it to 0 (this is as the name implies the counter for the clicks).

  • I also generate a random number of objects (between 1 and 5) at random positions on the screen.

Then I use the expression SceneInstancesCount() which gives the number of instances of my object that are on the screen and I store this value in the scene variable objects_on_screen.

When I click the object:

  • the timer is unpaused (now it is running)
  • the scene variable click_count is increased by 1
  • I delete the clicked object (to have a visual confirmation that I clicked all objects)

When the scene variable objects_on_screen equals the number of my clicks which I stored in the scene variable click_count:

  • the timer is paused (you can use any action you like here)

PS: If you feel a bit lost here, you should definitely follow some of the Gdevelop tutorials. GDevelop 5 tutorials [GDevelop wiki]

1 Like

first of all: WOW and thanks again drona.
i will test that asap.
and of course i am reading tutorials before asking, BUT
as i said it before: as a newbie/non-coder you would NEVER found such a solution…

me again… sorry.
but this is TOO complicated for me.
because i dont know what i am doing…
will have a look for an other solution.
thank you so much for your help!

no need to, that’s what the forum is there for

In the right upper part of the event editor is a button with a cross

In the menu you can choose among different event times and one of them is the For each-event.