Rotate images - Change Center of Rotation

Mycael

Warper
Member
Joined
Dec 29, 2015
Messages
4
Reaction score
0
First Language
English
Hi all,


I have a problem with an animation I'm working on for my mv project.


I use this code:


this.rotation =  angle * Math.PI / 180;


But my image rotates following the top left corner.


I need my image to rotate at it's center.


My image is a bitmap


I need something like


this.translate( canvasRotationCenterX, canvasRotationCenterY );


Does rpgmaker have something similar to this?


Can anyone point me to the right direction?


Thank you.


All the best,


Mycael
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
What is 'this'?  A Sprite?  a Sprite_Base?


this.anchor.x = 0.5;


this.anchor.y = 0.5;


will set the anchor/origin to the center of the image.


Please don't post the same question multiple times in different places.  The mods will move it if it's in the wrong forum (or you can report it and ask it to be moved).
 
Last edited by a moderator:

Mycael

Warper
Member
Joined
Dec 29, 2015
Messages
4
Reaction score
0
First Language
English
Hi,


Thank you for the reply.


Sorry for double posting. I thought my first post wasn't sent.


About my image.


My bitmap object is associated with windows.


So, I use 


this.contents.blt(bitmap, 0, 0, pw, ph, 0, 0); 


to run my image.


I can't seem to use anchor.x and anchor.y


anchor is undefined. Thanks
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,045
Members
137,569
Latest member
Shtelsky
Top