Status
Not open for further replies.

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

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
41,839
Reaction score
14,502
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
 

RyanYe

RPG Game Lover
Veteran
Joined
Dec 31, 2020
Messages
75
Reaction score
10
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).
i got the very same problem , i don't want to send a duplicate post since this one already reply-able

i don't know how to set anchor.x, can you tell me? i want to write this in a plugin js file

thank Shaz!
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
41,839
Reaction score
14,502
First Language
English
Primarily Uses
RMMV

@RyanYe, please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.



Our necroposting rules apply whether the thread has been closed or not. The OP already had an idea where the code needed to go, even in their response. And you have not indicated what sort of images you are trying to rotate either, so we can't tell you anything more than what's already above.

Please start your own new thread and provide enough detail about what you're trying to do so we're not just guessing at possible solutions.
 
Status
Not open for further replies.

Latest Threads

Latest Profile Posts

MythicRuss wrote on gothicvoid's profile.
hi, i was looking thru ur awesome stuff, and was looking around the internet, how in the heckin heck do i get the hiddendoors to open? im addng them to the doors event but they just appear as solid walls, btw am total noob lol
currently working on some template sprites and tweaking the walk cycle :)
Lunee.jpg
Early try to draw our Demon Countess, who destroyed her own soul leaving just an empty shell of a body - until our heroine unwillingly takes possession of it, every time she falls asleep.
(I know it’s a premade face from the Dark Fantasy Set, but I spent so much time with her, that I can’t bring myself to change the sprite anymore xD)
I finished setting up my new desk and apparently she thinks this is where she goes now.

20210411_082331.jpg

Forum statistics

Threads
110,305
Messages
1,052,139
Members
143,336
Latest member
claanxy
Top