-
Notifications
You must be signed in to change notification settings - Fork 454
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
You can now choose between Annie and Abed when playing the game. I'll be adding more characters soon, probably starting with Troy
- Loading branch information
1 parent
8a822c6
commit 337e783
Showing
8 changed files
with
103 additions
and
26 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
local anim8 = require 'vendor/anim8' | ||
|
||
local plyr = {} | ||
plyr.name = 'ABED NADIR' | ||
plyr.sheet = love.graphics.newImage('images/abed.png') | ||
local g = anim8.newGrid(46, 46, plyr.sheet:getWidth(), plyr.sheet:getHeight()) | ||
|
||
plyr.animations = { | ||
jump = { | ||
right = anim8.newAnimation('once', g('7,2'), 1), | ||
left = anim8.newAnimation('once', g('7,1'), 1) | ||
}, | ||
walk = { | ||
right = anim8.newAnimation('loop', g('2-4,2', '3,2'), 0.16), | ||
left = anim8.newAnimation('loop', g('2-4,1', '3,1'), 0.16) | ||
}, | ||
idle = { | ||
right = anim8.newAnimation('once', g(1,2), 1), | ||
left = anim8.newAnimation('once', g(1,1), 1) | ||
} | ||
} | ||
return plyr | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
local anim8 = require 'vendor/anim8' | ||
|
||
local plyr = {} | ||
plyr.name = 'ANNIE EDISON' | ||
plyr.sheet = love.graphics.newImage('images/annie.png') | ||
local g = anim8.newGrid(46, 46, plyr.sheet:getWidth(), plyr.sheet:getHeight()) | ||
|
||
plyr.animations = { | ||
jump = { | ||
right = anim8.newAnimation('once', g('7,2'), 1), | ||
left = anim8.newAnimation('once', g('7,1'), 1) | ||
}, | ||
walk = { | ||
right = anim8.newAnimation('loop', g('2-4,2', '3,2'), 0.16), | ||
left = anim8.newAnimation('loop', g('2-4,1', '3,1'), 0.16) | ||
}, | ||
idle = { | ||
right = anim8.newAnimation('once', g(1,2), 1), | ||
left = anim8.newAnimation('once', g(1,1), 1) | ||
} | ||
} | ||
return plyr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
local Gamestate = require 'vendor/gamestate' | ||
local game = require 'game' | ||
local state = Gamestate.new() | ||
|
||
local selections = {} | ||
selections[0] = {} | ||
selections[0][0] = require 'characters/abed' | ||
selections[0][1] = require 'characters/annie' | ||
|
||
function state:init() | ||
self.side = 0 -- 0 for left, 1 for right | ||
self.level = 0 -- 0 through 3 for characters | ||
self.screen = love.graphics.newImage("images/selectscreen.png") | ||
self.arrow = love.graphics.newImage("images/arrow.png") | ||
love.graphics.setFont(love.graphics.newFont("fonts/xen3.ttf", 32)) | ||
end | ||
|
||
function state:character() | ||
return selections[0][self.level] | ||
end | ||
|
||
function state:update(dt) | ||
end | ||
|
||
function state:keypressed(key) | ||
if key == "up" then | ||
self.level = (self.level + 1) % 2 | ||
elseif key == "down" then | ||
self.level = (self.level - 1) % 2 | ||
elseif key == "return" then | ||
Gamestate.switch(game, self:character()) | ||
end | ||
end | ||
|
||
function state:draw() | ||
love.graphics.draw(self.screen) | ||
|
||
love.graphics.draw(self.arrow, 224 - 72 * self.level, 270 + 72 * self.level) | ||
love.graphics.printf(self:character().name, 0, 425, | ||
love.graphics:getWidth(), 'center') | ||
love.graphics.printf('PRESS ENTER', 0, 460, | ||
love.graphics:getWidth(), 'center') | ||
end | ||
|
||
|
||
return state | ||
|