Added siren sprite
This commit is contained in:
BIN
assets/images/siren.aseprite
Normal file
BIN
assets/images/siren.aseprite
Normal file
Binary file not shown.
BIN
assets/images/siren.png
Normal file
BIN
assets/images/siren.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 385 B |
@@ -19,8 +19,10 @@ function Siren.new(game)
|
||||
maxEffectiveRadius = 8 * TILE_SIZE
|
||||
}
|
||||
|
||||
self.texture = love.graphics.newImage 'assets/images/siren.png'
|
||||
|
||||
self.size = {}
|
||||
self.size.w, self.size.h = 12, 12 -- self.texture:getDimensions()
|
||||
self.size.w, self.size.h = self.texture:getDimensions()
|
||||
|
||||
self.isEnemy = true
|
||||
self.pos = self:_findSpawnPoint()
|
||||
@@ -47,25 +49,7 @@ function Siren:update(dt)
|
||||
end
|
||||
|
||||
function Siren:draw()
|
||||
love.graphics.setColor(0.88, 0.88, 0.88, 0.22)
|
||||
for _, pos in ipairs(self.game.env.nodes) do
|
||||
local distanceToPlayer = vector.dist(pos.x, pos.y, self.game.player:getPos())
|
||||
if distanceToPlayer > self.stats.spawnDistanceFromPlayer then
|
||||
love.graphics.rectangle('fill', pos.x, pos.y, TILE_SIZE, TILE_SIZE)
|
||||
end
|
||||
end
|
||||
|
||||
-- love.graphics.draw(self.texture, self.pos.x, self.pos.y)
|
||||
local color = math.clamp(math.maprange(
|
||||
self.distanceToPlayer,
|
||||
self.stats.minEffectiveRadius,
|
||||
self.stats.maxEffectiveRadius,
|
||||
0.22,
|
||||
0.88
|
||||
), 0.22, 0.88)
|
||||
|
||||
love.graphics.setColor(1 - color, 0.22, color)
|
||||
love.graphics.rectangle('fill', self.pos.x, self.pos.y, self.size.w, self.size.h)
|
||||
love.graphics.draw(self.texture, self.pos.x, self.pos.y)
|
||||
end
|
||||
|
||||
function Siren:getPos() return self.pos.x, self.pos.y end
|
||||
|
||||
2
todo.md
2
todo.md
@@ -8,7 +8,6 @@
|
||||
- [ ] Try replacing the Moonshine scan-line effect with the custom shader (or delete it)
|
||||
- [ ] Create player sprite
|
||||
- Make a mouse sprite for the player
|
||||
- [ ] Create a siren sprite
|
||||
- [ ] Create a local leaderboard to see who clears maze in the lowest amount of time
|
||||
|
||||
# in progress
|
||||
@@ -43,3 +42,4 @@
|
||||
- [x] When the lights are off, slow down the timer tick rate
|
||||
- [x] Added font
|
||||
- [x] Added menu art
|
||||
- [x] Create a siren sprite
|
||||
|
||||
Reference in New Issue
Block a user