Add new maps and tileset for the game world

- 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.
This commit is contained in:
2026-05-01 17:43:39 +02:00
parent ca9edf5f0c
commit 1b6eb9152c
35 changed files with 1747 additions and 4 deletions

View File

@@ -0,0 +1,30 @@
---@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

View File

@@ -0,0 +1,24 @@
---@class SmallBullet : Bullet
local SmallBullet, super = Class(Bullet)
---@param x number # The X position of the bullet
---@param y number # The Y position of the bullet
---@param dir number # The dir (in radians) of the bullet
---@param speed number # The speed the bullet will move at in the specified direction
function SmallBullet:init(x, y, dir, speed)
-- Last argument = sprite path
super.init(self, x, y, "bullets/smallbullet")
-- Move the bullet in dir radians (0 = right, pi = left, clockwise rotation)
self.physics.direction = dir
-- Speed the bullet moves (pixels per frame at 30FPS)
self.physics.speed = speed
end
function SmallBullet:update()
-- For more complicated bullet behaviours, code here gets called every update
super.update(self)
end
return SmallBullet