pleins de trucs

This commit is contained in:
Deadzi06
2026-07-10 06:10:33 +02:00
commit a55abbc5f7
51 changed files with 2235 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
local Aiming, super = Class(Wave)
function Aiming:onStart()
-- Every 0.5 seconds...
self.timer:every(1 / 2, function()
-- Get all enemies that selected this wave as their attack
local attackers = self:getAttackers()
-- Loop through all attackers
for _, attacker in ipairs(attackers) do
-- Get the attacker's center position
local x, y = attacker:getRelativePos(attacker.width / 2, attacker.height / 2)
-- Get the angle between the bullet position and the soul's position
local angle = MathUtils.angle(x, y, Game.battle.soul.x, Game.battle.soul.y)
-- Spawn smallbullet angled towards the player with speed 8 (see scripts/battle/bullets/smallbullet.lua)
self:spawnBullet("smallbullet", x, y, angle, 8)
end
end)
end
function Aiming:update()
-- Code here gets called every frame
super.update(self)
end
return Aiming

View File

@@ -0,0 +1,25 @@
local Basic, super = Class(Wave)
function Basic:onStart()
-- Every 0.33 seconds...
self.timer:every(1 / 3, function()
-- Our X position is offscreen, to the right
local x = SCREEN_WIDTH + 20
-- Get a random Y position between the top and the bottom of the arena
local y = MathUtils.random(Game.battle.arena.top, Game.battle.arena.bottom)
-- Spawn smallbullet going left with speed 8 (see scripts/battle/bullets/smallbullet.lua)
local bullet = self:spawnBullet("smallbullet", x, y, math.rad(180), 8)
-- Dont remove the bullet offscreen, because we spawn it offscreen
bullet.remove_offscreen = false
end)
end
function Basic:update()
-- Code here gets called every frame
super.update(self)
end
return Basic

View File

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