This content has been marked as final. Show 3 replies
Your script works fine, so long as there is a sprite in channel 2 which supports the rotation property. #shape and #filmloop members (for example) are not affected by changes to the sprite's rotation.
I've rewritten your behavio slightly. This version rotates the sprite that it is attached to, and this remains in its rotated position when you click a second time:
property pSprite -- sprite to which this behavior is attached
property pRotate -- boolean. If TRUE, sprite rotates
pSprite = sprite(me.spriteNum)
pRotate = TRUE
pRotate = not pRotate
if pRotate then
pSprite.rotation = pSprite.rotation + 10
-- pSprite.rotation = 0
I assume this is a behavior script attachd to the button sprite.
Properties don't work with movie scripts.
You might end up with the ration stuck at 360, I don't think it wraps
when incrementing beyone 360
you could try using mod, perhaps something like
if switchy = TRUE then sprite(2).rotation = (sprite(2).rotation + 10(
The maximum rotation of a sprite is 21474836.47 or (the maxInteger) / 100.0.
If you rotate the sprite 10° sixty times a second, it will stop rotating after just under an hour.