Add Ika weaponry, lots of cleanup, new art assets.

This commit is contained in:
Anna Rose Wiggins 2023-10-01 01:48:06 -04:00
parent 5019be454c
commit e2a30253dd
6 changed files with 65 additions and 39 deletions

View file

@ -8,6 +8,7 @@ import "bullet"
import "ui"
local gfx <const> = playdate.graphics
local geom <const> = playdate.geometry
local BASE_CHARGE_FACTOR <const> = 15
local BASE_WEAPON_CHARGE_SPEED <const> = 1000
@ -39,8 +40,7 @@ local POWER_DAMAGE_LOOKUP <const> = {
class("Kani").extends(Entity)
function Kani:init(ui)
local img = gfx.image.new("images/kani.png")
Kani.super.init(self, img, 100)
Kani.super.init(self, gfx.image.new("images/kani.png"), 100)
self:setGroupMask(0x2)
self:setCollidesWithGroupsMask(0xd)
@ -60,14 +60,14 @@ function Kani:init(ui)
self.ui = ui
self.inputHandlers = {
upButtonDown = function() self.vector.y = -3 end,
downButtonDown = function() self.vector.y = 3 end,
leftButtonDown = function() self.vector.x = -3 end,
rightButtonDown = function() self.vector.x = 3 end,
upButtonUp = function() self.vector.y = 0 end,
downButtonUp = function() self.vector.y = 0 end,
leftButtonUp = function() self.vector.x = 0 end,
rightButtonUp = function() self.vector.x = 0 end,
upButtonDown = function() self.vector.dy = -3 end,
downButtonDown = function() self.vector.dy = 3 end,
leftButtonDown = function() self.vector.dx = -3 end,
rightButtonDown = function() self.vector.dx = 3 end,
upButtonUp = function() self.vector.dy = 0 end,
downButtonUp = function() self.vector.dy = 0 end,
leftButtonUp = function() self.vector.dx = 0 end,
rightButtonUp = function() self.vector.dx = 0 end,
cranked = function(change, accelChange) self:chargeReserve(change) end,
AButtonDown = function()
self.firingTimer = playdate.timer.keyRepeatTimerWithDelay(self.weaponChargeSpeed / 2,
@ -111,7 +111,12 @@ function Kani:fire()
return
end
local bullet = Bullet(POWER_SIZE_LOOKUP[self.weaponPower], POWER_DAMAGE_LOOKUP[self.weaponPower])
local bullet = Bullet(
POWER_SIZE_LOOKUP[self.weaponPower],
POWER_DAMAGE_LOOKUP[self.weaponPower],
geom.vector2D.new(5,0),
0x4
)
bullet:moveTo(self.x+16, self.y)
bullet:add()
self.weaponPower = 0