- 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.
25 lines
815 B
Lua
25 lines
815 B
Lua
---@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
|