public Game() { win = new Window("galaga", 500, 500); gameTimer = new DIKUArcade.Timers.GameTimer(60, 60); player = new Player( new DynamicShape(new Vec2F(0.45f, 0.1f), new Vec2F(0.1f, 0.1f)), new Image(Path.Combine("Assets", "Images", "Player.png"))); eventBus = new GameEventBus <object>(); eventBus.InitializeEventBus(new List <GameEventType>() { GameEventType.InputEvent, // key press / key release GameEventType.WindowEvent, // messages to the window }); win.RegisterEventBus(eventBus); eventBus.Subscribe(GameEventType.InputEvent, this); eventBus.Subscribe(GameEventType.WindowEvent, this); enemyStrides = ImageStride.CreateStrides(4, Path.Combine("Assets", "Images", "BlueMonster.png")); enemies = new List <Enemy>(); Enemy.addEnemies(new ImageStride(80, enemyStrides)); PlayerShots = new List <PlayerShot>(); score = new Score(new Vec2F(0.9f, 0.9f), new Vec2F(0.1f, 0.1f)); }
public Game() { //Window and timer win = new Window("Arcade Game", 500, 500); gameTimer = new GameTimer(60, 60); //Player player = new Player(this, new DynamicShape(new Vec2F(0.45f, 0.1f), new Vec2F(0.1f, 0.1f)), new Image(Path.Combine("Assets", "Images", "Player.png"))); player.Move(); //Eventbus eventBus = new GameEventBus <object>(); eventBus.InitializeEventBus(new List <GameEventType>() { GameEventType.InputEvent, // key press / key release GameEventType.WindowEvent, // messages to the window }); win.RegisterEventBus(eventBus); eventBus.Subscribe(GameEventType.InputEvent, this); eventBus.Subscribe(GameEventType.WindowEvent, this); //Enemies enemyStrides = ImageStride.CreateStrides(4, Path.Combine("Assets", "Images", "BlueMonster.png")); enemies = new List <Enemy>(); AddEnemies(); //Shots playerShots = new List <PlayerShot>(); //Explosions explosionStrides = ImageStride.CreateStrides(8, Path.Combine("Assets", "Images", "Explosion.png")); explosions = new AnimationContainer(10); //Max element of monsters //Score score = new Score(new Vec2F(0.5f, 0.7f), new Vec2F(0.5f, 0.3f)); }
public Game() { win = new Window("WindowName", 500, 500); gameTimer = new GameTimer(50, 50); //eventBus = new GameEventBus<object>(); GalagaBus.GetBus().InitializeEventBus(new List <GameEventType>() { GameEventType.InputEvent, // key press / key release GameEventType.WindowEvent, // messages to the window //GameEventType.PlayerEvent GameEventType.GameStateEvent }); win.RegisterEventBus(GalagaBus.GetBus()); //GalagaBus.GetBus().Subscribe(GameEventType.PlayerEvent, player); GalagaBus.GetBus().Subscribe(GameEventType.InputEvent, this); GalagaBus.GetBus().Subscribe(GameEventType.WindowEvent, this); GalagaBus.GetBus().Subscribe(GameEventType.GameStateEvent, this); stateMachine = new StateMachine(); }
public void InitializeGameState() { game = new Game(); win = new Window("Galaga", 500, 500); gameTimer = new GameTimer(60, 60); // Creating enemies enemyStrides = ImageStride.CreateStrides(4, Path.Combine("Assets", "Images", "BlueMonster.png")); enemies = game.AddEnemies(); // Shots playerShots = new List <PlayerShot>(); // Explosion explosionStrides = ImageStride.CreateStrides(8, Path.Combine("Assets", "Images", "Explosion.png")); explosions = new AnimationContainer(300); // Scoreboard score = new Score(new Vec2F(0.05F, -0.25F), new Vec2F(0.3F, 0.3F)); }
//CLASS CONSTRUCTOR public Game() { win = new Window("Galaga", 500, 500); gameTimer = new GameTimer(60, 60); player = new Player( new DynamicShape(new Vec2F(0.45f, 0.1f), new Vec2F(0.1f, 0.1f)), new Image(Path.Combine("Assets", "Images", "Player.png")), this); eventBus = new GameEventBus <object>(); //3.3 eventBus.InitializeEventBus(new List <GameEventType>() { GameEventType.InputEvent, // key press / key release GameEventType.WindowEvent, // messages to the window GameEventType.PlayerEvent, }); win.RegisterEventBus(eventBus); eventBus.Subscribe(GameEventType.InputEvent, this); eventBus.Subscribe(GameEventType.WindowEvent, this); eventBus.Subscribe(GameEventType.PlayerEvent, this.player); // Creating enemies enemyStrides = ImageStride.CreateStrides(4, Path.Combine("Assets", "Images", "BlueMonster.png")); enemies = AddEnemies(); // Shots playerShots = new List <PlayerShot>(); // Explosion explosionStrides = ImageStride.CreateStrides(8, Path.Combine("Assets", "Images", "Explosion.png")); explosions = new AnimationContainer(300); // Scoreboard score = new Score(new Vec2F(0.05F, -0.25F), new Vec2F(0.3F, 0.3F)); }
public Game() { win = new Window("Mad man", 500, 500); gameTimer = new GameTimer(60, 60); score = new Score(new Vec2F(0.05f, 0.8f), new Vec2F(0.2f, 0.2f)); gameState = GameState.GamePlaying; GameOverDisPlay = new GameOverDisPlay(); player = new Player( new DynamicShape(new Vec2F(0.45f, 0.1f), new Vec2F(0.1f, 0.1f)), new Image(System.IO.Path.Combine("Assets", "Images", "Player.png")), this); enemyStrides = ImageStride.CreateStrides(4, System.IO.Path.Combine("Assets", "Images", "BlueMonster.png")); enemies = new EntityContainer <Enemy>(); AddEnemies(new Squadron.Formation(6)); currentMoveStrategy = new MovementStrategies.NoMove(); playerShots = new EntityContainer <PlayerShot>(); explosionStrides = ImageStride.CreateStrides(8, System.IO.Path.Combine("Assets", "Images", "Explosion.png")); explosions = new AnimationContainer(8); eventBus = new GameEventBus <object>(); eventBus.InitializeEventBus(new List <GameEventType>() { GameEventType.InputEvent, GameEventType.WindowEvent, GameEventType.PlayerEvent, }); win.RegisterEventBus(eventBus); eventBus.Subscribe(GameEventType.InputEvent, this); eventBus.Subscribe(GameEventType.WindowEvent, this); eventBus.Subscribe(GameEventType.PlayerEvent, player); }
public Game() { // TODO: Choose some reasonable values for the window and timer constructor. // For the window, we recommend a 500x500 resolution (a 1:1 aspect ratio). win = new Window("Window 1", 500, 500); gameTimer = new GameTimer(60, 60);