Object Create/Object delete conundrum

Creating a basic game where the user will interact with the UI only to make a decision before moving to the next level (or not, if the wrong object is selected). Very early stages. Front End Dev by trade, but I am struggling with some very basic stuff, so please excuse any inaccuracies.

On first touch the game starts, player begins running until he encounters the first “enemy” in the form of a saw.

  • obj/sprite appears asking for help, (using show/hide) disappears 3 secs later

  • 2 obj/sprites are created, and appear

  • if player touches one, it rotates, and an animation will take place based on if the player selected the correct choice

  • the other obj/sprite is deleted

Here is where I am struggling:
a. If you click where the object is, before the game gets to this point, even though invisible, the object, once it does show, will already have rotated, and the other will be deleted.

b. If you touch in the space of the “deleted” objects location, it will appear and delete the other.

c. When touching elsewhere, multiple objects will display.

I searched for answers, and the only thing I could find was to create the objects as I did, and they should be unable to be clicked as they are not in the scene yet. But this did not work for me. I was not able to find a solution to deleted objects reappearing.

a. to c. answer:
Add a condition “Visibility of an object”.
and also "Mouse button pressed " (in addition of “The cursor/touch is on object”)

The logic is :
If the cursor was on the objectA
and if objectA is clicked/touched
and if objectA is visible —> Do an action

1 Like

:woman_facepalming:t4: Thank you!!

I thought I had this figured out after implementing the above, but after playing around with it, the behavior remains somewhat the same. Appears to work, but after testing the touch on each object, it still shows as if the delete is not actually deleting the object.

I think the problem is your timer logic, because base on the image you sent,

if timer > 4 then create objectA
if timer > 6 delete objectA

so if 7 secs already passed, it will delete and create again and again. So try to improve the logic (I am also struggling in using timers)

I also dont think you need that “a new touch has started”, because its just for multitouch games.

Lastly, I dont think adding force to the background is a good/proper way.

btw, I am also a beginner in Gdevelop, so all of it is just a newbie advice.