private void RestartGame() { score = new GameScore(); player = new Player(playerImages[0].Width, playerImages[0].Height); mpC = new MapController(bgLeft, bgRight, bg); enemiesManager = new EnemiesManager(ship, heli, jet, NumberOfEnemies); waitingForButtonUp = false; isDead = false; }
private void Initialize(Context ctx) { mContext = ctx; NumberOfEnemies = 10; isDead = isPaused = false; bgLeft = BitmapFactory.DecodeResource(Resources, Resource.Drawable.game_bg_left); bgRight = BitmapFactory.DecodeResource(Resources, Resource.Drawable.game_bg_right); bg = BitmapFactory.DecodeResource(Resources, Resource.Drawable.game_bg); restartText = BitmapFactory.DecodeResource(Resources, Resource.Drawable.restart_text); mpC = new MapController(bgLeft, bgRight, bg); //bulletCoolDown = 1; SetBackgroundColor(Color.MediumBlue); bulletImage = BitmapFactory.DecodeResource(Resources, Resource.Drawable.bullet); screenW = mContext.Resources.DisplayMetrics.WidthPixels; screenH = mContext.Resources.DisplayMetrics.HeightPixels; fuelbar = BitmapFactory.DecodeResource(Resources, Resource.Drawable.fuel_bar); fuelPointer = BitmapFactory.DecodeResource(Resources, Resource.Drawable.fuel_pointer); fireButton = BitmapFactory.DecodeResource(Resources, Resource.Drawable.fire_button); fuel = new FuelManager(fuelPointer); //isDead = isPaused = false; playerImages[0] = BitmapFactory.DecodeResource(Resources, Resource.Drawable.player_middle); playerImages[1] = BitmapFactory.DecodeResource(Resources, Resource.Drawable.player_left); playerImages[2] = BitmapFactory.DecodeResource(Resources, Resource.Drawable.player_right); playerImages[3] = BitmapFactory.DecodeResource(Resources, Resource.Drawable.player_explosion); isUpdating = true; dpad = BitmapFactory.DecodeResource(Resources, Resource.Drawable.d_pad); score = new GameScore(); player = new Player(playerImages[0].Width, playerImages[0].Height); paint = new Paint { Color = Color.White }; textPaint = new Paint { Color = Color.White, TextSize = 50 }; gray = new Paint { Color = Color.Gray }; // Enemies ship[0] = BitmapFactory.DecodeResource(Resources, Resource.Drawable.ship_l); ship[1] = BitmapFactory.DecodeResource(Resources, Resource.Drawable.ship_r); heli[0] = BitmapFactory.DecodeResource(Resources, Resource.Drawable.heli_l); heli[1] = BitmapFactory.DecodeResource(Resources, Resource.Drawable.heli_r); jet[0] = BitmapFactory.DecodeResource(Resources, Resource.Drawable.jet_l); jet[1] = BitmapFactory.DecodeResource(Resources, Resource.Drawable.jet_r); enemiesManager = new EnemiesManager(ship, heli, jet, NumberOfEnemies); save = new SaveData(Context); highScore = save.GetHighScore(); handler = new Handler(); handler.Post(this); }