简体   繁体   English

AS3绕着舞台上的特定点旋转MovieClip,无论MovieClip在哪里

[英]AS3 Rotating MovieClip around specific point on stage, no matter where the MovieClip is

I'm making a game in flash sc6, air for android. 我正在用Flash sc6开发游戏,适用于Android。

So let's say that my character is added to the stage at this position: character.x = 400; 假设我的角色被添加到舞台的以下位置:character.x = 400; character.y = 200; character.y = 200;

I have a MOUSE_DOWN function that moves the back ground (so it looks like the character is moving). 我有一个MOUSE_DOWN函数,该函数可以移动背景(因此看起来角色正在移动)。

Now I want a function that, when it's triggered, makes the back ground rotate around the character. 现在,我需要一个函数,该函数在触发时可使背景围绕角色旋转。

It should be so that no matter what the coordinates of the back ground is, it should always rotate around the character (400, 200) 无论背景的坐标是什么,它都应该始终围绕字符(400,200)旋转

Has anyone got any information or answers to how to do this?? 是否有人获得任何有关此操作的信息或答案?? Any code would also be helpfull Thanks in advance :) 任何代码也将有所帮助。在此先感谢:)

You're going to want to change the registration point of the background. 您将要更改背景的注册点。 This can be done using a simple transform matrix. 这可以使用简单的变换矩阵来完成。

see AS3: setting registration point of a DisplayObject with actionscript? 请参阅AS3:使用动作脚本设置DisplayObject的注册点?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM