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’.
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…
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).
I have entered the extra conditions and it works perfectly. Thank you very much for your help. I will stop asking you
I changed the names of my variables, it’s true that they were not explicit.
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.