as3 中的塔防游戏帮助
我一直在研究塔防游戏的教程(http://www.guahanweb.com/2009/01/31/tower-defense-in-as3-part-iv/),但我在制作第二张地图/道路时遇到了麻烦。我已经能够改变道路了。 (如果你还没有从源文件中弄清楚他在MagicTD文件中给出了this.points =[[__]])我已经替换
this.points = [[2, -1], [2, 5], [6, 5], [6, 16], [28, 16], [28, 4], [12, 4], [12, 19], [22, 19], [22, 12], [36, 12]];
this.grid_size = 16;
// this.setupTarget();
this.drawBackground();
this.setupMap();
this.setupTimers();
this.setupListeners();
为
map1btn.addEventListener(MouseEvent.CLICK, clickmp1);
this.grid_size=16;
and(map1btn是一个按钮) clickmp1 是
public function clickmp1(event:MouseEvent) {
this.points=[[1,-1],[2,5],[6,5],[6,16],[28,16],[28,4],[12,4],[12,19],[22,19],[22,12],[36,12]];
this.setupTimers();
this.drawBackground();
this.setupMap();
this.setListeners();
}
(检查其余部分的源文件(http://code.guahanweb.com/viewsource/td04/))
发生的事情是敌人正在地图和网格下面。
谢谢
雷神
I have been working off of a tutorial of a tower defence game(http://www.guahanweb.com/2009/01/31/tower-defense-in-as3-part-iv/) but I have been having trouble with making a second map/road. I've gotten to be able to change the road. (If you haven't figured out from the source file that he gives its the this.points =[[__]] in the MagicTD file) I have replaced
this.points = [[2, -1], [2, 5], [6, 5], [6, 16], [28, 16], [28, 4], [12, 4], [12, 19], [22, 19], [22, 12], [36, 12]];
this.grid_size = 16;
// this.setupTarget();
this.drawBackground();
this.setupMap();
this.setupTimers();
this.setupListeners();
with
map1btn.addEventListener(MouseEvent.CLICK, clickmp1);
this.grid_size=16;
and (map1btn is a button) and clickmp1 is
public function clickmp1(event:MouseEvent) {
this.points=[[1,-1],[2,5],[6,5],[6,16],[28,16],[28,4],[12,4],[12,19],[22,19],[22,12],[36,12]];
this.setupTimers();
this.drawBackground();
this.setupMap();
this.setListeners();
}
(check the source file for the rest (http://code.guahanweb.com/viewsource/td04/))
whats happening is the enemy is going under the map and the grid.
thanks
thor
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来您需要将地图设置在所有内容后面。为此,您需要执行以下操作:
MovieClip.setChildIndex() 的文档
这假定所涉及的所有内容都将“
this
”作为公共父级。或者,在所有东西上面扔一些东西:
It sounds like you need to set your map back behind everything. To do that you'd do something like:
Docs for MovieClip.setChildIndex()
This assumes everything involved has "
this
" as a common parent.Alternatively, to throw something on top of everything: