Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

I'm trying to rotate a square  360 degrees, and I currently have the following code attached to a slider:

on change val do
 r.rotate[(pi/4)*val]
end

But when it rotates 90 degrees, it looks slightly off compared to 180 and 270:

How would I go about fixing this? ^^;

(+2)

Hmm. I can tinker with the internals of image.rotate[] to try to make it better behaved. When you need exact 90 degree rotation increments, image.transform[] is more efficient, and will always be precise. Here's a routine you could use as a workaround for now:

on rotated img steps do
 # modify 'img' in-place based on 45 degree steps:
 if     steps~0 # do nothing
 elseif steps~2 img.transform["right"]
 elseif steps~4 img.transform["right"].transform["right"]
 elseif steps~6 img.transform["left"]
 else           img.rotate[steps*pi/4]
 end
 img
end
(+2)

The workaround worked perfectly for what I needed, thank you! ^^