Peace Unto You! Thank you for assisting me
I’ll definitely keep all the wisdom you gave in mind.
Here’s one script for the controller that for what ever reason didn’t work
-- game_controller.script
local spawn_interval = 2 -- Initial spawn interval (in seconds)
local min_spawn_interval = 0.5 -- Minimum spawn interval (in seconds)
local spawn_timer = 0 -- Timer to track the time for spawning
local time_passed = 0 -- Time since last spawn interval update
local spawn_area = vmath.vector3(0, 0, 0) -- The area where enemies will spawn
function init(self)
-- Initialize variables and state
self.spawn_timer = 0
self.time_passed = 0
self.spawn_interval = spawn_interval
msg.post(".", "acquire_input_focus") -- Acquire input focus if needed
end
function update(self, dt)
-- Update spawn timer
self.spawn_timer = self.spawn_timer + dt
self.time_passed = self.time_passed + dt
-- Check if it's time to spawn a new enemy
if self.spawn_timer >= self.spawn_interval then
self.spawn_timer = 0
spawn_enemy(self)
end
-- Gradually decrease the spawn interval
if self.time_passed > 10 then -- Adjust this threshold as needed
self.spawn_interval = math.max(min_spawn_interval, self.spawn_interval * 0.95) -- Adjust the rate of acceleration
self.time_passed = 0
end
end
function spawn_enemy(self)
-- Determine the position where the enemy will spawn
local position = vmath.vector3(math.random(-300, 300), 400, 0)
-- Instantiate the enemy game object at the specified position
local enemy_id = go.get_id("main/level/enemy")
go.set_position(position, enemy_id)
end
function on_message(self, message_id, message, sender)
-- Handle messages if needed
end
function final(self)
-- Release input focus if needed
msg.post(".", "release_input_focus")
end