示例#1
0
 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;
 }
示例#2
0
 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;
 }