Cursor/touch is on object /inverted

I’m trying to have an object created on a mouse click as long as there is not a zombie under that mouse click.

I can’t get it to work. Would love some advice.
I’ve tried the suggestion of putting it in an advanced Not event but that doesn’t work either.

I think you are missing a touch / mouse clicked first and then the others have to be a subevent of this.

Please don’t say “it doesn’t work”. Explain the expected result, and explain the actual result.
In this case, you are creating a target object and you are deleting it at the same time. Obviously, you won’t see it.

Thanks @xisco and apologies @Gruk. That screenshot was a bit wacky. I don’t know why the create was above the delete. sorry. :hugs:

Here is the latest screenshot:

I’m trying to destroy zombies on the screen with a click if the cursor is over them and if the cursor is not over a zombie when clicked then a target is put down which the player starts walking towards.

The solution, I think, has something to do with the cursor not being over every instance of a zombie. Because the desired effect works when there is only one zombie left.

I’ve tried swapping the touch and cursor over inverted events. And I’ve tried putting them in the and logic and as suggested elsewhere in the forums in the Not logic:

I cannot work out how to make the cursor over object inverted event cover every instance of the objects.
Here’s the game to test:

You have explained the expected result, you haven’t explained the actual result.
I tried your link, it seems to work fine.
If I click near zombies, they are deleted. If there are no zombies, a target appears and I walk towards it.

Thanks @Gruk
I’m trying to not put the target down when I click a zombie. I want the player to be able to keep walking towards the target even when you are clicking on zombies to kill them.

Ah, okay.
First, I would try to reorder the events.

  • Left mouse button has been released
    – cursor is not on zombie, do…
    – cursor is on zombie, do…

But I’m not sure if/how this is handled. If you’re willing to share your project (or a dummy similar project), it will be easier to investigate.

I’d prefer the event to trigger from a mouse click rather than a mouse released event.
I’ve tried a number of different orders but nothing seems to work.
Here’s the link to the zip file. I’ve just been working on this one simple scene.

I’d still like the individual Zombie object to be destroyed on key/touch down rather than release, but this workaround works for now.

If anyone can suggest a way to add logic so that the touch on Zombie destroys it but if the touch is off Zombie then it puts a target down, then that’d be great.


That screenshot looks just like the previous one. :thinking:

Have you tried to add a trigger once to your button down conditions?

1 Like

Ah. I did it again. I think I put the same one up.
What I did this time was add key/touch down to add target part of the logic and key release to delete zombie.

Here is the screenshot that works.

I did put trigger once in before and it stops the action from working altogether which is strange.

Here’s a link to the game online.
I’m very impressed with how many zombies it can handle.

yes really impressive :sunglasses:, there are a lot of zombies. I tried your code but couldn’t make it work as you like :disappointed_relieved:.

1 Like

No worries, @xisco. I’m okay with how it is now. I may even remove the squashing mechanism and just have the player avoid the zombies.