Beispiel #1
0
 public bool Intersects(ref Terrain world)
 {
     int midX = (int) this.Position.X + (_width/2);
     if (world.terrainContour[midX] <= this.Position.Y +_height ) {
         return true;
     }
     else {
         return false;
     }
 }
Beispiel #2
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            this.graphics.PreferredBackBufferWidth = screenWidth;
            this.graphics.PreferredBackBufferHeight = screenHeight;
            this.graphics.IsFullScreen = false;
            this.IsMouseVisible = true;

            playground = new Terrain() { screenHeight = this.backgroundHeight, screenWidth = this.backgroundWidth };

            //Dodaje graczy tutaj tymczasowo:
            manager.AddPlayer(new Player() { Name = "Player 1", PlayerColor = Color.Aqua });
            manager.AddPlayer(new Player() { Name = "Player 2", PlayerColor = Color.Red });
            manager.AddPlayer(new Player() { Name = "Player 3", PlayerColor = Color.Yellow });
            manager.AddPlayer(new Player() { Name = "Player 4", PlayerColor = Color.Green });
            manager.screenWidth = backgroundWidth;
        }
Beispiel #3
0
 /// <summary>
 /// Used to move fighters all around the world ;)
 /// </summary>
 /// <param name="world">Terrain</param>
 public void MoveLeft(ref Terrain world)
 {
     if (this.Position.X - speed > 0) {
         this.Position.X -= speed;
     }
     this.MoveY(ref world);
 }
Beispiel #4
0
        public void MoveY(ref Terrain world)
        {
            int midX = (int)this.Position.X + (_width / 2);
            if (!this.Intersects(ref world)) {
                this.Position.Y = world.terrainContour[midX] - _height;
                //if (midX > 0 && midX < world.terrainContour.Count()) {
                //    int yBorder = world.terrainContour[midX];

                //    if (yBorder > this.FighterArea.Bottom) {
                //        Gravity.FreeFall(this.Position);
                //    }
                //}
            }
            else {
                this.Position.Y = world.terrainContour[midX] - _height;
            }
        }
Beispiel #5
0
 /// <summary>
 /// Used to move fighters all around the world ;)
 /// </summary>
 /// <param name="world">Terrain</param>
 public void MoveRight(ref Terrain world)
 {
     if (Position.X + speed + this.Width < world.terrainContour.Length) {
         this.Position.X += speed;
     }
     this.MoveY(ref world);
 }