Drawing game, backspace button

Hello community :sunglasses:

I want to put a backspace (or delete) button on this drawing game but I don’t know how to do it… The drawing functions are quite dark for me :smiling_imp:

Thank you for your help again

This is the link of the game :

To download the game :

The easiest effect you can hope to achieve is to have an ‘Undo’ type action. The lines themselves don’t have a hitbox, and aren’t subject to a collision detection (someone correct me if I’m wrong on this one). So deleting lines or line segments isn’t a simple option to implement at that.

Highlighted below are the extra conditions and actions to your current events needed to achieve this. you’ll also need to add a scene variable ‘CurrentId’.


Thank you very much for this answer,

It works very well when I move the cursor over the return button but when I replay the event: “Touch or Left mouse button is down” it doesn’t work anymore…

Here is the link of the game :

1 Like

The problem is that when you click on the undo button, the very first event also fires on the next frame as you’ve just started a new touch or mouse button down event. So the variable CurrentId is getting decreased and then immediately increased.

The solution is to add another condition to your first event, checking that the mouse/cursor isn’t over the NewObject3 (and as an aside, I suggest you give the objects decent/descriptive names. It took me a while to realise what NewObject3 is and what it’s supposed to be)

Also, the check of “The variable Id of NewObject = Variable(CurrentId)” in the second to last event can be removed. Just checking “NewObject is clearing its rendered image between each frame” is enough (and again, give NewObject a descriptive name).

Thank you again for this more than quick answer! :pray:

I have entered the extra conditions and it works perfectly.:heart_eyes: Thank you very much for your help. I will stop asking you :sweat_smile:
I changed the names of my variables, it’s true that they were not explicit.

It’s the game link :

Don’t stop asking - research it first, and if you still don’t understand, then ask. Sometimes the answer is right under your nose and you can’t see it, in which case asking for help gets other sets of eyes that may spot something you overlooked.