Find/target an object you are near

My son and I are trying to make a digging/mining game. We’ve been trying to use a bunch of different methods to “dig” (destroy) a near by “block”/object. So far we’ve discovered that Message’s “send to last contacted object” sort of works. Which ever block you bump into can be sent a message. The effect here was a good start but it was a bit all over the place unless you moved very very carefully.

We next tried to use RayCast which looked like it was going to do a bit better. We setup up/down/left/right to trigger 4 numbers(0,90,180,270) which feed as angle inputs to the RayCast component. My hope was that RayCast on hit would feed into a message component and send a message to the object detected by RayCast. This doesn’t seem to effect the “last contacted object.”

Are we headed in the right direction? Is there a better way? (hopefully my description was clear…)

Try using 2 proximity triggers, put the x or y,(doesn’t matter which) into a number block set to one. Put these to numbers into an NAND logic gate. The output of the NAND gate should be connected to the off input on a switch, take the output of one of the proximities and put it directly to the on of a switch, finally, take a mouse click trigger and put it into the switch.

Sorry I wrote so much, I’m away from a computer so I have to describe what I’m talking about…

I mean, I don’t know if you’re using RPG logic or platformer logic, but I don’t see why you don’t just use an emitter or something. You could emit a pickaxe animation or a projectile, and collision with that object destroys the block. That’s probably the easiest way.

If you’re using a side-view platformer for this take a look at this example The blocks around the player are highlighted, you can click these to destroy them and gain a block to place elsewhere. If you just want the click-to-destroy mechanic look at the behavior in the ‘block’ object. Clicking works pretty well for these kind of games

Fantastic ideas!!! Thanks so much everyone!

I’m still trying to parse exactly how to make the 2 proximity triggers might work… I’ll get experimenting to see if I can discover the method.

Thanks again.