Compare commits
No commits in common. "89f9bd1913a3476b062a77b0dd8048cfc4108d7b" and "bdba4cc62f64184fcd6fe711421d61b9f476afe4" have entirely different histories.
89f9bd1913
...
bdba4cc62f
8 changed files with 31 additions and 91 deletions
6
.gitmodules
vendored
6
.gitmodules
vendored
|
|
@ -10,9 +10,3 @@
|
||||||
[submodule "lib/cameramod"]
|
[submodule "lib/cameramod"]
|
||||||
path = lib/cameramod
|
path = lib/cameramod
|
||||||
url = https://github.com/a327ex/ModifiedCamera
|
url = https://github.com/a327ex/ModifiedCamera
|
||||||
[submodule "lib/breezefield"]
|
|
||||||
path = lib/breezefield
|
|
||||||
url = https://github.com/HDictus/breezefield
|
|
||||||
[submodule "lib/hc"]
|
|
||||||
path = lib/hc
|
|
||||||
url = https://github.com/vrld/HC
|
|
||||||
|
|
|
||||||
6
.vscode/settings.json
vendored
6
.vscode/settings.json
vendored
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
"Lua.diagnostics.globals": [
|
|
||||||
"love",
|
|
||||||
"Circle"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit 01faa2dd8def34aecc7018492f93f5a8e224237a
|
|
||||||
1
lib/hc
1
lib/hc
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit eb1f285cb1cc4d951d90c92b64a4fc85e7ed06bd
|
|
||||||
14
main.lua
14
main.lua
|
|
@ -12,8 +12,6 @@ Baton = require 'lib/baton/baton'
|
||||||
---@type Timer
|
---@type Timer
|
||||||
Timer = require 'lib/hump/timer'
|
Timer = require 'lib/hump/timer'
|
||||||
|
|
||||||
HC = require 'lib/hc'
|
|
||||||
|
|
||||||
Camera = require 'lib/cameramod/camera'
|
Camera = require 'lib/cameramod/camera'
|
||||||
require 'lib/cameramod/Shake'
|
require 'lib/cameramod/Shake'
|
||||||
|
|
||||||
|
|
@ -22,6 +20,9 @@ Room = require 'obj/Room'
|
||||||
Area = require 'obj/Area'
|
Area = require 'obj/Area'
|
||||||
GameObject = require 'obj/GameObject'
|
GameObject = require 'obj/GameObject'
|
||||||
|
|
||||||
|
-- game objects --
|
||||||
|
Circle = require 'obj/game/Circle'
|
||||||
|
|
||||||
function love.load()
|
function love.load()
|
||||||
-- screen setup
|
-- screen setup
|
||||||
love.graphics.setDefaultFilter("nearest")
|
love.graphics.setDefaultFilter("nearest")
|
||||||
|
|
@ -31,13 +32,6 @@ function love.load()
|
||||||
---@type Room|nil
|
---@type Room|nil
|
||||||
current_room = nil
|
current_room = nil
|
||||||
|
|
||||||
-- load game objects
|
|
||||||
local game_objects = {}
|
|
||||||
print('loading game objects:')
|
|
||||||
recursiveEnumerate('obj/game', game_objects)
|
|
||||||
for _,v in ipairs(game_objects) do print('',v) end
|
|
||||||
requireFiles(game_objects, true)
|
|
||||||
|
|
||||||
-- load rooms
|
-- load rooms
|
||||||
local room_files = {}
|
local room_files = {}
|
||||||
print('loading rooms:')
|
print('loading rooms:')
|
||||||
|
|
@ -65,7 +59,7 @@ end
|
||||||
function love.update(dt)
|
function love.update(dt)
|
||||||
if current_room then current_room:update(dt) end
|
if current_room then current_room:update(dt) end
|
||||||
input:update(dt)
|
input:update(dt)
|
||||||
if input:pressed('f1') then gotoRoom('CircleRoom') end
|
if input:pressed('f1') then gotoRoom('Stage') end
|
||||||
if input:pressed('f3') then camera:shake(4, 60, 1) end
|
if input:pressed('f3') then camera:shake(4, 60, 1) end
|
||||||
|
|
||||||
camera:update(dt)
|
camera:update(dt)
|
||||||
|
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
---@class Player:GameObject
|
|
||||||
---@field area Area
|
|
||||||
---@field x number
|
|
||||||
---@field y number
|
|
||||||
---@field opts table|nil
|
|
||||||
local Player = GameObject:extend()
|
|
||||||
|
|
||||||
function Player:new(area, x, y, opts)
|
|
||||||
Player.super.new(self, area, x, y, opts)
|
|
||||||
end
|
|
||||||
|
|
||||||
function Player:update(dt)
|
|
||||||
Player.super.update(self, dt)
|
|
||||||
end
|
|
||||||
|
|
||||||
function Player:draw()
|
|
||||||
Player.super.draw(self)
|
|
||||||
end
|
|
||||||
|
|
||||||
return Player
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
||||||
---@class CircleRoom:Room
|
|
||||||
---@field timer Timer
|
|
||||||
local CircleRoom = Room:extend()
|
|
||||||
|
|
||||||
function CircleRoom:new()
|
|
||||||
CircleRoom.super.new(self)
|
|
||||||
self.timer = Timer()
|
|
||||||
|
|
||||||
-- game objects
|
|
||||||
self.timer:every(2, function()
|
|
||||||
local latest_object = self.area:addGameObject('Circle', love.math.random(1, gw), love.math.random(1, gh))
|
|
||||||
latest_object.timer:after(love.math.random(2, 4), function() latest_object:kill() end)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
function CircleRoom:update(dt)
|
|
||||||
CircleRoom.super.update(self, dt)
|
|
||||||
|
|
||||||
if input:pressed('action') then
|
|
||||||
local latest_object = self.area:addGameObject('Circle', love.math.random(1, gw), love.math.random(1, gh), {radius = 15})
|
|
||||||
end
|
|
||||||
|
|
||||||
if input:pressed('right') then
|
|
||||||
for _, game_object in ipairs(self.area.game_objects) do
|
|
||||||
game_object:kill()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if input:pressed('left') then
|
|
||||||
for _, game_object in ipairs(self.area.game_objects) do
|
|
||||||
if game_object:is(Circle) then
|
|
||||||
---@cast game_object Circle
|
|
||||||
if game_object.mode == "fill" then game_object.mode = "line" else game_object.mode = "fill" end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
self.timer:update(dt)
|
|
||||||
end
|
|
||||||
|
|
||||||
function CircleRoom:canvasDraw()
|
|
||||||
CircleRoom.super.canvasDraw(self)
|
|
||||||
end
|
|
||||||
|
|
||||||
return CircleRoom
|
|
||||||
|
|
@ -1,14 +1,39 @@
|
||||||
---@class Stage:Room
|
---@class Stage:Room
|
||||||
|
---@field timer Timer
|
||||||
local Stage = Room:extend()
|
local Stage = Room:extend()
|
||||||
|
|
||||||
function Stage:new()
|
function Stage:new()
|
||||||
Stage.super.new(self)
|
Stage.super.new(self)
|
||||||
|
self.timer = Timer()
|
||||||
self.area:addGameObject('Player', gw/2, gh/2)
|
self.timer:every(2, function()
|
||||||
|
local latest_object = self.area:addGameObject('Circle', love.math.random(1, gw), love.math.random(1, gh))
|
||||||
|
latest_object.timer:after(love.math.random(2, 4), function() latest_object:kill() end)
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Stage:update(dt)
|
function Stage:update(dt)
|
||||||
Stage.super.update(self, dt)
|
Stage.super.update(self, dt)
|
||||||
|
|
||||||
|
if input:pressed('action') then
|
||||||
|
local latest_object = self.area:addGameObject('Circle', love.math.random(1, gw), love.math.random(1, gh), {radius = 15})
|
||||||
|
end
|
||||||
|
|
||||||
|
if input:pressed('right') then
|
||||||
|
for _, game_object in ipairs(self.area.game_objects) do
|
||||||
|
game_object:kill()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if input:pressed('left') then
|
||||||
|
for _, game_object in ipairs(self.area.game_objects) do
|
||||||
|
if game_object:is(Circle) then
|
||||||
|
---@cast game_object Circle
|
||||||
|
if game_object.mode == "fill" then game_object.mode = "line" else game_object.mode = "fill" end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
self.timer:update(dt)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Stage:canvasDraw()
|
function Stage:canvasDraw()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue