public DynamicLevel(Sprint5 game) : base(game) { this.L1SoundHandler = new L1SoundHandler(this); this.Layers.Add(this.BackgroundLayer = new BackgroundLayer(this)); this.Layers.Add(this.CollisionLayer = new CollisionLayer(this)); this.Layers.Add(this.WelcomeLayer = new WelcomeLayer(this)); this.GameOverLayer = new GameOverLayer(this); this.Layers.Add(this.HuDLayer = new HuDLayer(this)); this.Mappy = new SpriteMappy(this.CollisionLayer); this.Mappy.Position = new Vector2((this.Game.Viewport.Width / 2) - (this.Mappy.Width / 2), this.Game.Viewport.Height / 2 - (this.Mappy.Height / 2)); KeyListener flap = new FlapListener(this.Mappy, this, this.WelcomeLayer); this.CollisionLayer.Keyboard.RegisterKeyListener(Keys.Space, flap); this.CollisionLayer.Keyboard.RegisterKeyListener(Keys.Up, flap); this.CollisionLayer.GamePad.RegisterKeyListener(Buttons.A, flap); (this.CollisionLayer.Mouse as InputControllerMouse).SetOnLeftClick(delegate() { flap.OnPress(0); }); this.CollisionLayer.AddSprite(this.Mappy); this.keyboard = new InputControllerKeyboard(); this.keyboard.RegisterKeyListener(Keys.R, new ResetListener(this)); this.keyboard.RegisterKeyListener(Keys.Q, new ExitListener(this)); this.Running = false; }
/// <summary> /// The main entry point for the application. /// </summary> static void Main() { using (Sprint5 game = new Sprint5()) { game.Run(); } }
public SpriteText(Sprint5 game, int x, int y, Color c) { this.game = game; this.Position = new Vector2(x, y); this.Color = c; Text = () => ""; }
public Level(Sprint5 game) { this.Game = game; this.Camera = new Point(0, 0); this.Score = 0; this.timeLeft = 10; this.currentTime = 0; this.Layers = new List <Layer>(); this.InputControllers = new List <InputController>(); }