AS2从影片剪辑切换到帧?
我编写了一个小游戏,但现在我意识到我应该将所有动作包含在称为“动作”的图层上。到目前为止,我已经将代码写入了 movieclip。将其转换为框架有什么帮助吗?
onClipEvent (load) {
yspeed = 0;
lastx = 0;
gravity = 0.2;
speed = 5;
}
onClipEvent (enterFrame) {
yspeed += gravity;
if (_root.flake.hitTest(_root.cloud._x, _root.cloud._y, true)) {
yspeed = -9;
}
_root.cloud._x += (_root._xmouse-lastx+10)/speed;
lastx = _root.cloud._x;
_root.cloud._y += yspeed;
function asd() {
this._x += 2;
}
_root.flake.duplicateMovieClip("flake1",1,{_x:50, _y:350});
_root.flake1.onEnterFrame = asd;
}
希望你明白。所以没有那些 onClipEvents,只是一个我编写所有操作的框架。
另外,我是初学者,所以任何建议都很好!
提前致谢, 马蒂·莱恩
I've coded a little game, but now I realized that I should include all the actions to frame on layer called "actions". This far I've written my code to movieclip. Any help on transforming this to frame?
onClipEvent (load) {
yspeed = 0;
lastx = 0;
gravity = 0.2;
speed = 5;
}
onClipEvent (enterFrame) {
yspeed += gravity;
if (_root.flake.hitTest(_root.cloud._x, _root.cloud._y, true)) {
yspeed = -9;
}
_root.cloud._x += (_root._xmouse-lastx+10)/speed;
lastx = _root.cloud._x;
_root.cloud._y += yspeed;
function asd() {
this._x += 2;
}
_root.flake.duplicateMovieClip("flake1",1,{_x:50, _y:350});
_root.flake1.onEnterFrame = asd;
}
Hope you understood. So no those onClipEvents, just a frame where I write all actions.
Also, I'm a beginner so any advice could be nice!
Thanks in advance,
Martti Laine
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不太明白你的问题。
您是否想将上面的简单代码放在整个场景的第一帧中,或者电影剪辑的第一帧中。
如果它位于场景的第一帧上,那么您的代码将同步:
i don't understand your problem exactly.
do you want to put de code above simple in the first frame of your whole scene, or in the first frame of a movieclip.
if it is on your first frame on your scene then your code will synchronous: