- Created room1.tmx and room1.lua for the first room in the game, including tiles, collision objects, and NPCs. - Added room2.tmx and room2.lua for the second room, featuring tiles, collision objects, and an enemy. - Introduced a world template to manage map transitions and layout. - Implemented a new tileset (castle.tsx and castle.lua) for the castle theme, including tile properties and image references.
31 lines
910 B
Lua
31 lines
910 B
Lua
---@class ArenaHazard : Bullet
|
|
local ArenaHazard, super = Class(Bullet)
|
|
|
|
---@param x number # The X position of the bullet
|
|
---@param y number # The Y position of the bullet
|
|
---@param rot number # The rotation (in radians) of the bullet
|
|
function ArenaHazard:init(x, y, rot)
|
|
-- Last argument = sprite path
|
|
super.init(self, x, y, "bullets/arenahazard")
|
|
|
|
-- Top-center origin point (will be rotated around it)
|
|
self:setOrigin(0.5, 0)
|
|
|
|
-- The hitbox where the player will be damaged by the bullet (affected by scale and rotation)
|
|
self:setHitbox(0, 0, self.width, 8)
|
|
|
|
-- Rotation of the bullet (in radians)
|
|
self.rotation = rot
|
|
|
|
-- Don't destroy this bullet when it damages the player
|
|
self.destroy_on_hit = false
|
|
end
|
|
|
|
function ArenaHazard:update()
|
|
-- For more complicated bullet behaviours, code here gets called every update
|
|
|
|
super.update(self)
|
|
end
|
|
|
|
return ArenaHazard
|