Files
Jamaique/scripts/battle/waves/movingarena.lua
Haapy 1b6eb9152c 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.
2026-05-01 17:43:39 +02:00

39 lines
981 B
Lua

local MovingArena, super = Class(Wave)
function MovingArena:init()
super.init(self)
-- Initialize timer
self.siner = 0
end
function MovingArena:onStart()
-- Get the arena object
local arena = Game.battle.arena
-- Spawn spikes on top of arena
self:spawnBulletTo(Game.battle.arena, "arenahazard", arena.width / 2, 0, math.rad(0))
-- Spawn spikes on bottom of arena (rotated 180 degrees)
self:spawnBulletTo(Game.battle.arena, "arenahazard", arena.width / 2, arena.height, math.rad(180))
-- Store starting arena position
self.arena_start_x = arena.x
self.arena_start_y = arena.y
end
function MovingArena:update()
-- Increment timer for arena movement
self.siner = self.siner + DT
-- Calculate the arena Y offset
local offset = math.sin(self.siner * 1.5) * 60
-- Move the arena
Game.battle.arena:setPosition(self.arena_start_x, self.arena_start_y + offset)
super.update(self)
end
return MovingArena