public Player(Game game, Vector2 pos, Level level) { texture = game.Content.Load<Texture2D>("Player/player"); BoundingRectangle = new BoundingBox(new Vector3(pos.X, pos.Y, 0.0f), new Vector3(pos.X + texture.Width, pos.Y + texture.Height, 0.0f)); texRect = new Rectangle((int)pos.X, (int)pos.Y, texture.Width, texture.Height); Physics = new Physics(); Physics.Velocity = jumpSpeed; currentLevel = level; }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here currentLevel = new Level(this, spriteBatch); Components.Add(currentLevel); graphics.SynchronizeWithVerticalRetrace = true; base.Initialize(); }
public Boss(Game game, int x, int y, Level currentLevel) { health = 100; this.game = game; texture = game.Content.Load<Texture2D>("Bosses/1"); BoundingRectangle = new BoundingBox(new Vector3(x, y, 0.0f), new Vector3(x + texture.Width, y + texture.Height, 0.0f)); texRect = new Rectangle(x, y, texture.Width, texture.Height); owner = currentLevel; }
public Vehicle(Game game, Player p, VehicleType type, Vector2 pos, Level curr) { g = game; player = p; Type = type; switch (Type) { case VehicleType.Spinner: texture = g.Content.Load<Texture2D>("Vehicles/spinner"); break; case VehicleType.Jeep: texture = g.Content.Load<Texture2D>("Vehicles/jeep"); break; case VehicleType.Minecart: texture = g.Content.Load<Texture2D>("Vehicles/minecart"); break; case VehicleType.Rocket: texture = g.Content.Load<Texture2D>("Vehicles/rocket"); break; case VehicleType.Lift: texture = g.Content.Load<Texture2D>("Vehicles/lift"); break; } physics = new Physics(); physics.Velocity = 200.0f; // create the bounding rectangle in world space if (Type != VehicleType.Lift) { BoundingRectangle = new BoundingBox(new Vector3(pos.X, pos.Y, 0.0f), new Vector3(pos.X + 60, pos.Y + 40, 0.0f)); texRect = new Rectangle((int)pos.X, (int)pos.Y, 60, 40); } else { BoundingRectangle = new BoundingBox(new Vector3(pos.X, pos.Y - 40, 0.0f), new Vector3(pos.X + 300, pos.Y, 0.0f)); texRect = new Rectangle((int)pos.X, (int)pos.Y - 40, 300, 40); } level = curr; }