YAY
- Mask functionality - Rehandled Animations (now consistent)
This commit is contained in:
parent
189579d619
commit
8607399d16
|
@ -7,6 +7,7 @@ require "data/scripts/in_out"
|
||||||
json = require "data/scripts/json"
|
json = require "data/scripts/json"
|
||||||
-- classes
|
-- classes
|
||||||
require "data/scripts/entity"
|
require "data/scripts/entity"
|
||||||
|
require "data/scripts/animation"
|
||||||
require "data/scripts/collision"
|
require "data/scripts/collision"
|
||||||
require "data/scripts/level"
|
require "data/scripts/level"
|
||||||
-- data
|
-- data
|
||||||
|
|
|
@ -1,127 +1,75 @@
|
||||||
function Animation:Draw()
|
Animation = {}
|
||||||
if self.sprite ~= nil then
|
|
||||||
local relative_position_x = self.pos.x - Camera.pos.x
|
function Animation:New(anim_data)
|
||||||
local relative_position_y = self.pos.y - Camera.pos.y
|
local o = {}
|
||||||
local origin_compensation_x = - ( (self.sprite_offset.x) * math.cos(self.sprite_rotation) - (self.sprite_offset.y) * math.sin(self.sprite_rotation))
|
o.path = anim_data.path
|
||||||
local origin_compensation_y = - ( (self.sprite_offset.x) * math.sin(self.sprite_rotation) + (self.sprite_offset.y) * math.cos(self.sprite_rotation))
|
o.frames = anim_data.frames
|
||||||
local dimensions_x = self.sprite_scale.x * self.sprite_flip.x
|
o.speed = anim_data.speed
|
||||||
local dimensions_y = self.sprite_scale.y * self.sprite_flip.y
|
o.imgs = anim_data.imgs
|
||||||
love.graphics.draw(
|
o.subframe = 0
|
||||||
self.sprite,
|
o.frame = 1
|
||||||
relative_position_x + origin_compensation_x * dimensions_x,
|
|
||||||
relative_position_y + origin_compensation_y * dimensions_y,
|
setmetatable(o, self)
|
||||||
self.sprite_rotation,
|
self.__index = self
|
||||||
self.sprite_scale.x * self.sprite_flip.x,
|
return o
|
||||||
self.sprite_scale.y * self.sprite_flip.y
|
|
||||||
)
|
|
||||||
if debug_collision then
|
|
||||||
love.graphics.setColor(1, 0, 0)
|
|
||||||
love.graphics.circle( "line", relative_position_x, relative_position_y, 2 )
|
|
||||||
love.graphics.setColor(0, 1 ,0)
|
|
||||||
love.graphics.circle( "line",
|
|
||||||
relative_position_x + origin_compensation_x * dimensions_x,
|
|
||||||
relative_position_y + origin_compensation_y * dimensions_y,
|
|
||||||
2
|
|
||||||
)
|
|
||||||
end
|
|
||||||
love.graphics.setColor(1, 1 ,1)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Animation:New(anim,frames,speed)
|
function Animation:ChangeTo(anim_data)
|
||||||
local anim_data = {
|
if anim_data.path == self.path
|
||||||
frame = 1,
|
then
|
||||||
subframe = 1,
|
return self
|
||||||
path = anim.path,
|
|
||||||
frames = anim.frames,
|
|
||||||
speed = anim.speed,
|
|
||||||
imgs = anim.imgs
|
|
||||||
}
|
|
||||||
self.animations[#self.animations+1] = anim_data
|
|
||||||
|
|
||||||
return self.animations[#self.animations]
|
|
||||||
end
|
|
||||||
|
|
||||||
function DrawAnimationFrame(animation, frame, x, y, rotate, sx, sy)
|
|
||||||
local x = x or 0
|
|
||||||
local y = y or 0
|
|
||||||
local sx = sx or 1
|
|
||||||
local sy = sy or 1
|
|
||||||
love.graphics.draw(
|
|
||||||
animation.imgs[frame],
|
|
||||||
x - Camera.pos.x,
|
|
||||||
y - Camera.pos.y,
|
|
||||||
rotate,
|
|
||||||
sx,
|
|
||||||
sy
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
function DrawAnimation(animation, x, y, rotate, sx, sy)
|
|
||||||
local x = x or 0
|
|
||||||
local y = y or 0
|
|
||||||
local sx = sx or 1
|
|
||||||
local sy = sy or 1
|
|
||||||
if game_paused ~= true then
|
|
||||||
-- try to animate
|
|
||||||
animation.subframe = animation.subframe + current_dt
|
|
||||||
|
|
||||||
if animation.subframe >= animation.speed then
|
|
||||||
animation.frame = animation.frame + 1
|
|
||||||
animation.subframe = animation.subframe - animation.speed
|
|
||||||
end
|
|
||||||
|
|
||||||
-- cycle
|
|
||||||
if animation.frame >= animation.frames+1 then
|
|
||||||
animation.frame = animation.frame - animation.frames
|
|
||||||
end
|
|
||||||
end
|
|
||||||
love.graphics.draw(
|
|
||||||
animation.imgs[animation.frame],
|
|
||||||
x - Camera.pos.x,
|
|
||||||
y - Camera.pos.y,
|
|
||||||
rotate,
|
|
||||||
sx,
|
|
||||||
sy
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
function Entity:Animate()
|
|
||||||
if game_paused ~= true and self.anim.path ~= nil then
|
|
||||||
-- try to animate
|
|
||||||
self.anim.subframe = self.anim.subframe + current_dt
|
|
||||||
|
|
||||||
if self.anim.subframe >= self.anim.speed then
|
|
||||||
self.anim.frame = self.anim.frame + 1
|
|
||||||
self.anim.subframe = self.anim.subframe - self.anim.speed
|
|
||||||
end
|
|
||||||
|
|
||||||
-- cycle
|
|
||||||
if self.anim.frame >= self.anim.frames+1 then
|
|
||||||
self.anim.frame = self.anim.frame - self.anim.frames
|
|
||||||
end
|
|
||||||
|
|
||||||
-- change
|
|
||||||
self.sprite = self.anim.imgs[self.anim.frame]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function Entity:LoadAnimation(anim,frames,speed)
|
|
||||||
if self.anim.path ~= anim and self.anim.path ~= anim.path then
|
|
||||||
if frames ~= nil and speed ~= nil then
|
|
||||||
self.anim.path = anim or nil
|
|
||||||
self.anim.frames = frames or 4
|
|
||||||
self.anim.speed = speed or frames
|
|
||||||
else
|
else
|
||||||
self.anim.path = anim.path
|
return Animation:New(anim_data)
|
||||||
self.anim.frames = anim.frames
|
|
||||||
self.anim.speed = anim.speed
|
|
||||||
end
|
|
||||||
|
|
||||||
self.anim.imgs = anim.imgs
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
require "data/scripts/entities/kupo"
|
-- to manually handle what frame
|
||||||
require "data/scripts/entities/arrow"
|
function Animation:DrawFrame(frame, x, y, rotate, sx, sy)
|
||||||
require "data/scripts/entities/player"
|
if frame > self.frames then
|
||||||
|
frame = self.frames
|
||||||
|
end
|
||||||
|
local x = x or 0
|
||||||
|
local y = y or 0
|
||||||
|
local sx = sx or 1
|
||||||
|
local sy = sy or 1
|
||||||
|
love.graphics.draw(
|
||||||
|
self.imgs[frame],
|
||||||
|
x - Camera.pos.x,
|
||||||
|
y - Camera.pos.y,
|
||||||
|
rotate,
|
||||||
|
sx,
|
||||||
|
sy
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- to linearly animate
|
||||||
|
function Animation:Animate()
|
||||||
|
-- try to animate
|
||||||
|
self.subframe = self.subframe + current_dt
|
||||||
|
|
||||||
|
if self.subframe > self.speed then
|
||||||
|
self.frame = self.frame + 1
|
||||||
|
self.subframe = self.subframe - self.speed
|
||||||
|
end
|
||||||
|
|
||||||
|
-- cycle
|
||||||
|
if self.frame >= self.frames+1 then
|
||||||
|
self.frame = self.frame - self.frames
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- to draw the current frame
|
||||||
|
function Animation:Draw(x, y, rotate, sx, sy)
|
||||||
|
local x = x or 0
|
||||||
|
local y = y or 0
|
||||||
|
local sx = sx or 1
|
||||||
|
local sy = sy or 1
|
||||||
|
love.graphics.draw(
|
||||||
|
self.imgs[self.frame],
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
rotate,
|
||||||
|
sx,
|
||||||
|
sy
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
|
@ -14,8 +14,7 @@ love.graphics.print("time: "..fps_total..", fps: "..fps_draw..", frametime: "..m
|
||||||
love.graphics.print("position: {"..main_Player.pos.x..", "..main_Player.pos.y.."}",10*textScale,60*textScale, 0, textScale)
|
love.graphics.print("position: {"..main_Player.pos.x..", "..main_Player.pos.y.."}",10*textScale,60*textScale, 0, textScale)
|
||||||
love.graphics.print("velocity: {"..main_Player.vel.x..", "..main_Player.vel.y.."}",10*textScale,80*textScale, 0, textScale)
|
love.graphics.print("velocity: {"..main_Player.vel.x..", "..main_Player.vel.y.."}",10*textScale,80*textScale, 0, textScale)
|
||||||
love.graphics.print("scale: {"..main_Player.sprite_scale.x..", "..main_Player.sprite_scale.y.."}",10*textScale,100*textScale, 0, textScale)
|
love.graphics.print("scale: {"..main_Player.sprite_scale.x..", "..main_Player.sprite_scale.y.."}",10*textScale,100*textScale, 0, textScale)
|
||||||
love.graphics.print("anim: "..tostring(main_Player.anim.path)..", anim.speed: "..main_Player.anim.speed,10*textScale,120*textScale, 0, textScale)
|
love.graphics.print("states: \"isOnGround\": "..tostring(main_Player.isOnGround),10*textScale,120*textScale, 0, textScale)
|
||||||
love.graphics.print("states: \"isOnGround\": "..tostring(main_Player.isOnGround),10*textScale,140*textScale, 0, textScale)
|
|
||||||
|
|
||||||
love.graphics.print("[Camera]",10*textScale,160*textScale, 0, textScale)
|
love.graphics.print("[Camera]",10*textScale,160*textScale, 0, textScale)
|
||||||
love.graphics.print("position: {"..Camera.pos.x..", "..Camera.pos.y.."}",10*textScale,180*textScale, 0, textScale)
|
love.graphics.print("position: {"..Camera.pos.x..", "..Camera.pos.y.."}",10*textScale,180*textScale, 0, textScale)
|
||||||
|
|
|
@ -14,6 +14,9 @@ Arrow = Entity:New(x,y)
|
||||||
o.stuck = false
|
o.stuck = false
|
||||||
o.illuminated = true
|
o.illuminated = true
|
||||||
|
|
||||||
|
-- animations
|
||||||
|
o.body = Animation:New(animation.kupo.arrow)
|
||||||
|
|
||||||
setmetatable(o, self)
|
setmetatable(o, self)
|
||||||
self.__index = self
|
self.__index = self
|
||||||
table.insert(LoadedEntities,o)
|
table.insert(LoadedEntities,o)
|
||||||
|
@ -25,7 +28,13 @@ function Arrow:Smart()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Arrow:HandleAnimation()
|
function Arrow:HandleAnimation()
|
||||||
self:LoadAnimation(animation.kupo.arrow)
|
self.body:Draw(
|
||||||
|
self.pos.x - Camera.pos.x - ( (self.sprite_offset.x) * math.cos(self.sprite_rotation) - (self.sprite_offset.y) * math.sin(self.sprite_rotation)) * self.sprite_scale.x * self.sprite_flip.x,
|
||||||
|
self.pos.y - Camera.pos.y - ( (self.sprite_offset.x) * math.sin(self.sprite_rotation) + (self.sprite_offset.y) * math.cos(self.sprite_rotation)) * self.sprite_scale.y * self.sprite_flip.y,
|
||||||
|
self.sprite_rotation,
|
||||||
|
self.sprite_scale.x * self.sprite_flip.x,
|
||||||
|
self.sprite_scale.y * self.sprite_flip.y
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Arrow:DoPhysics()
|
function Arrow:DoPhysics()
|
||||||
|
|
|
@ -8,8 +8,12 @@ Kupo = Entity:New(x,y)
|
||||||
o.range = 200
|
o.range = 200
|
||||||
o.target = {x = x, y = y}
|
o.target = {x = x, y = y}
|
||||||
o.sprite_offset = {x = 8, y = 5}
|
o.sprite_offset = {x = 8, y = 5}
|
||||||
-- kupo bow
|
|
||||||
o.bow = self:NewAnimation(animation.kupo.bow)
|
-- animations
|
||||||
|
o.body = Animation:New(animation.kupo.body)
|
||||||
|
o.bow = Animation:New(animation.kupo.bow)
|
||||||
|
|
||||||
|
-- bow
|
||||||
o.bow_flip = 1
|
o.bow_flip = 1
|
||||||
o.bow_rotation = 0
|
o.bow_rotation = 0
|
||||||
o.bow_frame = 1
|
o.bow_frame = 1
|
||||||
|
@ -19,7 +23,7 @@ Kupo = Entity:New(x,y)
|
||||||
o.bow_frames = 6
|
o.bow_frames = 6
|
||||||
o.bow_extraframes = 18
|
o.bow_extraframes = 18
|
||||||
o.bow_aim_frames = 8
|
o.bow_aim_frames = 8
|
||||||
o.hostile = false
|
o.hostile = true
|
||||||
|
|
||||||
o.lightRange = o.range/10
|
o.lightRange = o.range/10
|
||||||
o.light = CreateLight(o.pos.x,o.pos.y,o.lightRange)
|
o.light = CreateLight(o.pos.x,o.pos.y,o.lightRange)
|
||||||
|
@ -131,29 +135,24 @@ end
|
||||||
function Kupo:HandleAnimation()
|
function Kupo:HandleAnimation()
|
||||||
-- flip sprite to look in the direction is moving
|
-- flip sprite to look in the direction is moving
|
||||||
if self.vel.x ~= 0 then self.sprite_flip.x = math.sign(self.vel.x) end
|
if self.vel.x ~= 0 then self.sprite_flip.x = math.sign(self.vel.x) end
|
||||||
self:LoadAnimation(animation.kupo.body)
|
|
||||||
|
self.body:Animate()
|
||||||
|
self.body:Draw(
|
||||||
|
self.pos.x - Camera.pos.x - ( (self.sprite_offset.x) * math.cos(self.sprite_rotation) - (self.sprite_offset.y) * math.sin(self.sprite_rotation)) * self.sprite_scale.x * self.sprite_flip.x,
|
||||||
|
self.pos.y - Camera.pos.y - ( (self.sprite_offset.x) * math.sin(self.sprite_rotation) + (self.sprite_offset.y) * math.cos(self.sprite_rotation)) * self.sprite_scale.y * self.sprite_flip.y,
|
||||||
|
self.sprite_rotation,
|
||||||
|
self.sprite_scale.x * self.sprite_flip.x,
|
||||||
|
self.sprite_scale.y * self.sprite_flip.y
|
||||||
|
)
|
||||||
|
|
||||||
if self.draw_bow == true then
|
if self.draw_bow == true then
|
||||||
DrawAnimationFrame(
|
self.bow:DrawFrame(
|
||||||
self.bow,
|
|
||||||
math.min(self.bow_frame,self.bow_frames),
|
math.min(self.bow_frame,self.bow_frames),
|
||||||
self.pos.x + ( 8 * math.sin(self.bow_rotation)),
|
self.pos.x + ( 8 * math.sin(self.bow_rotation)),
|
||||||
self.pos.y + (2 - 6 * math.cos(self.bow_rotation)),
|
self.pos.y + (2 - 6 * math.cos(self.bow_rotation)),
|
||||||
self.bow_rotation
|
self.bow_rotation
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
if debug_collision then
|
|
||||||
love.graphics.setColor(1,0,0)
|
|
||||||
love.graphics.line(
|
|
||||||
self.pos.x - Camera.pos.x,
|
|
||||||
self.pos.y - Camera.pos.y,
|
|
||||||
self.target.x - Camera.pos.x,
|
|
||||||
self.target.y - Camera.pos.y
|
|
||||||
)
|
|
||||||
love.graphics.circle( "line", self.pos.x - Camera.pos.x, self.pos.y - Camera.pos.y, self.range )
|
|
||||||
love.graphics.setColor(1,1,1)
|
|
||||||
love.graphics.print(self.bow_rotation, self.pos.x, self.pos.y+30)
|
|
||||||
love.graphics.print(self.angle, self.pos.x, self.pos.y+50)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Kupo:DoPhysics()
|
function Kupo:DoPhysics()
|
||||||
|
|
|
@ -31,11 +31,12 @@
|
||||||
o.canJump = true
|
o.canJump = true
|
||||||
o.canFall = true
|
o.canFall = true
|
||||||
o.canFriction = true
|
o.canFriction = true
|
||||||
|
o.mask_type = animation.moth_mask
|
||||||
-- sprite
|
-- sprite
|
||||||
o.sprite_offset = {x = 8, y = 16}
|
o.sprite_offset = {x = 8, y = 16}
|
||||||
o.target_offset = {x = 0, y = 12}
|
o.target_offset = {x = 0, y = 12}
|
||||||
|
o.body = Animation:New(animation.nancy.idle)
|
||||||
|
o.mask = Animation:New(animation.moth_mask.idle)
|
||||||
-- lights
|
-- lights
|
||||||
|
|
||||||
|
|
||||||
|
@ -85,27 +86,53 @@ function Player:Smart()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Player:HandleAnimation()
|
function Player:HandleAnimation()
|
||||||
|
|
||||||
-- flip sprite to look in the direction is moving
|
-- flip sprite to look in the direction is moving
|
||||||
if self.vel.x ~= 0 then self.sprite_flip.x = math.sign(self.vel.x) end
|
if self.vel.x ~= 0 then self.sprite_flip.x = math.sign(self.vel.x) end
|
||||||
|
|
||||||
-- animation manager
|
-- animation manager
|
||||||
if self.isOnLadder then
|
if self.isOnLadder then
|
||||||
self:LoadAnimation(animation.nancy.jump)
|
self.body = self.body:ChangeTo(animation.nancy.jump)
|
||||||
|
self.mask = self.mask:ChangeTo(self.mask_type.jump)
|
||||||
elseif self.isOnGround == 0 and self.isJumping and self.vel.y > 1.25 then
|
elseif self.isOnGround == 0 and self.isJumping and self.vel.y > 1.25 then
|
||||||
self:LoadAnimation(animation.nancy.fall)
|
self.body = self.body:ChangeTo(animation.nancy.fall)
|
||||||
|
self.mask = self.mask:ChangeTo(self.mask_type.fall)
|
||||||
elseif self.isOnGround == 0 and self.vel.y < 0 then
|
elseif self.isOnGround == 0 and self.vel.y < 0 then
|
||||||
self:LoadAnimation(animation.nancy.jump)
|
self.body = self.body:ChangeTo(animation.nancy.jump)
|
||||||
|
self.mask = self.mask:ChangeTo(self.mask_type.jump)
|
||||||
elseif self.vel.x ~= 0 then
|
elseif self.vel.x ~= 0 then
|
||||||
self:LoadAnimation(animation.nancy.run)
|
self.body = self.body:ChangeTo(animation.nancy.run)
|
||||||
|
self.mask = self.mask:ChangeTo(self.mask_type.run)
|
||||||
else
|
else
|
||||||
self:LoadAnimation(animation.nancy.idle)
|
self.body = self.body:ChangeTo(animation.nancy.idle)
|
||||||
|
self.mask = self.mask:ChangeTo(self.mask_type.idle)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- special case: idle animation gets slower by time
|
-- special case: idle animation gets slower by time
|
||||||
if self.anim_path == animation.nancy.idle.path then
|
if self.body.anim_path == animation.nancy.idle.path then
|
||||||
if self.anim_speed < 0.5 then self.anim_speed = self.anim_speed + 0.001 end
|
if self.body.anim_speed < 0.5 then self.body.anim_speed = self.body.anim_speed + 0.001 end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
self.body:Animate()
|
||||||
|
self.body:Draw(
|
||||||
|
self.pos.x - Camera.pos.x - ( (self.sprite_offset.x) * math.cos(self.sprite_rotation) - (self.sprite_offset.y) * math.sin(self.sprite_rotation)) * self.sprite_scale.x * self.sprite_flip.x,
|
||||||
|
self.pos.y - Camera.pos.y - ( (self.sprite_offset.x) * math.sin(self.sprite_rotation) + (self.sprite_offset.y) * math.cos(self.sprite_rotation)) * self.sprite_scale.y * self.sprite_flip.y,
|
||||||
|
self.sprite_rotation,
|
||||||
|
self.sprite_scale.x * self.sprite_flip.x,
|
||||||
|
self.sprite_scale.y * self.sprite_flip.y
|
||||||
|
)
|
||||||
|
self.mask:Draw(
|
||||||
|
self.pos.x - Camera.pos.x - ( (self.sprite_offset.x) * math.cos(self.sprite_rotation) - (self.sprite_offset.y) * math.sin(self.sprite_rotation)) * self.sprite_scale.x * self.sprite_flip.x,
|
||||||
|
self.pos.y - Camera.pos.y - ( (self.sprite_offset.x) * math.sin(self.sprite_rotation) + (self.sprite_offset.y) * math.cos(self.sprite_rotation)) * self.sprite_scale.y * self.sprite_flip.y,
|
||||||
|
self.sprite_rotation,
|
||||||
|
self.sprite_scale.x * self.sprite_flip.x,
|
||||||
|
self.sprite_scale.y * self.sprite_flip.y
|
||||||
|
)
|
||||||
|
|
||||||
|
--[[
|
||||||
|
love.graphics.print(self.body.frame .. "/".. self.body.frames.." - "..self.body.subframe.."/"..self.body.speed.." ("..current_dt..")")
|
||||||
|
love.graphics.print(animation.nancy.idle.path,0,20)
|
||||||
|
love.graphics.print(self.body.path,0,30)
|
||||||
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
function Player:DoPhysics()
|
function Player:DoPhysics()
|
||||||
|
|
|
@ -6,11 +6,7 @@ function Entity:New(x,y)
|
||||||
o.pos = {x = x, y = y}
|
o.pos = {x = x, y = y}
|
||||||
o.vel = {x = 0, y = 0}
|
o.vel = {x = 0, y = 0}
|
||||||
o.class = "Entity"
|
o.class = "Entity"
|
||||||
o.anim = {}
|
|
||||||
o.anim.subframe = 0
|
|
||||||
o.anim.frame = 1
|
|
||||||
o.anim.imgs = {}
|
|
||||||
o.animations = {}
|
|
||||||
o.sprite_offset = {x = 0, y = 0}
|
o.sprite_offset = {x = 0, y = 0}
|
||||||
o.sprite_scale = {x = 1, y = 1}
|
o.sprite_scale = {x = 1, y = 1}
|
||||||
o.sprite_rotation = math.rad(0)
|
o.sprite_rotation = math.rad(0)
|
||||||
|
@ -25,7 +21,7 @@ function Entity:Move(target, speed) -- target = {tx int, ty int} / speed = int
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Entity:Draw()
|
--[[function Entity:Draw()
|
||||||
if self.sprite ~= nil then
|
if self.sprite ~= nil then
|
||||||
local relative_position_x = self.pos.x - Camera.pos.x
|
local relative_position_x = self.pos.x - Camera.pos.x
|
||||||
local relative_position_y = self.pos.y - Camera.pos.y
|
local relative_position_y = self.pos.y - Camera.pos.y
|
||||||
|
@ -148,6 +144,7 @@ function Entity:LoadAnimation(anim,frames,speed)
|
||||||
self.anim.imgs = anim.imgs
|
self.anim.imgs = anim.imgs
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
]]--
|
||||||
|
|
||||||
require "data/scripts/entities/kupo"
|
require "data/scripts/entities/kupo"
|
||||||
require "data/scripts/entities/arrow"
|
require "data/scripts/entities/arrow"
|
||||||
|
|
|
@ -17,7 +17,7 @@ animation = {
|
||||||
speed = 1
|
speed = 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
nancy_moth_mask = {
|
moth_mask = {
|
||||||
idle = {
|
idle = {
|
||||||
path = "assets/characters/nancy/moth_mask/idle",
|
path = "assets/characters/nancy/moth_mask/idle",
|
||||||
frames = 4,
|
frames = 4,
|
||||||
|
|
|
@ -52,9 +52,6 @@ function DoLights()
|
||||||
)]]
|
)]]
|
||||||
end
|
end
|
||||||
for _, enty in pairs(LoadedEntities) do
|
for _, enty in pairs(LoadedEntities) do
|
||||||
if enty.illuminated == true then
|
|
||||||
enty:Draw()
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
love.graphics.setColor(0,0,0,0.5)
|
love.graphics.setColor(0,0,0,0.5)
|
||||||
for _, light in pairs(Lights) do
|
for _, light in pairs(Lights) do
|
||||||
|
|
5
main.lua
5
main.lua
|
@ -35,7 +35,6 @@ function love.load()
|
||||||
table.insert(LoadedEntities,Kupo:New(700,150))
|
table.insert(LoadedEntities,Kupo:New(700,150))
|
||||||
table.insert(LoadedEntities,Kupo:New(800,150))
|
table.insert(LoadedEntities,Kupo:New(800,150))
|
||||||
main_Player.sprite = love.graphics.newImage("assets/characters/nancy/idle1.png")
|
main_Player.sprite = love.graphics.newImage("assets/characters/nancy/idle1.png")
|
||||||
main_Player:LoadAnimation(animation.nancy.idle)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function love.update(dt)
|
function love.update(dt)
|
||||||
|
@ -123,8 +122,6 @@ function love.draw()
|
||||||
LevelDisplayBackground()
|
LevelDisplayBackground()
|
||||||
for _, enty in pairs(LoadedEntities) do
|
for _, enty in pairs(LoadedEntities) do
|
||||||
enty:HandleAnimation()
|
enty:HandleAnimation()
|
||||||
enty:Animate()
|
|
||||||
enty:Draw()
|
|
||||||
end
|
end
|
||||||
LevelDisplayForeground()
|
LevelDisplayForeground()
|
||||||
|
|
||||||
|
@ -140,7 +137,7 @@ function love.draw()
|
||||||
love.graphics.setColor(1,1,1,1)
|
love.graphics.setColor(1,1,1,1)
|
||||||
love.graphics.setCanvas()
|
love.graphics.setCanvas()
|
||||||
love.graphics.scale(1,1)
|
love.graphics.scale(1,1)
|
||||||
DrawDarkness()
|
--DrawDarkness()
|
||||||
-- HUD
|
-- HUD
|
||||||
-- Scale control
|
-- Scale control
|
||||||
textScale = 0.5
|
textScale = 0.5
|
||||||
|
|
26
to_do.txt
26
to_do.txt
|
@ -1,15 +1,11 @@
|
||||||
MAKE LIGHTING SYSTEM
|
(x) MAKE LIGHTING SYSTEM
|
||||||
Updates:
|
(X) REHANDLE ANIMATIONS
|
||||||
LOVE HAS CANVASES!!!
|
(X) 3 COLOR PALETTE (GOLD)
|
||||||
|
(X) MASKS FUNCTIONALITY
|
||||||
MAKE ARROW CANVAS SO THAT ARROWS WHEN STUCK CAN BE STORED AS IMAGE AND ARE NOT LAGGY!!!
|
( ) MAKE ARROW CANVAS SO THAT ARROWS WHEN STUCK CAN BE STORED AS IMAGE AND ARE NOT LAGGY!!!
|
||||||
|
( ) DO GODS
|
||||||
DRAW GIANT ANIMALS AS POWER SOURCE
|
( ) DO DAMAGE TO PLAYER
|
||||||
|
( ) DO FAIRY
|
||||||
DO FAIRY
|
( ) DO FLIES
|
||||||
|
( ) DO UI
|
||||||
DO FLIES
|
( ) MAKE PHYSICS CONSISTENT
|
||||||
|
|
||||||
DO DAMAGE TO PLAYER
|
|
||||||
|
|
||||||
DO UI
|
|
||||||
|
|
Loading…
Reference in New Issue