consistent indentation
This commit is contained in:
@@ -1,56 +1,56 @@
|
||||
Arrow = Entity:New(x,y)
|
||||
|
||||
function Arrow:New(x,y,rotation,speed)
|
||||
local o = Entity:New(x,y)
|
||||
function Arrow:New(x,y,rotation,speed)
|
||||
local o = Entity:New(x,y)
|
||||
|
||||
o.type = "arrow"
|
||||
o.type = "arrow"
|
||||
|
||||
o.pos = {x = x, y = y}
|
||||
o.speed = speed or 10
|
||||
o.sprite_rotation = rotation or 0
|
||||
o.vel = {
|
||||
x = o.speed * math.cos(o.sprite_rotation),
|
||||
y = o.speed * math.sin(o.sprite_rotation)
|
||||
}
|
||||
o.pos = {x = x, y = y}
|
||||
o.speed = speed or 10
|
||||
o.sprite_rotation = rotation or 0
|
||||
o.vel = {
|
||||
x = o.speed * math.cos(o.sprite_rotation),
|
||||
y = o.speed * math.sin(o.sprite_rotation)
|
||||
}
|
||||
o.sprite_offset = {x = 13, y = 1}
|
||||
o.stuck = false
|
||||
o.illuminated = true
|
||||
o.stuck = false
|
||||
o.illuminated = true
|
||||
|
||||
-- animations
|
||||
o.body = Animation:New(animation.kupo.arrow)
|
||||
-- animations
|
||||
o.body = Animation:New(animation.kupo.arrow)
|
||||
|
||||
o.boxCollision = {
|
||||
from = {x = -0.5, y = -0.5}, --gameworld pixels
|
||||
to = {x = 0.5, y = 0.5} -- gameworld pixels
|
||||
}
|
||||
o.boxCollision = {
|
||||
from = {x = -0.5, y = -0.5}, --gameworld pixels
|
||||
to = {x = 0.5, y = 0.5} -- gameworld pixels
|
||||
}
|
||||
|
||||
table.insert(LoadedObjects.Entities,o)
|
||||
o.id = #LoadedObjects.Entities
|
||||
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
return o
|
||||
end
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
return o
|
||||
end
|
||||
|
||||
function Arrow:DrawBackground()
|
||||
self:Draw(self.body)
|
||||
self:Draw(self.body)
|
||||
end
|
||||
|
||||
function Arrow:DoPhysics()
|
||||
if not self:isCollidingAt(self.pos.x + self.vel.x, self.pos.y, LoadedObjects.Collisions) then
|
||||
self.pos.x = self.pos.x + self.vel.x
|
||||
else
|
||||
self.stuck = true
|
||||
end
|
||||
if not self:isCollidingAt(self.pos.x, self.pos.y + self.vel.y, LoadedObjects.Collisions) then
|
||||
self.pos.y = self.pos.y + self.vel.y
|
||||
else
|
||||
self.stuck = true
|
||||
end
|
||||
if self.stuck then
|
||||
self.pos.x = self.pos.x + self.vel.x * (2/3)
|
||||
self.pos.y = self.pos.y + self.vel.y * (2/3)
|
||||
self.vel.x = 0
|
||||
self.vel.y = 0
|
||||
end
|
||||
if not self:isCollidingAt(self.pos.x + self.vel.x, self.pos.y, LoadedObjects.Collisions) then
|
||||
self.pos.x = self.pos.x + self.vel.x
|
||||
else
|
||||
self.stuck = true
|
||||
end
|
||||
if not self:isCollidingAt(self.pos.x, self.pos.y + self.vel.y, LoadedObjects.Collisions) then
|
||||
self.pos.y = self.pos.y + self.vel.y
|
||||
else
|
||||
self.stuck = true
|
||||
end
|
||||
if self.stuck then
|
||||
self.pos.x = self.pos.x + self.vel.x * (2/3)
|
||||
self.pos.y = self.pos.y + self.vel.y * (2/3)
|
||||
self.vel.x = 0
|
||||
self.vel.y = 0
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user