//隨機產生一個障礙物 final ImageView imageViewza = (ImageView)findViewById(R.id.imageViewza1); Animation translateAnimation1, translateAnimation2; translateAnimation1 = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, -20f, Animation.RELATIVE_TO_SELF, -0.5f,Animation.RELATIVE_TO_SELF, -0.5f); translateAnimation2 = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, -20f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f); translateAnimation2.setDuration(5000); translateAnimation1.setDuration(5000); final Animation finalTranslateAnimation1 = translateAnimation1; final Animation finalTranslateAnimation2 = translateAnimation2; //監聽動畫在不一樣的時間段所須要完成的操做 translateAnimation1.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { finalTranslateAnimation1.setStartOffset(2000); } @Override public void onAnimationEnd(Animation animation) { int num = (int)(Math.random() * 2); if(num == 1) imageViewza.startAnimation(finalTranslateAnimation2); else imageViewza.startAnimation(finalTranslateAnimation1); } @Override public void onAnimationRepeat(Animation animation) { } }); imageViewza.startAnimation(translateAnimation1); //監聽動畫在不一樣的時間段所須要完成的操做 translateAnimation2.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { finalTranslateAnimation2.setStartOffset(2000); } @Override public void onAnimationEnd(Animation animation) { int num = (int)(Math.random() * 2); if(num == 1) imageViewza.startAnimation(finalTranslateAnimation2); else imageViewza.startAnimation(finalTranslateAnimation1); } @Override public void onAnimationRepeat(Animation animation) { } }); imageViewza.startAnimation(translateAnimation2);
今天繼續修改了一些音樂和控件的問題,因爲功能的增長,主界面在不斷地修改,以求完善。而後對於已粗糙實現的功能進行細化,以前遊戲的實現過程當中使用的是網上現成的圖片和人物,如今並開始着手設計製做符合咱們遊戲主題的奔跑人物的形象。主界面也再次進行了更新,如圖
dom
成員 | 貢獻值 |
---|---|
譚鑫 | 5 |
黃宇塘 | 5 |
趙曉海 | 5 |
方藝雯 | 5 |
王禹涵 | 5 |