Collision instance and animation (solved ✅)

Here is a test project. Even if it’s not exactly what you need, it should help.

project (click the green [code] button and select [download zip] extract and open the JSON file)
https://github.com/doug13579/gdevelop-wire-battery-example

Try me: All objects are draggable.
https://gd.games/keith_13579/batteries

This uses an array to hold the touching objects.
Start by adding an ID to the objects
Snap the objects to a grid and trigger a check

To check, you add the battery IDs to an array. You then go through the array and position a plus shaped test object. Check the collision between the test object and the wires. If they’re in collision then change the animation to “on” and add them to the array.

test object

It uses 3 objects, 1 group that has the battery and the wire object.

1 Like