ActionScript 3.0 可以移动舞台吗?

发布于 2024-08-30 04:28:44 字数 146 浏览 3 评论 0原文

您好,为了保持简短,假设我有一个像素大小为 400x400 的舞台,但我绘制了像素大小为 1000x1000 的地图。我希望我的播放器能够在舞台上“行走”,但 stage.x 和 stage.y 似乎是只读的?有没有任何方法或方式可以让舞台“滚动”,而不必移动地图上的每个对象?

Hi to keep it short and simple let's say I have a stage with 400x400 size in pixels, but I've drawn a map of 1000x1000 size in pixels. I want my player to be able to "walk" about the stage, but it appears stage.x and stage.y are read-only? Is there any method or way to have the stage "scroll" about, without having to move each object on the map?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

栀子花开つ 2024-09-06 04:28:44

不要移动舞台,移动 1000x1000 的物体,然后看起来整个物体都在移动。

Don't move the stage, move the 1000x1000 object,then it'll look like the whole thing is moving.

美胚控场 2024-09-06 04:28:44

你应该像一扇窗户一样看到舞台。根据窗口的大小,您可以看到其后面的所有内容。您无法更改舞台的大小或移动它。

就像窗户一样,您可以测量舞台的大小。您可以使用它通过动作脚本在舞台上导航例如电影剪辑。

为什么不将地图和其他对象放在单独的图层中,然后移动地图。其他对象(例如告诉用户其在地图上的位置的大红点)位于地图上的固定位置。只需根据红点沿着某种路径移动地图即可。

不完全确定你想做什么,但不可能移动舞台。

You should see the stage like a window. You can see everything behind it depending on the size of the window. You cannot change the size of the stage, or move it.

Just like a window you can measure the size of the stage. You can use this to navigate for example movieclips across the stage with actionscript.

Why don't you put the map and the other objects in a seperate layer, and move the map around. Other objects (for example a big red dot to tell the user its' location on the map) are on a fixed position on the map. Just move the map following a sort of path according the red dot.

Not entirely sure what you want to do, but it isn't possible to move the stage.

青衫儰鉨ミ守葔 2024-09-06 04:28:44

您可以将所有影片剪辑(玩家和地图,如果需要)放入一个影片剪辑中,仅将该影片剪辑放在舞台上并移动它。

但如果您只想滚动地图,只需移动地图即可。

You can put all the movieclips (the player and the map, if you want) in one movieclip, put only that movieclip on the stage and move that.

But if you only want the map to scroll, just move the map around.

淡水深流 2024-09-06 04:28:44

其他答案是正确的,但还有移动地图的替代方法:

ScrollRect

将一个矩形附加到地图的scrollRect 属性。移动该矩形将具有与移动舞台相同的明显效果。

使用scrollRect 与移动世界有一些小的优点和缺点,但是都尝试一下,看看哪种更适合你。

The other answers are correct, but there's an alternative to moving the map:

ScrollRect

Attach a rectangle to a your map's scrollRect property. Moving that rectangle will have the same apparent effect as moving the stage around.

There are minor pros and cons to using scrollRect vs. moving the world, but try them both and see which works better for you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文