Help with rotation a object

I am trying to create a basic puzzle game.
Right now I have trouble understanding how to rotate each circle.
The idea is to click and drag to rotate each circle

I would recommend that when user click on specific part of the picture (custom collision mask) - to rotate that part. And you can put to rotate as many degrees as you want in the actions.
In my opinion it is much fluid that way (without need to drag mouse) and you can even add custom controls for gamepads and keyboard…

You can’t make a custom donut shaped collision mask that’d fit each ring. GDevelop does not allow collision masks that have indentations or concave parts (the internal angle of a collision box vertex must be less than 180 degrees).

One way to get around this is for the largest image to have the collision mask. Upon clicking on it, determine which ring image it’s on based on the distance from the centre to click point. Then rotate that image.

Yes, there isn’t oval custom collision mask, but you can make circular image on top of rectangular image (via photoshop or similar) and the parts that is not image you make them transparent, so it will be rectangular collision mask but you will see that circles/image are rotating…

1 Like

use this method to determine, what picture to rotate.
then use the condition if mouse/touch is down
rote towards position MouseX()/MouseY() .
Edit: to make this work, you have to change the origin point of your sprites to the center.
since this method is not very precised, you can ether round the angles, or have some margins in your angle conditions, or both.
then you can use the angles of your parts as conditions to solve the puzzle.

1 Like