public PlayerHUD(int id) { maxtemperatur = GameInformation.Instance.playerInformation.maxHealth; maxSnowball = GameInformation.Instance.playerInformation.maxAmountSnowball; currentTemperatur = maxtemperatur; playerId = id; //LoadTexture playerBackground = MyContentManager.GetTexture(MyContentManager.TextureName.HUDBackPlayer); playerFront = MyContentManager.GetTexture(MyContentManager.TextureName.HUDFrontPlayer); snowballBackGround = MyContentManager.GetTexture(MyContentManager.TextureName.HUDSnowBack); snowBallFront = MyContentManager.GetTexture(MyContentManager.TextureName.HUDSnowFront); //RectangleSnow rectangleSnow = new Rectangle((int)GameInformation.Instance.mapInformation.PositionHUD[playerId].X, (int)GameInformation.Instance.mapInformation.PositionHUD[playerId].Y, debugValuesnowball, debugValuesnowball);//snowballBackGround.Width, snowballBackGround.Height); updateRectangelSnow = new Rectangle((int)GameInformation.Instance.mapInformation.PositionHUD[playerId].X, (int)GameInformation.Instance.mapInformation.PositionHUD[playerId].Y, debugValuesnowball, debugValuesnowball); sourceRectangleSnow = new Rectangle(0, 0, snowBallFront.Width, snowBallFront.Height);; //RectanglePlayer rectanglePlayer = new Rectangle((int)GameInformation.Instance.mapInformation.PositionHUD[playerId].X, (int)GameInformation.Instance.mapInformation.PositionHUD[playerId].Y, debugValue, debugValue);//playerBackground.Width, playerBackground.Height); updateRectangelPlayer = new Rectangle((int)GameInformation.Instance.mapInformation.PositionHUD[playerId].X, (int)GameInformation.Instance.mapInformation.PositionHUD[playerId].Y, debugValue, debugValue); sourceRectanglePlayer = new Rectangle(0, 0, playerFront.Width, playerFront.Height); }
public Tilemap(int _tileSize) { powerUpTiles = new List <Tile>(); cloudTiles = new List <Tile>(); //Initialize Map tileTexture = new[] { MyContentManager.GetTexture(MyContentManager.TextureName.SkyTile), MyContentManager.GetTexture(MyContentManager.TextureName.SnowTile), MyContentManager.GetTexture(MyContentManager.TextureName.SnowTile_down), MyContentManager.GetTexture(MyContentManager.TextureName.SnowTile_up) }; Texture2D bitMap = MyContentManager.GetTexture(MyContentManager.TextureName.Map02); textClouds = new[] { MyContentManager.GetTexture(MyContentManager.TextureName.Clouds) }; snowColor = new Color[bitMap.Width * _tileSize + bitMap.Height * _tileSize]; particles.Capacity = 10000; stop = new Stopwatch(); snowTexture = new Texture2D(GraphicStuff.Instance.graphicDevice, bitMap.Width * _tileSize, bitMap.Height * _tileSize); tileSize = _tileSize; tileMap = new Tile[bitMap.Width, bitMap.Height]; size = new Point(bitMap.Width, bitMap.Height); realSize = new Point(bitMap.Width * tileSize, bitMap.Height * tileSize); snowTiles = new Particle[bitMap.Width * tileSize, bitMap.Height *tileSize]; rendTarget = new RenderTarget2D(GraphicStuff.Instance.graphicDevice, realSize.X, realSize.Y); BuildMap(tileTexture, bitMap); powerUpSpawner = new PowerUpSpawner(powerUpTiles); cloudSpawner = new CloudSpawner(cloudTiles); }
public void Update(GameTime gTime) { timer += (float)gTime.ElapsedGameTime.TotalSeconds; for (int i = 0; i < powerUpList.Count; ++i) { if (powerUpList[i].onPlayer) { powerUpTiles[i].hasPowerUp = false; powerUpTiles.RemoveAt(i); powerUpList.RemoveAt(i--); } else { powerUpList[i].Update(gTime); } } if (timer >= maxTimer) { timer -= maxTimer; Tile t = spawnTiles.Find(x => !x.hasPowerUp); if (t == null) { return; } powerUpTiles.Add(t); powerUpTiles.Last().hasPowerUp = true; Vector2 RandomPos = powerUpTiles.Last().position; powerUpList.Add(new PowerUp(MyContentManager.GetTexture(MyContentManager.TextureName.Tree01), RandomPos, 30, new PlayerModifikator(30, 30, 20, 10))); } }
public Game1() { graphics = new GraphicsDeviceManager(this); MyContentManager myContentManager = new MyContentManager(Content); Content.RootDirectory = "Content"; Constant.Gameref = this; }
/// <summary> /// Ein globales Konstrukt, um eine Anzahl von Partikel und deren Collision /// zu behandeln. /// </summary> /// <param name="_number"></param> /// <param name="_text"></param> public GlobalParticleHandler() { stop = new Stopwatch(); jopParticleDelete = new JobParticleDelete(); particles = new List <Particle>(); text = MyContentManager.GetTexture(MyContentManager.TextureName.SnowBall); partHandler = new ParticleCollisionHandler(text); }
public TitleIntroState() { Console.WriteLine("TITLEINTROSTATE"); font = MyContentManager.GetFont(MyContentManager.FontName.Arial); message = "PRESS SPACE TO CONTINUE"; elapsed = TimeSpan.Zero; Vector2 size = font.MeasureString(message); position = new Vector2((Constant.ScreenRectangle.Width - size.X) / 2, Constant.ScreenRectangle.Bottom - 50 - font.LineSpacing); }
public CloudSpawner(List <Tile> _cloudTiles) { spawnTiles = _cloudTiles; timer = 0; maxTimer = GameInformation.Instance.mapInformation.cloudSpawnTime; maxClouds = GameInformation.Instance.mapInformation.maxAmountClouds; Texture2D text = MyContentManager.GetTexture(MyContentManager.TextureName.Clouds); for (int i = 0; i < maxClouds; ++i) { Vector2 spawnPosition = spawnTiles[MapStuff.Instance.rnd.Next(0, spawnTiles.Count)].position; cloudList.Add(new Clouds(text, spawnPosition, new Vector2(1f, 0), 1, 0.1f, 300, 9, 6)); } }
public void Draw(SpriteBatch spriteBatch) { spriteBatch.Draw(background, new Vector2(0, 0)); spriteBatch.DrawString(MyContentManager.GetFont(MyContentManager.FontName.Arial), headline, Constant.Calculate(25, 20), Color.Red, 0, new Vector2(0, 0), 3, SpriteEffects.None, 0); spriteBatch.Draw(birdTexture, destRect, sourceRect, Color.White); continueButton.Draw(spriteBatch); //playButton.Draw(spriteBatch); exitButton2.Draw(spriteBatch); //exitButton.Draw(spriteBatch); if (troll) { shitClick.Draw(spriteBatch); } }
public MainMenu() { background = MyContentManager.GetTexture(MyContentManager.TextureName.BackGround_1270x720); pos = new Vector2(-150, 15); troll = false; Console.WriteLine("MainMenu"); continueButton = new MyButton("", MyContentManager.GetTexture(MyContentManager.TextureName.GoBUtton), new Vector2(95, 85), MyContentManager.GetFont(MyContentManager.FontName.Arial)); exitButton2 = new MyButton("", MyContentManager.GetTexture(MyContentManager.TextureName.ExitButton), new Vector2(5, 85), MyContentManager.GetFont(MyContentManager.FontName.Arial)); playButton = new MyButton("PlayWithMe", 200, 40, new Vector2(40, 60), MyContentManager.GetFont(MyContentManager.FontName.Arial), Color.Red); exitButton = new MyButton("Exit Game", 200, 40, Constant.Calculate(40, 68), MyContentManager.GetFont(MyContentManager.FontName.Arial), Color.Red); shitClick = new MyButton("Keine Tasten drücken, sondern die Maus bedienen! Faule Studenten", 600, 40, Constant.Calculate(1, 80), MyContentManager.GetFont(MyContentManager.FontName.Arial), Color.Red); birdTexture = MyContentManager.GetTexture(MyContentManager.TextureName.littleBird); destRect = new Rectangle((int)pos.X, (int)pos.Y, 64, birdTexture.Height); }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.RosyBrown); GraphicsDevice.SetRenderTarget(null); spriteBatch.Begin(transformMatrix: GUIStuff.Instance.camera.GetViewMatrix(gameTime), rasterizerState: rasterizerState); state.Draw(spriteBatch); int fps = (int)(1 / (float)gameTime.ElapsedGameTime.TotalSeconds); spriteBatch.DrawString(MyContentManager.GetFont(MyContentManager.FontName.Arial), fps.ToString(), GUIStuff.Instance.camera.position, Color.White); spriteBatch.End(); spriteBatch.Begin(); state.DrawGUI(spriteBatch); spriteBatch.End(); base.Draw(gameTime); }
public void CreateDebugSnow() { for (int i = 0; i < 20; ++i) { int j = 0; while (tileMap[i, j].Walkable()) { ++j; } --j; for (int p = 0; p < 5; ++p) { for (int k = 0; k < tileSize; ++k) { for (int q = 0; q < tileSize; ++q) { AddSnow(new Particle(MyContentManager.GetTexture(MyContentManager.TextureName.SnowBall), new Vector2((i - p) * tileSize + k, (j - p) * tileSize + q), 1, 1, Vector2.Zero)); } } } } }
public void Initialize() { PlayerManager.Instance.playerArray = new Player[2]; PlayerManager.Instance.playerArray[0] = new Player(0, new Vector2(200, 200), MyContentManager.GetTexture(MyContentManager.TextureName.mage), 32, 32); PlayerManager.Instance.playerArray[1] = new Player(1, new Vector2(300, 300), MyContentManager.GetTexture(MyContentManager.TextureName.mage), 32, 32); }