public void createExplosion(Enemy enemy, GameTime time) { Explosion explosion = new Explosion(); explosion.Texture = explosionTexture; explosion.Width = explosion.Texture.Width / numFrames; explosion.Height = explosion.Texture.Height; explosion.Move(enemy.Position.X + (enemy.Width * 0.5f), enemy.Position.Y + (enemy.Width * 0.5f)); explosion.ScaleFactor = 4f + RandomHandler.GetRandomFloat(2); explosion.Rotation = RandomHandler.GetRandomFloat(360); explosion.Speed = animSpeed + RandomHandler.GetRandomFloat(2); explosion.LayerDepth = 0f; explosion.Color = Color.White; explosion.CreationTime = (long)time.TotalGameTime.TotalMilliseconds; explosion.Active = true; explosionSprites.Add(explosion); if (debug) { Console.WriteLine("Created new explosion at: " + enemy.Position.ToString()); } }
private void lateInit() { hero.createHero(); bg = new BackgroundHandler(); fg = new ForegroundHandler(); skyHandler = new SkyHandler(); obstacleHandler = new ObstacleHandler(); itemsHandler = new ItemsHandler(hero); enemy = new Enemy(); explosion = new Explosion(); osc = new OSCHandler(); RandomHandler.init(); ColorHandler.loadColors(); GameStateHandler.CurrentState = GameState.IDLE; handleSettingsInput(); }