Blaster = Object:extend() function Blaster:new(x, y, owner) self.x = x self.y = y self.radius = 10 self.height = self.radius * 2 self.width = self.radius * 2 self.speed = 700 self.color = { 1, 0, 0 } self.destroy = false self.owner = owner end function Blaster:draw() --draw stuff love.graphics.circle("fill", self.x, self.y, self.radius) end function Blaster:update(dt) if self.owner == "player" then self.y = self.y - self.speed * dt elseif self.owner == "enemy" then self.y = self.y + self.speed * dt end end function Blaster:checkCollision(obj) local self_left = self.x local self_right = self.x + self.width local self_top = self.y local self_bottom = self.y + self.height local obj_left = obj.x local obj_right = obj.x + obj.width local obj_top = obj.y local obj_bottom = obj.y + obj.height if (self_right > obj_left) and (self_left < obj_right) and (self_bottom > obj_top) and (self_top < obj_bottom) then self.destroy = true obj.health = obj.health - 25 --other blaster logic here end end