chore: camera border + troop pack delay

This commit is contained in:
Varylios 2025-09-06 15:16:48 +02:00
parent 581b42f7fb
commit 51ffbc09d3
4 changed files with 12 additions and 13 deletions

View file

@ -1,7 +1,8 @@
extends Camera3D
const SCREEN_MARGIN : int = 150
const SCREEN_MARGIN : int = 50
const SCREEN_MOVEMENT_SPEED : float = .05
@export var curve : Curve
@ -15,13 +16,13 @@ func _process(_delta: float) -> void:
var mousePosition : Vector2 = get_viewport().get_mouse_position()
if mousePosition.x < SCREEN_MARGIN:
position.x += -0.05
position.x += -SCREEN_MOVEMENT_SPEED
if mousePosition.y < SCREEN_MARGIN:
position.z += -0.05
position.z += -SCREEN_MOVEMENT_SPEED
if mousePosition.x > windowSize.x - SCREEN_MARGIN:
position.x += 0.05
position.x += SCREEN_MOVEMENT_SPEED
if mousePosition.y > windowSize.y - SCREEN_MARGIN:
position.z += 0.05
position.z += SCREEN_MOVEMENT_SPEED
func _input(event: InputEvent) -> void:
@ -30,9 +31,9 @@ func _input(event: InputEvent) -> void:
var newPosition : float = position.y
if event.button_index == MOUSE_BUTTON_WHEEL_UP:
newPosition = clampf(newPosition - .2, 2, 10)
newPosition = clampf(newPosition - .2, curve.min_value, curve.max_value)
elif event.button_index == MOUSE_BUTTON_WHEEL_DOWN:
newPosition = clampf(newPosition + .2, 2, 10)
newPosition = clampf(newPosition + .2, curve.min_value, curve.max_value)
rotation.x = deg_to_rad(curve.sample(newPosition))
position.y = newPosition

View file

@ -5,3 +5,4 @@ class_name Troop
@export var number_to_spawn : int = 1
@export var lane_to_spawn : int = 0
@export var spawn_delay : float = 1
@export var pack_delay : float = .15

View file

@ -5,9 +5,6 @@ class_name WorldManager
enum STATE { INIT, IDLE, SPAWN, SPAWNING, FIGHT, WAVE_END, LEVEL_END }
const PACK_DELAY : float = .15
var level : Level
var paths : Array[Node]
var state : STATE = STATE.INIT
@ -78,7 +75,7 @@ func spawnTroop() -> void:
var totalDelay : float = 0
for n in currentTroop.number_to_spawn:
spawnEnemy(enemyScene, currentTroop.lane_to_spawn, totalDelay)
totalDelay += PACK_DELAY
totalDelay += currentTroop.pack_delay
currentTroopIdx += 1
spawnNextTroop()

View file

@ -28,8 +28,8 @@ var isLevelMax : bool :
get(): return maxLevel == level
func upgradeProperty(tower: Variant, property: String) -> void:
tower.set(property, getNextValue(tower.get(property)))
func upgradeProperty(subject: Variant, property: String) -> void:
subject.set(property, getNextValue(subject.get(property)))
func upgradeUpgrade() -> void: