Sprite rotation
Is there anything in MicroScript 2.0 that can rotate and mirroring sprites?
Is there anything in MicroScript 2.0 that can rotate and mirroring sprites?
Here is a quick example:
screen.setDrawRotation(45)
screen.drawSprite("mysprite",x,y,20,20)
screen.setDrawRotation(0) // reset for subsequent draw ops
See the API doc: https://github.com/pmgl/microstudio/wiki/en-API#screensetdrawrotation-angle
oh. Thanks!
and another question, how can i mirror object while pressing the button?
I need to rotate it for a cannon game using arrow keys, how do I do that?
Code snippet from Quick Engin
if o.hflip then screen.setDrawScale(-1,1) end
if o.vflip then screen.setDrawScale(1,-1) end
if o.hflip and o.vflip then screen.setDrawScale(-1,-1) end
if o.rotation then
screen.setDrawRotation(o.rotation)
screen.drawSprite(o.name,(o.x-cx)*zoom,(o.y-cy)*zoom,o.width*zoom,o.height*zoom)
screen.setDrawRotation(0)
else
screen.drawSprite(o.name,(o.x-cx)*zoom,(o.y-cy)*zoom,o.width*zoom,o.height*zoom)
end
screen.setDrawScale(1,1)