Esempio n. 1
0
 public Block(Block block)
 {
     this.position = block.position;
     this.texture = block.texture;
     this.destroyable = block.destroyable;
     this.size = block.size;
     this.passeble = block.passeble;
 }
Esempio n. 2
0
        public Level(string name, List<Block> blocks, List<NPC> mobs, GameObj background)
        {
            this.Name = name;

            this.blocks = blocks;
            this.mobs = mobs;

            this.background = new Block(background, -1, 0.9f, destroyable:false, passeble:true);
        }
Esempio n. 3
0
        public bool IsCrossed(Block block)
        {
            float X1 = block.position.X;
            float Y1 = block.position.Y;

            float X2 = block.position.X + block.size.X;
            float Y2 = block.position.Y + block.size.Y;

            float X3 = this.position.X;
            float Y3 = this.position.Y;

            float X4 = this.position.X + this.size.X;
            float Y4 = this.position.Y + this.size.Y;

             if (
                 (X3 > Y1 && X3 < Y2) && (Y3 > X1 && Y3 < X2) ||
                 (X3 > Y1 && X3 < Y2) && (Y4 > X1 && Y4 < X2) ||
                 (X4 > Y1 && X4 < Y2) && (Y3 > X1 && Y3 < X2) ||
                 (X4 > Y1 && X4 < Y2) && (Y4 > X1 && Y4 < X2)
                )
                return true;
            else
                return false;
        }
Esempio n. 4
0
 public bool IsCrossed(Block block)
 {
     return (((this.position.X > block.position.X) && (this.position.Y > block.position.Y)) && ((this.position.X < block.position.X + block.size.X) && (this.position.Y < block.position.Y + block.size.Y)) ||
             ((this.position.X + this.size.X > block.position.X) && (this.position.Y + this.size.Y > block.position.Y)) && ((this.position.X + this.size.X < block.position.X + block.size.X) && (this.position.Y + this.size.Y < block.position.Y + block.size.Y)));
 }