private void GubbeSkjuter(SpelarMagi magi) { switch (magi) { case SpelarMagi.BasicSkott: { BasicSkott(); break; } case SpelarMagi.PowerSkott: { PowerSkott(); break; } case SpelarMagi.BasicLaser: { BasicLaser(); break; } case SpelarMagi.BigStoneSkott: { BigStoneSkott(); break; } } }
private void Setup() { Position = new Vector2(200, 200); lever = true; maxhastighet = 4; hastighet = 5; skada = 1; liv = 20; maxEnergi = 100; currentEnergi = 100; loadEnergi = 5; valdMagi = SpelarMagi.BasicSkott; shield = 30; riktning = new Vector2(1, 0); }
//Funktioner public override void Uppdatera(GameTime gameTime) { base.Uppdatera(gameTime); previousKeyboardState = currentKeyboardState; currentKeyboardState = Keyboard.GetState(); if (currentKeyboardState.IsKeyDown(Keys.D1)) valdMagi = SpelarMagi.BasicSkott; else if (currentKeyboardState.IsKeyDown(Keys.D2)) valdMagi = SpelarMagi.PowerSkott; else if (currentKeyboardState.IsKeyDown(Keys.D3)) valdMagi = SpelarMagi.BasicLaser; else if (currentKeyboardState.IsKeyDown(Keys.D4)) valdMagi = SpelarMagi.BigStoneSkott; UppdateraGubbensPosition(); GubbensPositionMotKanter(); EnergiReg(gameTime); GubbeSkjuter(valdMagi); GubbeShield(); }