public ScreenManager(GameType gametype, Game1 game) { menubase = new Menu_Base(Content_Manager.getInstance().Textures["menubase"]); menuoptions = new Menu_Options(Content_Manager.getInstance().Textures["menuoptions"]); menuplay = new Menu_Play(Content_Manager.getInstance().Textures["menuplay"]); menuSolo = new Menu_Play_Solo(Content_Manager.getInstance().Textures["menusolo"]); menusolo1 = new Menu_Play_Solo_World1(Content_Manager.getInstance().Textures["solo1"]); menusolo2 = new Menu_Play_Solo_World2(Content_Manager.getInstance().Textures["solo2"]); menuMulti = new Menu_Play_Multi(Content_Manager.getInstance().Textures["menumulti"]); menupauseoption = new Menu_Pause_Options(Content_Manager.getInstance().Textures["menupauseoption"]); casper = new Casper(Content_Manager.getInstance().Textures["Casper"], new Rectangle(0, 0, 16, 34)); player2 = new Casper(Content_Manager.getInstance().Textures["Casper"], new Rectangle(50, 50, 16, 34)); casper2 = new Casper(Content_Manager.getInstance().Textures["Player1"], new Rectangle(50, 50, 0, 0)); controls = new Controls(casper.Position, casper.Velocity, casper.Speed, Keys.W, Keys.A, Keys.D, Keys.S); controlsPlayer2 = new Controls(player2.Position, player2.Velocity, player2.Speed, Keys.Up, Keys.Left, Keys.Right, Keys.Down); controlsWorld2 = new Controls(casper2.Position, casper2.Velocity, casper2.Speed, Keys.Up, Keys.Left, Keys.Right, Keys.Down); world2vert1 = new Decors(Content_Manager.getInstance().Textures["vert"], new Rectangle(-1680, 0, 1680, 1050)); world2vert2 = new Decors(Content_Manager.getInstance().Textures["vert"], new Rectangle(1680, 0, 1680, 1050)); camera = new Camera(Game1.GetGame().GraphicsDevice.Viewport); game.casperr = casper; decors = new Decors(Content_Manager.getInstance().Textures["Level1"], new Rectangle(0, 0, 1680, 1050)); decors1 = new Decors(Content_Manager.getInstance().Textures["Level1"], new Rectangle(1680, 0, 1680, 1050)); decors2 = new Decors(Content_Manager.getInstance().Textures["Level1"], new Rectangle(-1680, 0, 1680, 1050)); world2 = new Decors(Content_Manager.getInstance().Textures["world2"], new Rectangle(0, 0, 1680, 1050)); menupause = new Menu_Pause(Content_Manager.getInstance().Textures["menupause"]); level1 = new Level1(new Vector2(0, 0)); obstacles = new Obstacles(level1.getList()); previousgametype = GameType.Exit; this.gametype = gametype; }
public void update(GameTime gametime, Controls controls, GameType gametype, Level1 level) { animation.update(gametime, gametype); previousPosition = Position; controls.update(gametime, gametype, this); Hitbox.X = (int)Position.X; Hitbox.Y = (int)Position.Y; previousPosition = Position; Position = controls.getPosition(); Velocity = controls.getVelocity(); casper = animation.getText(animation.getState(Position, previousPosition),gametype); camera.update(gametime, this.Position); }
public void update(GameTime gametime, Controls controls, GameType gametype, Level1 level) { animation.update(gametime, gametype); previousPosition = Position; controls.update(gametime, gametype, this); Hitbox.X = (int)Position.X; Hitbox.Y = (int)Position.Y; previousPosition = Position; Position = controls.getPosition(); Velocity = controls.getVelocity(); casper = animation.getText(animation.getState(Position, previousPosition), gametype); camera.update(gametime, this.Position); }
//Casper casper; public Controls(Vector2 Position, Vector2 Velocity, float speed, Keys Up, Keys Left, Keys Right,Keys Down) { this.Up = Up; this.Left = Left; this.Right = Right; this.Down = Down; this.Position = Position; this.Velocity = Velocity; Acceleration = new Vector2(10, 10); this.speed = speed; maxspeed = 500f; hasJumped = true; level1 = new Level1(new Vector2(0, 0)); previousPosition = Position; }
//Casper casper; public Controls(Vector2 Position, Vector2 Velocity, float speed, Keys Up, Keys Left, Keys Right, Keys Down) { this.Up = Up; this.Left = Left; this.Right = Right; this.Down = Down; this.Position = Position; this.Velocity = Velocity; Acceleration = new Vector2(10, 10); this.speed = speed; maxspeed = 500f; hasJumped = true; level1 = new Level1(new Vector2(0, 0)); previousPosition = Position; }