Compare commits
No commits in common. '86d33a7fc57bbbd1397d216520eba6e38a8ffd73' and '451d7103261d26c77f6cb5f513e81dcf47333c84' have entirely different histories.
86d33a7fc5
...
451d710326
Before Width: | Height: | Size: 2.8 KiB |
@ -1,70 +0,0 @@ |
||||
PowerUp = Object:extend() |
||||
|
||||
-- PowerUp is the super class for all power-ups |
||||
-- found in the game |
||||
|
||||
function PowerUp:new(name, x, y, image, time, lifetime) |
||||
self.name = name |
||||
self.x = x |
||||
self.y = y |
||||
self.image = love.graphics.newImage(image) |
||||
self.time = time |
||||
self.lifetime = lifetime |
||||
|
||||
self.width = self.image:getWidth() |
||||
self.height = self.image:getHeight() |
||||
|
||||
self.rotation = 1 |
||||
self.scaleX = 1 |
||||
self.scaleY = 1 |
||||
self.originX = self.width / 2 |
||||
self.originY = self.height / 2 |
||||
|
||||
-- Collider |
||||
self.collider = World:newRectangleCollider(x, y, 20, 20) |
||||
self.collider:setCollisionClass("PowerUp") |
||||
self.collider:setType("static") |
||||
self.collider:setPosition(self.x, self.y) |
||||
end |
||||
-- TODO: clean up colliosn on reset |
||||
-- make image draw |
||||
-- more stuff |
||||
-- see you later |
||||
|
||||
function PowerUp:apply(player) end |
||||
|
||||
function PowerUp:remove(player) end |
||||
|
||||
function PowerUp:update(dt) |
||||
--check if the power up is past its lifetime |
||||
|
||||
--spinnnnnn |
||||
self.rotation = self.rotation + 1.5 * dt |
||||
|
||||
--grown and shrink |
||||
--[[ |
||||
if self.scaleX >= 1.0 then |
||||
self.scaleX = self.scaleX - 0.2 * dt |
||||
elseif self.scaleX <= 1.8 then |
||||
self.scaleX = self.scaleX + 0.2 * dt |
||||
end |
||||
]] |
||||
|
||||
self.x = self.collider:getX() |
||||
self.y = self.collider:getY() |
||||
end |
||||
|
||||
function PowerUp:draw() |
||||
for _, _ in ipairs(PowerUps) do |
||||
love.graphics.draw( |
||||
self.image, |
||||
self.x, |
||||
self.y, |
||||
self.rotation, |
||||
self.scaleX, |
||||
self.scaleY, |
||||
self.originX, |
||||
self.originY |
||||
) |
||||
end |
||||
end |
Loading…
Reference in new issue