public static void endOfTurn() { int points = PointAndCurency.GetPoints(); int multiple = 15; foreach (var soul in souls) { if (soul.soulName == "alive") { soul.age = soul.age + (1 * multiple); if (soul.age >= soul.maxAge) { soul.soulName = "dead"; } else { soul.goodLevel = soul.goodLevel + needCalculation(); } } } resourceMangement(); babySoul(); points = (int)(points * 1.2); PointAndCurency.SetPoints(points); }
public static void endOfGame() { int currentGold = PointAndCurency.GetGold(); int currentPoints = PointAndCurency.GetPoints(); if (currentGold >= 80) { currentGold = currentGold / 80; currentPoints = currentPoints + currentGold; } foreach (var soul in souls) { if (soul.soulName == "alive") { currentPoints = currentPoints + (soul.goodLevel - (soul.maxAge - soul.age)); PointAndCurency.SetPoints(currentPoints); } else if (soul.soulName == "currency") { currentPoints = PointAndCurency.GetPoints(); currentPoints = currentPoints + (soul.goodLevel / 2); PointAndCurency.SetPoints(currentPoints); } } }
/// <summary> /// Allows the game component to update itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> public override void Update(GameTime gameTime) { goldAmount = PointAndCurency.GetGold().ToString(); soulAmount = PointAndCurency.GetSouls().ToString(); pointAmount = PointAndCurency.GetPoints().ToString(); base.Update(gameTime); }
public override void Update(GameTime gameTime) { //Get the current keyboard state and keys that are pressed keyboardState = Keyboard.GetState(); Keys[] keys = keyboardState.GetPressedKeys(); foreach (Keys key in keys) { if (key == Keys.Back) { if (prevKeyboardState.IsKeyUp(key) && keyboardState.IsKeyDown(key))// && keyboardState.IsKeyDown(key)) { if (name.Length > 0) { name = name.Remove(name.Length - 1); } } } else { if (prevKeyboardState.IsKeyUp(key) && keyboardState.IsKeyDown(key))// && keyboardState.IsKeyDown(key)) { if (key == Keys.A || key == Keys.B || key == Keys.C || key == Keys.D || key == Keys.E || key == Keys.F || key == Keys.G || key == Keys.H || key == Keys.I || key == Keys.J || key == Keys.K || key == Keys.L || key == Keys.M || key == Keys.N || key == Keys.O || key == Keys.P || key == Keys.Q || key == Keys.R || key == Keys.S || key == Keys.T || key == Keys.U || key == Keys.V || key == Keys.W || key == Keys.X || key == Keys.Y || key == Keys.Z) { if (name.Length < 7) { name = name + key; } } } } } prevKeyboardState = keyboardState; currentMouseState = Mouse.GetState(); if (currentMouseState.LeftButton == ButtonState.Released && pastMouseState.LeftButton == ButtonState.Pressed && submitButtonRectanglePosition.Contains(currentMouseState.X, currentMouseState.Y)) { saveHighScore(name, PointAndCurency.GetPoints()); //this must pull out the info from elsewhere. ResetGameStats(); name = ""; this.Visible = false; this.Enabled = false; } pastMouseState = currentMouseState; base.Update(gameTime); }
public static void scoreSoul(int numSouls) { int currentPoints = PointAndCurency.GetPoints(); int currentSouls = PointAndCurency.GetSouls(); int selling = 0; foreach (var soul in souls) { if (soul.soulName == "currency" && selling < numSouls) { currentPoints = (currentPoints + soul.goodLevel); //currentSouls = currentSouls - 1; selling++; soul.soulName = "point"; PointAndCurency.SetSouls(currentSouls); PointAndCurency.SetPoints(currentPoints); } } }
protected override void LoadContent() { //values for strings pointAndCurency = new PointAndCurency(); goldAmount = PointAndCurency.GetGold().ToString(); soulAmount = PointAndCurency.GetSouls().ToString(); pointAmount = PointAndCurency.GetPoints().ToString(); //setting position of strings holding currency values goldStringPosition = new Vector2(330, 17); soulStringPosition = new Vector2(440, 17); pointStringPosition = new Vector2(620, 17); spriteBatch = new SpriteBatch(GraphicsDevice); //Loading textures goldCurrencyTexture = Game.Content.Load <Texture2D>(@"sprites\goldCurrency"); soulCurrencyTexture = Game.Content.Load <Texture2D>(@"sprites\soulCurrency"); pointCurrencyTexture = Game.Content.Load <Texture2D>(@"sprites\pointCurrency"); currencyContainterTexture = Game.Content.Load <Texture2D>(@"sprites\currencyContainer"); //loading Fonts spriteFont = Game.Content.Load <SpriteFont>(@"fonts\CourierNew"); currencyContainerDrawableRectangle = new Rectangle(0, 0, currencyContainterTexture.Bounds.Width, currencyContainterTexture.Bounds.Height); goldCurrencyDrawableRectangle = new Rectangle(0, 0, goldCurrencyTexture.Bounds.Width, goldCurrencyTexture.Bounds.Height); soulCurrencyDrawableRectangle = new Rectangle(0, 0, soulCurrencyTexture.Bounds.Width, soulCurrencyTexture.Bounds.Height); pointCurrencyDrawableRectangle = new Rectangle(0, 0, pointCurrencyTexture.Bounds.Width, pointCurrencyTexture.Bounds.Height); //+200 is sending the whole component to the right currencyContainerPositionRectangle = new Rectangle(0 + 250, 0, currencyContainterTexture.Bounds.Width / 2, currencyContainterTexture.Bounds.Height / 2); goldCurrencyPositionRectangle = new Rectangle(10 + 250, 10, goldCurrencyTexture.Bounds.Width / 2, goldCurrencyTexture.Bounds.Height / 2); soulCurrencyPositionRectangle = new Rectangle(130 + 250, 10, soulCurrencyTexture.Bounds.Width / 2, soulCurrencyTexture.Bounds.Height / 2); pointCurrencyPositionRectangle = new Rectangle(250 + 250, 15, pointCurrencyTexture.Bounds.Width / 2, pointCurrencyTexture.Bounds.Height / 2); //Loading Fonts base.LoadContent(); }
public override void Draw(GameTime gameTime) { spriteBatch.Begin(); spriteBatch.Draw(resultscreen, resultRectanglePosition, resultRectangle, Color.White); spriteBatch.DrawString(spriteFont1, "Congratulations you're done the game, your final score is: " + PointAndCurency.GetPoints(), new Vector2(65, 450), Color.White); spriteBatch.End(); base.Draw(gameTime); }