Skip to content

Commit

Permalink
hawkthorne#166 Automated approach. Abed done.
Browse files Browse the repository at this point in the history
  • Loading branch information
MaddieM4 committed Sep 19, 2012
1 parent 919b7c2 commit 79493e6
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 30 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@ current_version = $(shell python scripts/version.py current)
next_version = $(shell python scripts/version.py next)
previous_version = $(shell python scripts/version.py previous)

love: maps
love: maps positions
mkdir -p build
cd src && zip -r ../build/hawkthorne.love . -x ".*" \
-x ".DS_Store" -x "*/full_soundtrack.ogg"

maps: $(patsubst %.tmx,%.lua,$(wildcard src/maps/*.tmx))
positions: $(patsubst %.png,%.lua,$(wildcard src/positions/*.png))

src/maps/%.lua: src/maps/%.tmx
tmx2lua $<

src/positions/%.lua: src/positions/%.png
overlay2lua src/positions/config.json $<

osx: love osx/love.app
cp -r osx/love.app Journey\ to\ the\ Center\ of\ Hawkthorne.app
cp build/hawkthorne.love Journey\ to\ the\ Center\ of\ Hawkthorne.app/Contents/Resources
Expand Down
18 changes: 1 addition & 17 deletions src/characters/abed.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,30 +36,14 @@ function plyr.new(sheet)
local new_plyr = {}
new_plyr.sheet = sheet
new_plyr.sheet:setFilter('nearest', 'nearest')
new_plyr.positions = require('positions/abed')

local g = anim8.newGrid(48, 48, new_plyr.sheet:getWidth(),
new_plyr.sheet:getHeight())

local warp = anim8.newGrid(36, 223, beam:getWidth(),
beam:getHeight())

new_plyr.hand_offsets = {
{ { 6,38},{ -8,34},{1,38},{13,36},{ 6,38},{ 6,38},{12,30},{ 6,38},{ 0, 0} },
{ { 8,38},{-14,34},{4,38},{ 9,34},{ 8,38},{ 8,38},{13,28},{ 8,38},{ 0, 0} },
{ { 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0} },
{ { 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0} },
{ { 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 8,24},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0} },
{ { 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 6,24},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0} },
{ { 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0} },
{ { 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0} },
{ { 8,24},{ 8,23},{ 8,24},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0} },
{ { 6,24},{ 6,23},{ 6,24},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0} },
{ { 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0} },
{ { 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0} },
{ { 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0} },
{ { 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0} },
{ { 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0} }
}
new_plyr.beam = beam
new_plyr.animations = {
dead = {
Expand Down
6 changes: 3 additions & 3 deletions src/nodes/baseball.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ end

function Baseball:update(dt, player)
if self.held and player.currently_held == self then
self.position.x = math.floor(player.position.x) + player.hand_offset_x + (self.width / 2) + 15
self.position.y = math.floor(player.position.y) + player.hand_offset_y - self.height + 2
if player.hand_offset_x == 0 then
self.position.x = math.floor(player.position.x) + player.offset_hand_right[1] + (self.width / 2) + 15
self.position.y = math.floor(player.position.y) + player.offset_hand_right[2] - self.height + 2
if player.offset_hand_right[1] == 0 then
print(string.format("Need hand offset for %dx%d", player.frame[1], player.frame[2]))
end
self:moveBoundingBox()
Expand Down
2 changes: 1 addition & 1 deletion src/nodes/pot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ end
function Pot:update(dt, player)
if self.held then
self.position.x = math.floor(player.position.x + (self.width / 2)) + 2
self.position.y = math.floor(player.position.y + player.hand_offset_y - self.height) - 5
self.position.y = math.floor(player.position.y + player.offset_hand_right[2] - self.height) - 5
self:moveBoundingBox()
return
end
Expand Down
14 changes: 6 additions & 8 deletions src/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ end
-- @return nil
function Player:loadCharacter(character)
self.animations = character.animations
self.sheet = character.sheet
self.hand_offsets = character.hand_offsets
self.character = character
self.sheet = character.sheet
self.positions = character.positions
self.character = character
end

---
Expand Down Expand Up @@ -415,13 +415,11 @@ function Player:draw()
self.frame = animation.frames[animation.position]
local x,y,w,h = self.frame:getViewport()
self.frame = {x/w+1, y/w+1}
if self.hand_offsets then
self.hand_offset_x, self.hand_offset_y = unpack(self.hand_offsets[self.frame[2]][self.frame[1]])
if self.positions then
self.offset_hand_right = self.positions.hand_right[self.frame[2]][self.frame[1]]
else
self.hand_offset_x, self.hand_offset_y = unpack({0,0})
self.offset_hand_right = {0,0}
end
self.hand_offset_x = self.hand_offset_x or 0
self.hand_offset_y = self.hand_offset_y or 0

if self.currently_held then
self.currently_held:draw()
Expand Down
38 changes: 38 additions & 0 deletions src/positions/abed.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
return {
hand_left = {
{ {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, },
{ {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, },
{ {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, },
{ {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, },
{ {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, },
{ {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, },
{ {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, },
{ {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, },
{ {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, },
{ {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, },
{ {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, },
{ {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, },
{ {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, },
{ {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, },
{ {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, },
},

hand_right = {
{ {6, 38}, {13, 34}, {1, 38}, {12, 35}, {6, 38}, {6, 38}, {14, 29}, {6, 38}, {-5, 29}, },
{ {6, 38}, {-14, 34}, {4, 37}, {8, 34}, {6, 38}, {6, 38}, {13, 26}, {6, 38}, {10, 33}, },
{ {7, 38}, {8, 34}, {7, 36}, {12, 31}, {-8, 38}, {-1, 38}, {14, 29}, {14, 29}, {6, 31}, },
{ {9, 38}, {9, 36}, {8, 30}, {0, 0}, {-8, 38}, {0, 0}, {11, 20}, {9, 32}, {10, 29}, },
{ {11, 32}, {14, 31}, {11, 24}, {9, 37}, {8, 20}, {11, 24}, {9, 37}, {8, 41}, {11, 24}, },
{ {6, 38}, {6, 38}, {6, 38}, {6, 38}, {7, 20}, {-2, 24}, {0, 37}, {2, 40}, {11, 25}, },
{ {9, 37}, {9, 36}, {9, 37}, {11, 24}, {11, 23}, {11, 24}, {15, 31}, {15, 30}, {15, 31}, },
{ {-8, 33}, {1, 38}, {12, 35}, {-8, 34}, {1, 38}, {12, 35}, {-9, 33}, {0, 38}, {11, 35}, },
{ {7, 20}, {7, 19}, {7, 20}, {11, 24}, {11, 23}, {11, 24}, {10, 37}, {10, 36}, {10, 37}, },
{ {8, 20}, {8, 19}, {8, 20}, {-1, 24}, {-1, 23}, {-2, 24}, {0, 37}, {0, 38}, {-1, 37}, },
{ {8, 15}, {11, 19}, {9, 32}, {8, 24}, {8, 24}, {8, 24}, {11, 33}, {10, 33}, {10, 33}, },
{ {7, 15}, {-2, 19}, {0, 32}, {-8, 33}, {-8, 33}, {-8, 33}, {-8, 34}, {-7, 34}, {-7, 34}, },
{ {14, 31}, {14, 31}, {14, 31}, {14, 31}, {14, 26}, {14, 26}, {14, 26}, {14, 26}, {9, 33}, },
{ {0, 0}, {-9, 29}, {4, 29}, {13, 24}, {0, 0}, {-9, 23}, {4, 24}, {13, 19}, {-12, 45}, },
{ {0, 0}, {-9, 28}, {4, 29}, {13, 23}, {14, 31}, {14, 30}, {14, 31}, {14, 30}, {0, 0}, },
},

}
Binary file added src/positions/abed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/positions/abed.xcf
Binary file not shown.
12 changes: 12 additions & 0 deletions src/positions/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"tile_geometry": {
"size": [48, 48],
"origin": [24, 0]
},
"tile_x": 24,
"tile_y": 24,
"colors": {
"3493E0": "hand_right",
"E09034": "hand_left"
}
}

0 comments on commit 79493e6

Please sign in to comment.