Explorar el Código

Generate map node based on layout

Scale core down, fix offsets to be map-relative not <body>-relative
master
Chris Smith hace 12 años
padre
commit
a7d974578a
Se han modificado 2 ficheros con 10 adiciones y 4 borrados
  1. 9
    3
      index.html
  2. 1
    1
      res/data/levels.js

+ 9
- 3
index.html Ver fichero

54
      }
54
      }
55
     });
55
     });
56
 
56
 
57
+    $('<img/>').attr('id', 'map')
58
+               .attr('src', levels[layout.level - 1].minimap)
59
+               .attr('alt', levels[layout.level - 1].name + " map")
60
+               .appendTo($('#mapcontainer'));
61
+
57
     $.each(layout.towers, function() {
62
     $.each(layout.towers, function() {
58
      createElForTower(towers[this.type])
63
      createElForTower(towers[this.type])
59
        .draggable()
64
        .draggable()
60
        .css('position', 'absolute')
65
        .css('position', 'absolute')
61
        .offset(adjustMapOffset(this.position, levels[layout.level - 1]))
66
        .offset(adjustMapOffset(this.position, levels[layout.level - 1]))
62
        .rotate(this.rotation)
67
        .rotate(this.rotation)
63
-       .appendTo($('#palette'));
68
+       .appendTo($('#mapcontainer'));
64
     });
69
     });
65
    });
70
    });
66
   </script>
71
   </script>
67
   <style type="text/css">
72
   <style type="text/css">
68
-   .tower { width: 40px; height: 40px; }
73
+   #mapcontainer { position: relative; }
74
+   .tower, .core { width: 40px; height: 40px; }
69
   </style>
75
   </style>
70
  </head>
76
  </head>
71
  <body>
77
  <body>
72
-  <img src="res/images/minimaps/TheSpires.png" alt="Minimap" id="map">
78
+  <div id="mapcontainer"></div>
73
   <img src="res/images/coreIcon.png" alt="core" class="core">
79
   <img src="res/images/coreIcon.png" alt="core" class="core">
74
 
80
 
75
   <div id="palette">
81
   <div id="palette">

+ 1
- 1
res/data/levels.js Ver fichero

10
  {name: 'The Throne Room', minimap: 'res/images/minimaps/Level8.png', image: 'res/images/levels/Level8.jpg'},
10
  {name: 'The Throne Room', minimap: 'res/images/minimaps/Level8.png', image: 'res/images/levels/Level8.jpg'},
11
  {name: 'Royal Gardens', minimap: 'res/images/minimaps/RoyalGardens.png', image: 'res/images/levels/Level9.jpg'},
11
  {name: 'Royal Gardens', minimap: 'res/images/minimaps/RoyalGardens.png', image: 'res/images/levels/Level9.jpg'},
12
  {name: 'The Ramparts', minimap: 'res/images/minimaps/Level9.png', image: 'res/images/levels/Level10.jpg'},
12
  {name: 'The Ramparts', minimap: 'res/images/minimaps/Level9.png', image: 'res/images/levels/Level10.jpg'},
13
- {name: 'Endless Spires', minimap: 'res/images/minimaps/TheSpires.png', image: 'res/images/levels/Level11.jpg', offsets: {left: 150, top: 65}, scale: {left: 1.04, top: 1.04}},
13
+ {name: 'Endless Spires', minimap: 'res/images/minimaps/TheSpires.png', image: 'res/images/levels/Level11.jpg', offsets: {left: 142, top: 57}, scale: {left: 1.04, top: 1.04}},
14
  {name: 'The Summit', minimap: 'res/images/minimaps/TheSummit.png', image: 'res/images/levels/Level12.jpg'},
14
  {name: 'The Summit', minimap: 'res/images/minimaps/TheSummit.png', image: 'res/images/levels/Level12.jpg'},
15
 
15
 
16
 ];
16
 ];

Loading…
Cancelar
Guardar