pleins de trucs
This commit is contained in:
30
scripts/battle/bullets/arenahazard.lua
Normal file
30
scripts/battle/bullets/arenahazard.lua
Normal 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
|
||||
24
scripts/battle/bullets/smallbullet.lua
Normal file
24
scripts/battle/bullets/smallbullet.lua
Normal 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
|
||||
Reference in New Issue
Block a user