如何改变闪光灯的阶段,ActionScript中的坐标原点? [英] How to change the coordinate origin in Flash's stage with Actionscript?

查看:186
本文介绍了如何改变闪光灯的阶段,ActionScript中的坐标原点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我觉得我这样做过,但找不到code。

I think I did this before but can't find the code.

Flash作为很多其他图形框架使用的左上角为坐标原点(0,0),因为它是如何底层的内存模型是惯例。

Flash as many other graphical frameworks use the top-left corner as the coordinate origin (0,0) because it's how the underlying memory model is by convention.

不过,这将是非常简单了我的计算,如果原产地是在舞台的中心,因为所有的游戏围绕中心,使用了大量的三角函数,角度等。

But it would be really simpler for my calculations if the origin was in the center of the stage, because all the game revolves around the center and uses a lot of trigonometry, angles, etc.

有一些内置的方法,如舞台:: setOrigin(UINT,UINT); 或类似的东西?

Is there some built-in method like Stage::setOrigin( uint, uint ); or something like that?

推荐答案

创建一个影片剪辑或者雪碧,并添加(而不是添加到舞台)在stage.width / 2的阶段作为根对象,stage.height / 2。然后,当你,而不是增加您的游戏对象的。添加您的游戏对象,在0,0该剪辑内,他们将在舞台上居中。

Create a MovieClip or Sprite and add that to the stage as your root object (instead of adding to the Stage) at stage.width/2, stage.height/2. Then when you add your game objects to that instead. Add your game objects at 0,0 inside of that clip and they will be centered on the stage.

这篇关于如何改变闪光灯的阶段,ActionScript中的坐标原点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆