Exemple #1
0
        public static ObjectToDraw[] loadLevel(Texture2D wall)
        {
            ObjectToDraw[] newObjects = new ObjectToDraw[64];
            int i = 0;
            Tile.WallState[] tings = new Tile.WallState[64] 
            {
                Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,
                Tile.WallState.ALL,Tile.WallState.END,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,
                Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,
                Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,
                Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,
                Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,
                Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,
                Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,Tile.WallState.ALL,
            };
            int x = 64, y = 64;
            for (int k = 0; k < 8; k++)
            {
                for (int j = 0; j < 8; j++)
                {
                    newObjects[i] = new Tile(new Vector2(x , y) + new Vector2((int)tings[i] * 64,0), tings[i],0, wall);
                    i++;
                    x += 64;
                }
                x = 64;
                y += 64;
            }

            return newObjects;
        }
 public void CheckClick(List< ObjectToDraw> shapes)
 {
     foreach ( ObjectToDraw pair in shapes)
     {
         ObjectToDraw shape = pair;
         if (shape is TextShow)
         {
             if (shape.canBeDraged)
             {
                 if (Game.current.X > shape.location.X && Game.current.X < shape.location.X + shape.width && Game.current.Y > shape.location.Y && Game.current.Y < shape.location.Y + shape.height)
                 {
                     draggedObject = shape;
                     draggedObject.dock = null;
                     offset = new Vector2(Game.current.X - shape.location.X, Game.current.Y - shape.location.Y);
                     //shapes.Remove(pair.Key);
                     //s//hapes.Add(pair.Key, pair.Value);
                     return;
                 }
             }
             else if (((TextShow)shape).can_spawn)
             {
                 TextShow temp = new TextShow(new Vector2(shape.location.X,shape.location.Y), ((TextShow)shape).type, true,false);
                 temp.can_spawn = false;
                 temp.dock = null;
                 offset = new Vector2(temp.width/2,temp.height/2);
                 draggedObject = temp;
                 shapes.Add(temp);
                 return;
             }
         }
         
     }
 }