33 lines
1015 B
Lua
33 lines
1015 B
Lua
|
local spritesheets = {}
|
||
|
local player = {}
|
||
|
local game = {}
|
||
|
|
||
|
function drawerinit(spritesheetst, playert, gamex)
|
||
|
spritesheets = spritesheetst
|
||
|
player = playert
|
||
|
game = gamex
|
||
|
end
|
||
|
|
||
|
local function draw()
|
||
|
--draw background
|
||
|
love.graphics.draw(backgrounds[game.level], 0, 0)
|
||
|
--draw player_animation
|
||
|
player.animation:draw(player.x, player.y)
|
||
|
if player.state == "idle" then
|
||
|
spritesheets["player_idle"]:draw(player.x, player.y)
|
||
|
elseif player.state == "walk_left" then
|
||
|
spritesheets["player_walk_left"]:draw(player.x, player.y)
|
||
|
elseif player.state == "walk_right" then
|
||
|
spritesheets["player_walk_right"]:draw(player.x, player.y)
|
||
|
elseif player.state == "jump" then
|
||
|
spritesheets["player_jump"]:draw(player.x, player.y)
|
||
|
elseif player.state == "die" then
|
||
|
spritesheets["player_die"]:draw(player.x, player.y)
|
||
|
else
|
||
|
spritesheets["player_default"]:draw(player.x, player.y)
|
||
|
end
|
||
|
end
|
||
|
return {
|
||
|
drawerinit = drawerinit,
|
||
|
draw = draw
|
||
|
}
|