public void Initialize(SpriteBatch batch) { rainDropsTimer.Start(); Plant plant = new Plant(); plant.Position = new Vector2(Game1.graphics.PreferredBackBufferWidth / 8, Game1.graphics.PreferredBackBufferHeight - plant.GetSize().Y); plantList.Add(plant); Plant plant2 = new Plant(); plant2.Position = new Vector2(Game1.graphics.PreferredBackBufferWidth * 6 / 8, Game1.graphics.PreferredBackBufferHeight - plant2.GetSize().Y); plantList.Add(plant2); DeathFactory factory = new DeathFactory(this); factory.Position = new Vector2(Game1.graphics.PreferredBackBufferWidth / 2, Game1.graphics.PreferredBackBufferHeight - factory.GetSize().Y); deathFactoryList.Add(factory); graphicsHandler = new GraphicsHandler(); graphicsHandler.Initialize(batch); oldState = new KeyboardState(); background = new Sprite(); background.Initialize(); background.Texture = Game1.contentManager.Load<Texture2D>(@"Images\Gradient"); background.Size = new Vector2(Game1.graphics.PreferredBackBufferWidth, Game1.graphics.PreferredBackBufferHeight); background.Layer = 0; player = new Player(background.Size); backgroundSprites.Add(background); notCarrie = Game1.contentManager.Load<SoundEffect>(@"Sounds/carrie2"); notCarrieInstance = notCarrie.CreateInstance(); }
public void Draw(GraphicsHandler g) { g.DrawSprite(FactorySprite); }
public void Draw(GraphicsHandler graphicsHandler) { graphicsHandler.DrawSprite(plantSprite); }
public void Draw(GraphicsHandler g) { g.DrawSprite(poisonCloudSprite); }
private void DrawShades(GraphicsHandler g) { if (shadePositions.Count > 0) { float alpha = SHADE_TRANSPARENCY; Vector2 startPosition = position; lock (locker) { Color color; foreach (Sprite sprite in spriteDict.Values) { color = new Color(30, 30, 30, 30); sprite.Color = color; } //TODO: Test if reverse order is needed List<Vector2> reversedList = shadePositions.ToList<Vector2>(); foreach (Vector2 v in reversedList) { Position = v; foreach (Sprite sprite in spriteDict.Values) { color = sprite.Color; color *= alpha; sprite.Color = color; g.DrawSprite(sprite); } } foreach (Sprite sprite in spriteDict.Values) { sprite.Color = Color.White; } Position = startPosition; } } }
private void DrawWindPuff(GraphicsHandler g) { WindPuffMessage puff; for (int i = windPuffList.Count - 1; i >= 0; i--) { puff = windPuffList.ElementAt(i); windPuff.Position = puff.Position; windPuff.Rotation = puff.Direction; g.DrawSprite(windPuff); if (puff.checkAge()) windPuffList.RemoveAt(i); } }
public void DrawSick(GraphicsHandler g) { Color color = Color.ForestGreen; color.A = 128; spriteDict[PlayerSprites.Cloud].Color = color; g.DrawSprite(spriteDict[PlayerSprites.Cloud]); spriteDict[PlayerSprites.Cloud].Color = Color.White; }
public void Draw(GraphicsHandler g) { lock (locker) { DrawWindPuff(g); DrawShades(g); foreach (Sprite sprite in spriteDict.Values) g.DrawSprite(sprite); if (isSick) DrawSick(g); } }