我最近在做一個小遊戲
用滑鼠控制熊(bear)來吃金幣
天上會掉炸彈
路上會碰到敵人 按下滑鼠可以跳過去
如果碰到敵人的話熊會飛到天空變星星
但是我現在有幾個地方卡關
1.碰到敵人之後滑鼠按下的語法(onMouseDown)要變成無效
2.熊碰到炸彈後會播放他被炸到的樣子2秒,然後所有滑鼠指令(拖曳&跳越)也要延遲兩秒才能繼續動 並且回到熊原來的樣子
3.敵人出現機率:我有三種敵人,有一隻想要10% 其他兩隻各45%
以下是我寫的程式:
startDrag("bear", true,-1, 530, 950,530);
Mouse.hide();
if(bear.hitTest(deer)){ //碰到敵人
this.stopDrag();
this.stop();
bear.gotoAndStop(4); //播放熊飛出去的畫面之後結束遊戲
total = 0;
}
if(bear.hitTest(bomb)){ //碰到炸彈
bomb.gotoAndStop(1);
sound1 = new Sound();
sound1.loadSound("boom.mp3",true);
total = total- 60;
bear.gotoAndStop(2); //會播放他被炸的樣子
}
this.bear.onMouseDown = function() {
//按下去熊會跳起來,我想要碰到敵人後這邊的滑鼠語法變無效
this.gotoAndStop(3);
sound2 = new Sound();
sound2.loadSound("彈跳.mp3",true);
}
this.bear.onMouseUp = function() {
this.gotoAndStop(1);
}
問題蠻多的
請高手幫我解答~~~~謝謝!!!
This entry passed through the Full-Text RSS service — if this is your content and you're reading it on someone else's site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers. Five Filters recommends: 'You Say What You Like, Because They Like What You Say' - http://www.medialens.org/index.php/alerts/alert-archive/alerts-2013/731-you-say-what-you-like-because-they-like-what-you-say.html