=== modified file 'data/shore.svg'
--- data/shore.svg 2013-04-27 17:56:22 +0000
+++ data/shore.svg 2013-04-27 22:53:39 +0000
@@ -31,7 +31,7 @@
inkscape:cx="361.85984"
inkscape:cy="283.11626"
inkscape:document-units="px"
- inkscape:current-layer="layer5"
+ inkscape:current-layer="layer6"
showgrid="false"
inkscape:window-width="1106"
inkscape:window-height="832"
@@ -163,7 +163,10 @@
d="m 145.99325,585.05754 9.20946,0 1.87599,15.57515 -13.13199,0 z"
id="rect3771"
inkscape:connector-curvature="0"
- sodipodi:nodetypes="ccccc" />
+ sodipodi:nodetypes="ccccc"
+ inkscape:export-filename="/home/josh/code/game/ld26/data/shore-player.png"
+ inkscape:export-xdpi="88.503571"
+ inkscape:export-ydpi="88.503571" />
+
+
+
=== added file 'displacer.lua'
--- displacer.lua 1970-01-01 00:00:00 +0000
+++ displacer.lua 2013-04-27 22:53:39 +0000
@@ -0,0 +1,12 @@
+Displacer = Fill:extend{
+ fill = {0, 255, 255},
+ visible = false,
+ onUpdate = function(self, dt)
+ self.visible = DEBUG and the.console.visible
+ end,
+ onCollide = function(self, other, xOl, yOl)
+ if other == the.player then --sanity check
+ self:displace(other)
+ end
+ end
+}
\ No newline at end of file
=== modified file 'main.lua'
--- main.lua 2013-04-27 19:55:06 +0000
+++ main.lua 2013-04-27 22:53:39 +0000
@@ -8,6 +8,8 @@
require 'player'
require 'transition'
+require 'displacer'
+require 'svg_levels'
levels = {
forest1 = {
@@ -53,6 +55,9 @@
end,
newLevel = function (self, level)
self.sprites = levels[level].objects()
+ for _, obj in ipairs(svg_objects[level]) do
+ self:add(obj)
+ end
end
}
=== added file 'svg_levels.lua'
--- svg_levels.lua 1970-01-01 00:00:00 +0000
+++ svg_levels.lua 2013-04-27 22:53:39 +0000
@@ -0,0 +1,20 @@
+-- autogenerated by svg_levels.py
+
+svg_objects = {
+village = {
+},
+forest2 = {
+},
+shore = {
+
+Displacer:new{
+ x = 171.725940, y = 132.299380,
+ width = 19.192898, height = 16.162441
+}
+
+},
+forest1 = {
+},
+lake = {
+},
+}
=== added file 'svg_levels.py'
--- svg_levels.py 1970-01-01 00:00:00 +0000
+++ svg_levels.py 2013-04-27 22:53:39 +0000
@@ -0,0 +1,33 @@
+#!/usr/bin/python
+
+# ./svg_levels.py >svg_levels.lua
+
+import os, glob
+from lxml import etree
+from lxml.cssselect import CSSSelector
+
+print '-- autogenerated by svg_levels.py\n\nsvg_objects = {'
+
+ns = {'svg': 'http://www.w3.org/2000/svg',
+ 'ink': 'http://www.inkscape.org/namespaces/inkscape'}
+
+for svg in glob.glob('data/*.svg'):
+ t = etree.parse(svg)
+ basefile = os.path.basename(svg).split('.')[0]
+ print '%s = {' % basefile
+
+ sel = CSSSelector('svg|rect[ink|label="displace"]', ns)
+ for e in sel(t):
+ x, y = float(e.get('x')), float(e.get('y'))
+ w, h = float(e.get('width')), float(e.get('height'))
+
+ print """
+Displacer:new{
+ x = %f, y = %f,
+ width = %f, height = %f
+}
+""" % (x,y,w,h)
+
+ print '},'
+
+print '}'