made visual updates
This commit is contained in:
@ -1,6 +1,14 @@
|
||||
class_name EnemyMovement extends Node
|
||||
|
||||
@export var character: CharacterBody3D
|
||||
@export var character: EnemyController
|
||||
|
||||
var astar: AStarGraph3D
|
||||
var distance_remaining: float = 0.0
|
||||
var speed: float = 0.0
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
#TODO: make deterministic random
|
||||
var variance: float = randf_range(-1.0, 1.0)
|
||||
var variance_max: float = 0.03 # Enemy speed can vary by 3% from their base speed
|
||||
speed = character.stats.movement_speed + (variance * variance_max)
|
||||
|
@ -3,10 +3,24 @@ class_name PathingController extends EnemyMovement
|
||||
#var path: Curve3D
|
||||
#var path_progress: float = 0.0
|
||||
var flow_field: FlowField
|
||||
var next_node: FlowNode
|
||||
var next_node: FlowNode :
|
||||
get():
|
||||
return next_node
|
||||
set(value):
|
||||
next_node = value
|
||||
var found_point: bool = false
|
||||
while !found_point:
|
||||
#TODO: make deterministic random
|
||||
var x: float = randf_range(-1, 1)
|
||||
var y: float = randf_range(-1, 1)
|
||||
if Vector3(next_node.global_position.x + x, next_node.global_position.y, next_node.global_position.z + y).distance_to(next_node.global_position) <= 1.0:
|
||||
found_point = true
|
||||
next_pos = Vector3(next_node.global_position.x + x, next_node.global_position.y, next_node.global_position.z + y)
|
||||
var next_pos: Vector3
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
super._ready()
|
||||
#if path:
|
||||
# distance_remaining = path.get_baked_length()
|
||||
next_node = flow_field.get_closest_traversable_point(character.global_position)
|
||||
@ -26,11 +40,11 @@ func calculate_distance_to_goal(node: FlowNode) -> float:
|
||||
|
||||
|
||||
func walk(delta: float) -> void:
|
||||
var distance_travelled: float = (character.stats.movement_speed * clampf(character.movement_speed_penalty, 0.0, 1.0)) * delta
|
||||
var distance_travelled: float = (speed * clampf(speed, 0.0, 1.0)) * delta
|
||||
distance_remaining -= distance_travelled
|
||||
character.global_position = character.global_position.move_toward(next_node.global_position, distance_travelled)
|
||||
character.look_at(next_node.global_position)
|
||||
if character.global_position.distance_to(next_node.global_position) <= 0.05:
|
||||
character.global_position = character.global_position.move_toward(next_pos, distance_travelled)
|
||||
character.look_at(next_pos)
|
||||
if character.global_position.distance_to(next_pos) <= 0.05:
|
||||
next_node = next_node.best_path
|
||||
|
||||
|
||||
|
@ -8,12 +8,12 @@ signal game_setup
|
||||
signal game_started
|
||||
signal lost_game
|
||||
signal won_game
|
||||
signal switch_to_single_player
|
||||
signal switch_to_multi_player
|
||||
signal switch_to_main_menu
|
||||
|
||||
var level_scene: PackedScene = load("res://Worlds/GreenPlanet/Levels/first_level.tscn")
|
||||
var player_scene: PackedScene = load("res://PCs/hero.tscn")
|
||||
var main_menu_scene_path: String = "res://Scenes/Menus/MainMenu/main_menu.tscn"
|
||||
var multiplayer_lobby_scene_path: String = "res://Scenes/Menus/multiplayer_lobby.tscn"
|
||||
var singleplayer_lobby_scene_path: String = "res://Scenes/Menus/singleplayer_lobby.tscn"
|
||||
var game_end_scene: PackedScene = load("res://Scenes/Menus/GameEndScreen/game_end_screen.tscn")
|
||||
var connected_players_nodes: Dictionary = {}
|
||||
var game_active: bool = false
|
||||
@ -262,12 +262,13 @@ func end_wave() -> void:
|
||||
for spawn: EnemySpawner in level.enemy_spawns:
|
||||
spawn.path.enable_visualization()
|
||||
#level.a_star_graph_3d.enable_non_path_tower_frames()
|
||||
level.enable_non_path_tower_frames()
|
||||
if is_multiplayer_authority():
|
||||
if randf_in_range(23 * wave, 0.0, 1.0) <= shop_chance:
|
||||
networked_spawn_shop.rpc()
|
||||
shop_chance = 0.0
|
||||
else:
|
||||
shop_chance += 0.07
|
||||
shop_chance += 0.09
|
||||
wave_finished.emit(wave)
|
||||
set_upcoming_wave()
|
||||
|
||||
@ -365,12 +366,15 @@ func scene_switch_main_menu() -> void:
|
||||
connected_players_nodes.clear()
|
||||
multiplayer.multiplayer_peer.close()
|
||||
multiplayer.multiplayer_peer = null
|
||||
get_tree().change_scene_to_file(main_menu_scene_path)
|
||||
switch_to_main_menu.emit()
|
||||
#get_tree().change_scene_to_file(main_menu_scene_path)
|
||||
|
||||
|
||||
func scene_switch_to_multiplayer_lobby() -> void:
|
||||
get_tree().change_scene_to_file(multiplayer_lobby_scene_path)
|
||||
switch_to_multi_player.emit()
|
||||
#get_tree().change_scene_to_file(multiplayer_lobby_scene_path)
|
||||
|
||||
|
||||
func scene_switch_to_singleplayer_lobby() -> void:
|
||||
get_tree().change_scene_to_file(singleplayer_lobby_scene_path)
|
||||
switch_to_single_player.emit()
|
||||
#get_tree().change_scene_to_file(singleplayer_lobby_scene_path)
|
||||
|
@ -1,7 +1,9 @@
|
||||
class_name Hitbox extends CollisionShape3D
|
||||
|
||||
@export var critical_zone: bool = false
|
||||
|
||||
signal took_damage(amount: int)
|
||||
|
||||
|
||||
func damage(amount: int) -> void:
|
||||
took_damage.emit(amount)
|
||||
took_damage.emit(amount * 1.5 if critical_zone else amount)
|
||||
|
@ -12,7 +12,7 @@ class_name WaveManager extends Object
|
||||
## Takes in wave number and number of players and returns a spawn power value
|
||||
## intended for passing into the generate_wave method
|
||||
static func calculate_spawn_power(wave_number: int, number_of_players: int) -> int:
|
||||
return (20 * number_of_players) + (5 * wave_number)
|
||||
return (40 * number_of_players) + (6 * wave_number)
|
||||
|
||||
|
||||
## Takes in wave number and number of players and returns the amount of coins
|
||||
|
Reference in New Issue
Block a user