chore: camera border + troop pack delay
This commit is contained in:
parent
581b42f7fb
commit
51ffbc09d3
4 changed files with 12 additions and 13 deletions
|
|
@ -1,7 +1,8 @@
|
||||||
extends Camera3D
|
extends Camera3D
|
||||||
|
|
||||||
|
|
||||||
const SCREEN_MARGIN : int = 150
|
const SCREEN_MARGIN : int = 50
|
||||||
|
const SCREEN_MOVEMENT_SPEED : float = .05
|
||||||
|
|
||||||
@export var curve : Curve
|
@export var curve : Curve
|
||||||
|
|
||||||
|
|
@ -15,13 +16,13 @@ func _process(_delta: float) -> void:
|
||||||
var mousePosition : Vector2 = get_viewport().get_mouse_position()
|
var mousePosition : Vector2 = get_viewport().get_mouse_position()
|
||||||
|
|
||||||
if mousePosition.x < SCREEN_MARGIN:
|
if mousePosition.x < SCREEN_MARGIN:
|
||||||
position.x += -0.05
|
position.x += -SCREEN_MOVEMENT_SPEED
|
||||||
if mousePosition.y < SCREEN_MARGIN:
|
if mousePosition.y < SCREEN_MARGIN:
|
||||||
position.z += -0.05
|
position.z += -SCREEN_MOVEMENT_SPEED
|
||||||
if mousePosition.x > windowSize.x - SCREEN_MARGIN:
|
if mousePosition.x > windowSize.x - SCREEN_MARGIN:
|
||||||
position.x += 0.05
|
position.x += SCREEN_MOVEMENT_SPEED
|
||||||
if mousePosition.y > windowSize.y - SCREEN_MARGIN:
|
if mousePosition.y > windowSize.y - SCREEN_MARGIN:
|
||||||
position.z += 0.05
|
position.z += SCREEN_MOVEMENT_SPEED
|
||||||
|
|
||||||
|
|
||||||
func _input(event: InputEvent) -> void:
|
func _input(event: InputEvent) -> void:
|
||||||
|
|
@ -30,9 +31,9 @@ func _input(event: InputEvent) -> void:
|
||||||
|
|
||||||
var newPosition : float = position.y
|
var newPosition : float = position.y
|
||||||
if event.button_index == MOUSE_BUTTON_WHEEL_UP:
|
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:
|
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))
|
rotation.x = deg_to_rad(curve.sample(newPosition))
|
||||||
position.y = newPosition
|
position.y = newPosition
|
||||||
|
|
|
||||||
|
|
@ -5,3 +5,4 @@ class_name Troop
|
||||||
@export var number_to_spawn : int = 1
|
@export var number_to_spawn : int = 1
|
||||||
@export var lane_to_spawn : int = 0
|
@export var lane_to_spawn : int = 0
|
||||||
@export var spawn_delay : float = 1
|
@export var spawn_delay : float = 1
|
||||||
|
@export var pack_delay : float = .15
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,6 @@ class_name WorldManager
|
||||||
enum STATE { INIT, IDLE, SPAWN, SPAWNING, FIGHT, WAVE_END, LEVEL_END }
|
enum STATE { INIT, IDLE, SPAWN, SPAWNING, FIGHT, WAVE_END, LEVEL_END }
|
||||||
|
|
||||||
|
|
||||||
const PACK_DELAY : float = .15
|
|
||||||
|
|
||||||
|
|
||||||
var level : Level
|
var level : Level
|
||||||
var paths : Array[Node]
|
var paths : Array[Node]
|
||||||
var state : STATE = STATE.INIT
|
var state : STATE = STATE.INIT
|
||||||
|
|
@ -78,7 +75,7 @@ func spawnTroop() -> void:
|
||||||
var totalDelay : float = 0
|
var totalDelay : float = 0
|
||||||
for n in currentTroop.number_to_spawn:
|
for n in currentTroop.number_to_spawn:
|
||||||
spawnEnemy(enemyScene, currentTroop.lane_to_spawn, totalDelay)
|
spawnEnemy(enemyScene, currentTroop.lane_to_spawn, totalDelay)
|
||||||
totalDelay += PACK_DELAY
|
totalDelay += currentTroop.pack_delay
|
||||||
|
|
||||||
currentTroopIdx += 1
|
currentTroopIdx += 1
|
||||||
spawnNextTroop()
|
spawnNextTroop()
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,8 @@ var isLevelMax : bool :
|
||||||
get(): return maxLevel == level
|
get(): return maxLevel == level
|
||||||
|
|
||||||
|
|
||||||
func upgradeProperty(tower: Variant, property: String) -> void:
|
func upgradeProperty(subject: Variant, property: String) -> void:
|
||||||
tower.set(property, getNextValue(tower.get(property)))
|
subject.set(property, getNextValue(subject.get(property)))
|
||||||
|
|
||||||
|
|
||||||
func upgradeUpgrade() -> void:
|
func upgradeUpgrade() -> void:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue