How can I draw an image with rotation?
I'm trying to use StartDrawing(SpriteOutput(0)) as in game coding call render to texture, so I could transform this texture whenever I want.
But sadly I cannot draw a sprite in another sprite output. I try to drawImage in it, but draw image has no rotation.
This is very limited for game. It is nice if we can do anything in SpriteOutput like on openscreen
Rotate Image
Re: Rotate Image
You can already rotate a sprite with
Spiderbasic has inline javascript so maybe you can modify this to do what you need.
Code: Select all
RotateSprite(#Sprite, Angle.f, Mode)
Openscreen and the sprite commands are designed for speed/games.This is very limited for game. It is nice if we can do anything in SpriteOutput like on openscreen
Spiderbasic has inline javascript so maybe you can modify this to do what you need.
Code: Select all
function drawRotated(context, image, imageX, imageY, degrees) {
context.save();
context.translate(imageX, imageY);
context.rotate(0.017453292519943295 * degrees); // 0.017453292519943295 == Math.PI / 180
context.drawImage(image, -0.5 * image.width, -0.5 * image.width);
context.restore();
}