I want to create a puzzle with several square images and:
-Constraint image rotation (via mouseups) to 90, 180, 270 then get back to 0 (4 movements)
-get the number according to the rotation grade (is the picture at 180º?) and send that value to a variable so I can compare it with other pictures
-if the values I want are true then execute (an animation, etc..)
I already got the rotations to work but I can't find in the documentation how I can constraint them until it gets to 270º
any help?
(attached drawing with concept)
thanks!
Ben
Constraint of Rotations?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Constraint of Rotations?
- Attachments
-
- Picture 3.png (43.37 KiB) Viewed 2731 times
Re: Constraint of Rotations?
One approach to some of your requirements might be to put the following in the script of your images:
This rotates the image 90 degrees clockwise with each mouseUp. The orientation is stored as a custom property of the image, currentRotation, which can take 0,1,2,3 as its values. The very first time you click the image, the currentRotation of the image is empty- the image is rotated 90 and the currentRotation set to 1. The final “put myRotation” is just to see how things work.
Regards,
Michael
Code: Select all
on mouseUp
rotate image id (the id of me) by -90
put the currentRotation of me into myRotation
if myRotation is empty then
set the currentRotation of me to 1
pass mouseUp
end if
put myRotation + 1 into myRotation
if myRotation > 3 then
put 0 into myRotation
end if
set the currentRotation of me to myRotation
put myRotation
end mouseUp
Regards,
Michael