added player Finite State Machine
This commit is contained in:
@@ -19,13 +19,13 @@ health = 70
|
|||||||
penalty = 4
|
penalty = 4
|
||||||
movement_speed = 3.5
|
movement_speed = 3.5
|
||||||
spawn_cooldown = 0.6
|
spawn_cooldown = 0.6
|
||||||
common_group = 4
|
common_group = 5
|
||||||
common_cost = 2
|
common_cost = 2
|
||||||
uncommon_group = 8
|
uncommon_group = 11
|
||||||
uncommon_cost = 2
|
uncommon_cost = 2
|
||||||
rare_group = 14
|
rare_group = 16
|
||||||
rare_cost = 4
|
rare_cost = 4
|
||||||
epic_group = 20
|
epic_group = 23
|
||||||
epic_cost = 6
|
epic_cost = 6
|
||||||
legendary_group = 26
|
legendary_group = 30
|
||||||
legendary_cost = 10
|
legendary_cost = 10
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
[ext_resource type="PackedScene" uid="uid://bgxr27by7jruo" path="res://Enemies/BabyEyeDog/baby_eyedog.glb" id="10_8k5ts"]
|
[ext_resource type="PackedScene" uid="uid://bgxr27by7jruo" path="res://Enemies/BabyEyeDog/baby_eyedog.glb" id="10_8k5ts"]
|
||||||
|
|
||||||
[sub_resource type="SphereShape3D" id="SphereShape3D_cavbv"]
|
[sub_resource type="SphereShape3D" id="SphereShape3D_cavbv"]
|
||||||
radius = 0.269119
|
radius = 0.364
|
||||||
|
|
||||||
[sub_resource type="SphereShape3D" id="SphereShape3D_h25mw"]
|
[sub_resource type="SphereShape3D" id="SphereShape3D_h25mw"]
|
||||||
radius = 0.150315
|
radius = 0.150315
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ sprite = ExtResource("2_7nc4x")
|
|||||||
spawn_power = 14
|
spawn_power = 14
|
||||||
health = 350
|
health = 350
|
||||||
penalty = 15
|
penalty = 15
|
||||||
movement_speed = 0.9
|
movement_speed = 1.1
|
||||||
spawn_cooldown = 2.0
|
spawn_cooldown = 2.0
|
||||||
common_group = 2
|
common_group = 2
|
||||||
common_cost = 1
|
common_cost = 1
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ sprite = SubResource("AtlasTexture_n6kdu")
|
|||||||
spawn_power = 10
|
spawn_power = 10
|
||||||
health = 180
|
health = 180
|
||||||
penalty = 10
|
penalty = 10
|
||||||
movement_speed = 1.2
|
movement_speed = 1.5
|
||||||
spawn_cooldown = 1.2
|
spawn_cooldown = 1.2
|
||||||
common_group = 6
|
common_group = 6
|
||||||
common_cost = 1
|
common_cost = 1
|
||||||
|
|||||||
30
PCs/FSM/building_state.gd
Normal file
30
PCs/FSM/building_state.gd
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
class_name BuildingState
|
||||||
|
extends HeroState
|
||||||
|
|
||||||
|
@export var swap_state: HeroState
|
||||||
|
|
||||||
|
|
||||||
|
func enter_state() -> void:
|
||||||
|
hero.edit_tool.enabled = true
|
||||||
|
hero.game_manager.level.enable_non_path_tower_frames()
|
||||||
|
|
||||||
|
|
||||||
|
func exit_state() -> void:
|
||||||
|
hero.edit_tool.interact_key_held = false
|
||||||
|
hero.edit_tool.enabled = false
|
||||||
|
hero.game_manager.level.disable_all_tower_frames()
|
||||||
|
|
||||||
|
|
||||||
|
func process_state(_delta: float) -> void:
|
||||||
|
hero.check_world_button()
|
||||||
|
if Input.is_action_just_pressed("Primary Fire"):
|
||||||
|
hero.edit_tool.interact_key_held = true
|
||||||
|
if Input.is_action_just_released("Primary Fire"):
|
||||||
|
hero.edit_tool.interact_key_held = false
|
||||||
|
if Input.is_action_just_pressed("Swap Weapons"):
|
||||||
|
state_changed.emit(swap_state)
|
||||||
|
if Input.is_action_pressed("Ready"):
|
||||||
|
if hero.ready_state:
|
||||||
|
hero.unready_self()
|
||||||
|
else:
|
||||||
|
hero.ready_self()
|
||||||
1
PCs/FSM/building_state.gd.uid
Normal file
1
PCs/FSM/building_state.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://b5h7jfwkyokes
|
||||||
66
PCs/FSM/carding_state.gd
Normal file
66
PCs/FSM/carding_state.gd
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
class_name CardingState
|
||||||
|
extends HeroState
|
||||||
|
|
||||||
|
@export var swap_state: HeroState
|
||||||
|
|
||||||
|
|
||||||
|
func enter_state() -> void:
|
||||||
|
hero.set_card_elements_visibility(true)
|
||||||
|
hero.left_hand.visible = true
|
||||||
|
hero.carding_tool.enabled = true
|
||||||
|
|
||||||
|
|
||||||
|
func exit_state() -> void:
|
||||||
|
hero.set_card_elements_visibility(false)
|
||||||
|
hero.left_hand.visible = false
|
||||||
|
hero.carding_tool.enabled = false
|
||||||
|
|
||||||
|
|
||||||
|
func process_state(_delta: float) -> void:
|
||||||
|
hero.check_world_button()
|
||||||
|
if Input.is_action_just_pressed("Interact"):
|
||||||
|
hero.carding_tool.interact()
|
||||||
|
if Input.is_action_just_pressed("Primary Fire"):
|
||||||
|
hero.equip_weapon(0)
|
||||||
|
if Input.is_action_just_pressed("Secondary Fire"):
|
||||||
|
hero.equip_weapon(1)
|
||||||
|
if Input.is_action_just_pressed("Select Next Card") and hero.hand.size > 1:
|
||||||
|
hero.increment_selected()
|
||||||
|
hero.swap_card_audio.play()
|
||||||
|
if Input.is_action_just_pressed("Select Previous Card") and hero.hand.size > 1:
|
||||||
|
hero.decrement_selected()
|
||||||
|
hero.swap_card_audio.play()
|
||||||
|
if Input.is_action_just_pressed("Equip 1"):
|
||||||
|
swap_to_slot(1)
|
||||||
|
if Input.is_action_just_pressed("Equip 2"):
|
||||||
|
swap_to_slot(2)
|
||||||
|
if Input.is_action_just_pressed("Equip 3"):
|
||||||
|
swap_to_slot(3)
|
||||||
|
if Input.is_action_just_pressed("Equip 4"):
|
||||||
|
swap_to_slot(4)
|
||||||
|
if Input.is_action_just_pressed("Equip 5"):
|
||||||
|
swap_to_slot(5)
|
||||||
|
if Input.is_action_just_pressed("Equip 6"):
|
||||||
|
swap_to_slot(6)
|
||||||
|
if Input.is_action_just_pressed("Equip 7"):
|
||||||
|
swap_to_slot(7)
|
||||||
|
if Input.is_action_just_pressed("Equip 8"):
|
||||||
|
swap_to_slot(8)
|
||||||
|
if Input.is_action_just_pressed("Equip 9"):
|
||||||
|
swap_to_slot(9)
|
||||||
|
if Input.is_action_just_pressed("Equip 10"):
|
||||||
|
swap_to_slot(10)
|
||||||
|
if Input.is_action_just_pressed("Swap Weapons"):
|
||||||
|
state_changed.emit(swap_state)
|
||||||
|
if Input.is_action_pressed("Ready"):
|
||||||
|
if hero.ready_state:
|
||||||
|
hero.unready_self()
|
||||||
|
else:
|
||||||
|
hero.ready_self()
|
||||||
|
|
||||||
|
|
||||||
|
func swap_to_slot(num: int) -> void:
|
||||||
|
if hero.unique_cards.size() >= num:
|
||||||
|
hero.hand_selected_index = num - 1
|
||||||
|
hero.swap_card_audio.play()
|
||||||
|
hero.update_selected_box()
|
||||||
1
PCs/FSM/carding_state.gd.uid
Normal file
1
PCs/FSM/carding_state.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://cjdv1onyfej0m
|
||||||
57
PCs/FSM/fighting_state.gd
Normal file
57
PCs/FSM/fighting_state.gd
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
class_name FightingState
|
||||||
|
extends HeroState
|
||||||
|
|
||||||
|
|
||||||
|
func enter_state() -> void:
|
||||||
|
if hero.weapons[hero.equipped_weapon]:
|
||||||
|
hero.hud.set_energy_visible(true)
|
||||||
|
var offhand_weapon: Weapon = hero.weapons[0] if hero.equipped_weapon == 1 else hero.weapons[1]
|
||||||
|
if offhand_weapon:
|
||||||
|
offhand_weapon.current_energy = offhand_weapon.max_energy
|
||||||
|
if (!hero.weapons[hero.equipped_weapon] and offhand_weapon) or (hero.weapons[0] and hero.equipped_weapon == 1):
|
||||||
|
hero.swap_weapons()
|
||||||
|
if hero.weapons[hero.equipped_weapon]:
|
||||||
|
hero.weapons[hero.equipped_weapon].current_energy = hero.weapons[hero.equipped_weapon].max_energy
|
||||||
|
#this had to be commented out coz the new energy bar thinks "energy changed" is "energy used"
|
||||||
|
#weapons[equipped_weapon].energy_changed.emit(weapons[equipped_weapon].current_energy)
|
||||||
|
hero.weapon_swap_timer.start()
|
||||||
|
hero.hud.primary_duration.visible = false
|
||||||
|
hero.hud.secondary_duration.visible = false
|
||||||
|
hero.hud.energy_label.visible = false
|
||||||
|
|
||||||
|
|
||||||
|
func exit_state() -> void:
|
||||||
|
if hero.weapons[hero.equipped_weapon]:
|
||||||
|
hero.weapons[hero.equipped_weapon].release_trigger()
|
||||||
|
hero.weapons[hero.equipped_weapon].release_second_trigger()
|
||||||
|
hero.weapons[hero.equipped_weapon].visible = false
|
||||||
|
hero.hud.set_energy_visible(false)
|
||||||
|
hero.hud.grow_wave_start_label()
|
||||||
|
hero.hud.primary_duration.visible = true
|
||||||
|
hero.hud.secondary_duration.visible = true
|
||||||
|
hero.hud.energy_label.visible = true
|
||||||
|
|
||||||
|
|
||||||
|
func process_state(_delta: float) -> void:
|
||||||
|
if hero.weapons[hero.equipped_weapon] and hero.weapons_active:
|
||||||
|
if Input.is_action_just_pressed("Primary Fire"):
|
||||||
|
hero.weapons[hero.equipped_weapon].hold_trigger()
|
||||||
|
if Input.is_action_just_released("Primary Fire"):
|
||||||
|
hero.weapons[hero.equipped_weapon].release_trigger()
|
||||||
|
if Input.is_action_pressed("Secondary Fire"):
|
||||||
|
hero.weapons[hero.equipped_weapon].hold_second_trigger()
|
||||||
|
if Input.is_action_just_released("Secondary Fire"):
|
||||||
|
hero.weapons[hero.equipped_weapon].release_second_trigger()
|
||||||
|
if Input.is_action_pressed("Primary Fire"):
|
||||||
|
hero.movement.can_sprint = false
|
||||||
|
if Input.is_action_pressed("Secondary Fire"):
|
||||||
|
hero.movement.can_sprint = false
|
||||||
|
if Input.is_action_just_pressed("Equip Primary Weapon"):
|
||||||
|
if hero.equipped_weapon == 1 and hero.weapons[0]:
|
||||||
|
hero.swap_weapons()
|
||||||
|
if Input.is_action_just_pressed("Equip Secondary Weapon"):
|
||||||
|
if hero.equipped_weapon == 0 and hero.weapons[1]:
|
||||||
|
hero.swap_weapons()
|
||||||
|
if Input.is_action_just_pressed("Swap Weapons"):
|
||||||
|
if hero.weapons[0] and hero.weapons[1]:
|
||||||
|
hero.swap_weapons()
|
||||||
1
PCs/FSM/fighting_state.gd.uid
Normal file
1
PCs/FSM/fighting_state.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://cf7m4yyiqhhru
|
||||||
20
PCs/FSM/hero_state.gd
Normal file
20
PCs/FSM/hero_state.gd
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
class_name HeroState
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
@warning_ignore("unused_signal")
|
||||||
|
signal state_changed(new_state: HeroState)
|
||||||
|
|
||||||
|
@export var hero: Hero
|
||||||
|
|
||||||
|
|
||||||
|
func enter_state() -> void:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
func exit_state() -> void:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@warning_ignore("unused_parameter")
|
||||||
|
func process_state(delta: float) -> void:
|
||||||
|
pass
|
||||||
1
PCs/FSM/hero_state.gd.uid
Normal file
1
PCs/FSM/hero_state.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://cl8ovljfiagxv
|
||||||
@@ -6,13 +6,11 @@ extends Node3D
|
|||||||
@export var wall_preview: TowerBase
|
@export var wall_preview: TowerBase
|
||||||
@export var progress_bar: TextureProgressBar
|
@export var progress_bar: TextureProgressBar
|
||||||
|
|
||||||
var enabled: bool = true
|
var enabled: bool = false
|
||||||
var level: Level
|
var level: Level
|
||||||
var point: FlowNode
|
var point: FlowNode
|
||||||
var obstacle_last_point: int = -1
|
var obstacle_last_point: int = -1
|
||||||
var valid_point: bool = false # a point is valid if the path would still be traversable overall if this point was made untraversable
|
var valid_point: bool = false # a point is valid if the path would still be traversable overall if this point was made untraversable
|
||||||
var tower_preview: Tower
|
|
||||||
var tower_preview_card: Card
|
|
||||||
var ray_collider: Object
|
var ray_collider: Object
|
||||||
var ray_point: Vector3
|
var ray_point: Vector3
|
||||||
var last_point: FlowNode
|
var last_point: FlowNode
|
||||||
@@ -88,17 +86,14 @@ func reset() -> void:
|
|||||||
if is_instance_valid(ray_collider) and ray_collider is TowerBase and level.walls.has(ray_collider.point):
|
if is_instance_valid(ray_collider) and ray_collider is TowerBase and level.walls.has(ray_collider.point):
|
||||||
level.walls[ray_collider.point].set_float(1.0)
|
level.walls[ray_collider.point].set_float(1.0)
|
||||||
ray_collider = null
|
ray_collider = null
|
||||||
delete_tower_preview()
|
|
||||||
wall_preview.set_visible(false)
|
wall_preview.set_visible(false)
|
||||||
clear_previous_point()
|
clear_previous_point()
|
||||||
last_point = null
|
last_point = null
|
||||||
|
|
||||||
|
|
||||||
func process_looking_at_level() -> void:
|
func process_looking_at_level() -> void:
|
||||||
if tower_preview:
|
|
||||||
delete_tower_preview()
|
|
||||||
point = level.flow_field.get_closest_buildable_point(ray_point)
|
point = level.flow_field.get_closest_buildable_point(ray_point)
|
||||||
if level.walls.has(point) or !point.buildable or hero.energy < Data.wall_cost or !hero.building_mode:
|
if level.walls.has(point) or !point.buildable or hero.energy < Data.wall_cost:
|
||||||
wall_preview.set_visible(false)
|
wall_preview.set_visible(false)
|
||||||
valid_point = false
|
valid_point = false
|
||||||
clear_previous_point()
|
clear_previous_point()
|
||||||
@@ -126,40 +121,9 @@ func process_looking_at_tower() -> void:
|
|||||||
if last_point != point:
|
if last_point != point:
|
||||||
clear_previous_point()
|
clear_previous_point()
|
||||||
|
|
||||||
if tower_preview:
|
|
||||||
delete_tower_preview()
|
|
||||||
wall_preview.set_visible(false)
|
wall_preview.set_visible(false)
|
||||||
ray_collider.set_color(Color.RED)
|
ray_collider.set_color(Color.RED)
|
||||||
ray_collider.set_float(0.0)
|
ray_collider.set_float(0.0)
|
||||||
if hero.hand.size > 0 and !ray_collider.has_card:
|
|
||||||
if ray_collider != last_tower_base or hero.selected_card != tower_preview_card:
|
|
||||||
spawn_tower_preview()
|
|
||||||
|
|
||||||
|
|
||||||
func spawn_tower_preview() -> void:
|
|
||||||
delete_tower_preview()
|
|
||||||
last_tower_base = ray_collider
|
|
||||||
var card: Card = hero.selected_card
|
|
||||||
tower_preview_card = card
|
|
||||||
tower_preview = card.turret_scene.instantiate() as Tower
|
|
||||||
tower_preview.stats = card.tower_stats
|
|
||||||
tower_preview.position = Vector3.UP
|
|
||||||
tower_preview.preview_range(true)
|
|
||||||
ray_collider.add_child(tower_preview)
|
|
||||||
|
|
||||||
|
|
||||||
func delete_tower_preview() -> void:
|
|
||||||
last_tower_base = null
|
|
||||||
if is_instance_valid(tower_preview):
|
|
||||||
tower_preview.queue_free()
|
|
||||||
tower_preview = null
|
|
||||||
tower_preview_card = null
|
|
||||||
|
|
||||||
|
|
||||||
func interact() -> void:
|
|
||||||
if ray_collider is TowerBase:
|
|
||||||
var tower_base: TowerBase = ray_collider as TowerBase
|
|
||||||
put_card_in_tower_base(tower_base)
|
|
||||||
|
|
||||||
|
|
||||||
func build_wall() -> void:
|
func build_wall() -> void:
|
||||||
@@ -177,27 +141,5 @@ func refund_wall(wall: TowerBase) -> void:
|
|||||||
level.remove_wall(wall.point)
|
level.remove_wall(wall.point)
|
||||||
|
|
||||||
|
|
||||||
func put_card_in_tower_base(tower_base: TowerBase) -> void:
|
|
||||||
if hero.hand.size <= 0:
|
|
||||||
return
|
|
||||||
var card: Card = hero.selected_card
|
|
||||||
var energy_cost: int = int(card.rarity) + 1
|
|
||||||
energy_cost *= 2
|
|
||||||
if hero.energy < energy_cost:
|
|
||||||
return
|
|
||||||
if tower_base.has_card:
|
|
||||||
tower_base.remove_card()
|
|
||||||
hero.hand.remove_at(hero.hand.contents.find(card))
|
|
||||||
hero.check_removal()
|
|
||||||
#hero.card_sprites[hero.hand_selected_index].queue_free()
|
|
||||||
#hero.card_sprites.remove_at(hero.hand_selected_index)
|
|
||||||
#if !hero.hand.contents.has(card):
|
|
||||||
#hero.decrement_selected()
|
|
||||||
tower_base.add_card(card, multiplayer.get_unique_id())
|
|
||||||
hero.discard_pile.add(card)
|
|
||||||
hero.place_card_audio.play()
|
|
||||||
hero.energy -= energy_cost
|
|
||||||
|
|
||||||
|
|
||||||
func set_progress_percent(value: float) -> void:
|
func set_progress_percent(value: float) -> void:
|
||||||
progress_bar.value = progress_bar.max_value * value
|
progress_bar.value = progress_bar.max_value * value
|
||||||
|
|||||||
293
PCs/hero.gd
293
PCs/hero.gd
@@ -6,14 +6,11 @@ signal ready_state_changed(state: bool)
|
|||||||
@export var hero_class: HeroClass
|
@export var hero_class: HeroClass
|
||||||
@export var camera: Camera3D
|
@export var camera: Camera3D
|
||||||
@export var gun_camera: Camera3D
|
@export var gun_camera: Camera3D
|
||||||
@export var left_hand_sprite: Sprite3D
|
|
||||||
@export var left_hand: Node3D
|
@export var left_hand: Node3D
|
||||||
@export var right_hand: Node3D
|
@export var right_hand: Node3D
|
||||||
#@export var right_hand_animator: AnimationPlayer
|
|
||||||
@export var edit_tool: PathEditTool
|
@export var edit_tool: PathEditTool
|
||||||
@export var gauntlet_sprite: Sprite3D
|
@export var carding_tool: CardPlacingTool
|
||||||
@export var sprite: EightDirectionSprite3D
|
@export var sprite: EightDirectionSprite3D
|
||||||
#@export var hand_sprite: Sprite2D
|
|
||||||
@export var interaction_raycast: RayCast3D
|
@export var interaction_raycast: RayCast3D
|
||||||
@export var draw_pile: Inventory
|
@export var draw_pile: Inventory
|
||||||
@export var hand: Inventory
|
@export var hand: Inventory
|
||||||
@@ -27,6 +24,9 @@ signal ready_state_changed(state: bool)
|
|||||||
@export var weapon_swap_timer: Timer
|
@export var weapon_swap_timer: Timer
|
||||||
@export var card3d_scene: PackedScene
|
@export var card3d_scene: PackedScene
|
||||||
@export var card_select_scene: PackedScene
|
@export var card_select_scene: PackedScene
|
||||||
|
@export var editing_states: Array[HeroState]
|
||||||
|
@export var fighting_state: HeroState
|
||||||
|
@export var default_state: HeroState
|
||||||
|
|
||||||
@export_subgroup("Audio")
|
@export_subgroup("Audio")
|
||||||
@export var ears: AudioListener3D
|
@export var ears: AudioListener3D
|
||||||
@@ -39,7 +39,8 @@ signal ready_state_changed(state: bool)
|
|||||||
@export var swap_off_audio: AudioStreamPlayer
|
@export var swap_off_audio: AudioStreamPlayer
|
||||||
@export var swap_on_audio: AudioStreamPlayer
|
@export var swap_on_audio: AudioStreamPlayer
|
||||||
|
|
||||||
var building_mode: bool = true
|
var current_state: HeroState
|
||||||
|
var pre_fighting_state: HeroState
|
||||||
var selection_boxes: Array[CardSelectionBox] = []
|
var selection_boxes: Array[CardSelectionBox] = []
|
||||||
var unique_cards: Array[Card] = []
|
var unique_cards: Array[Card] = []
|
||||||
var hand_card_scene: PackedScene = preload("res://Scenes/UI/card_hand.tscn")
|
var hand_card_scene: PackedScene = preload("res://Scenes/UI/card_hand.tscn")
|
||||||
@@ -53,7 +54,6 @@ var weapons: Array[Weapon] = [null, null]
|
|||||||
var cards: Array[Card] = [null, null]
|
var cards: Array[Card] = [null, null]
|
||||||
var weapons_active: bool = false
|
var weapons_active: bool = false
|
||||||
var paused: bool = false
|
var paused: bool = false
|
||||||
var editing_mode: bool = true
|
|
||||||
var profile: PlayerProfile
|
var profile: PlayerProfile
|
||||||
var ready_state: bool = false :
|
var ready_state: bool = false :
|
||||||
set(value):
|
set(value):
|
||||||
@@ -84,13 +84,9 @@ func set_zoom_factor(value: float) -> void:
|
|||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
if is_multiplayer_authority():
|
if is_multiplayer_authority():
|
||||||
#right_hand_animator.play("weapon_sway")
|
|
||||||
#right_hand_animator.speed_scale = 0
|
|
||||||
ears.make_current()
|
ears.make_current()
|
||||||
camera.make_current()
|
camera.make_current()
|
||||||
sprite.queue_free()
|
sprite.queue_free()
|
||||||
hand.max_size = 5
|
|
||||||
#hand_sprite.texture = hero_class.hand_texture
|
|
||||||
player_name_tag.queue_free()
|
player_name_tag.queue_free()
|
||||||
for card: Card in hero_class.deck:
|
for card: Card in hero_class.deck:
|
||||||
draw_pile.add(card)
|
draw_pile.add(card)
|
||||||
@@ -98,22 +94,66 @@ func _ready() -> void:
|
|||||||
camera.set_visible(false)
|
camera.set_visible(false)
|
||||||
gun_camera.set_visible(false)
|
gun_camera.set_visible(false)
|
||||||
hud.set_visible(false)
|
hud.set_visible(false)
|
||||||
|
|
||||||
|
for state: HeroState in editing_states:
|
||||||
|
state.state_changed.connect(update_state)
|
||||||
|
fighting_state.state_changed.connect(update_state)
|
||||||
|
current_state = default_state
|
||||||
|
current_state.enter_state()
|
||||||
|
|
||||||
if weapons[equipped_weapon] != null:
|
if weapons[equipped_weapon] != null:
|
||||||
weapons[equipped_weapon].set_raycast_origin(camera)
|
weapons[equipped_weapon].set_raycast_origin(camera)
|
||||||
sprite.texture.atlas = hero_class.texture
|
sprite.texture.atlas = hero_class.texture
|
||||||
check_left_hand_valid()
|
|
||||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||||
|
|
||||||
|
|
||||||
|
func update_state(new_state: HeroState) -> void:
|
||||||
|
current_state.exit_state()
|
||||||
|
current_state = new_state
|
||||||
|
current_state.enter_state()
|
||||||
|
|
||||||
|
|
||||||
|
func enter_fighting_state() -> void:
|
||||||
|
pre_fighting_state = current_state
|
||||||
|
update_state(fighting_state)
|
||||||
|
|
||||||
|
|
||||||
|
func exit_fighting_state() -> void:
|
||||||
|
update_state(pre_fighting_state)
|
||||||
|
|
||||||
|
|
||||||
|
func add_selection(card: Card) -> void:
|
||||||
|
if !unique_cards.has(card):
|
||||||
|
unique_cards.append(card)
|
||||||
|
var box: CardSelectionBox = card_select_scene.instantiate()
|
||||||
|
box.set_card(card)
|
||||||
|
box.set_key(unique_cards.size() - 1)
|
||||||
|
selection_boxes.append(box)
|
||||||
|
$HUD/selection_boxes.add_child(box)
|
||||||
|
|
||||||
|
|
||||||
|
func check_removal() -> void:
|
||||||
|
var index: int = -1
|
||||||
|
for card: Card in unique_cards:
|
||||||
|
if !hand.contents.has(card):
|
||||||
|
index = unique_cards.find(card)
|
||||||
|
if index >= 0:
|
||||||
|
unique_cards.remove_at(index)
|
||||||
|
selection_boxes[index].queue_free()
|
||||||
|
selection_boxes.remove_at(index)
|
||||||
|
if selection_boxes.size() > 0:
|
||||||
|
for i: int in selection_boxes.size():
|
||||||
|
var card: Card = unique_cards[i]
|
||||||
|
selection_boxes[i].set_card(card)
|
||||||
|
selection_boxes[i].set_key(i)
|
||||||
|
if hand_selected_index == index:
|
||||||
|
decrement_selected()
|
||||||
|
update_selected_box()
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(_delta: float) -> void:
|
func _physics_process(_delta: float) -> void:
|
||||||
if !is_multiplayer_authority() or paused:
|
if !is_multiplayer_authority() or paused:
|
||||||
return
|
return
|
||||||
#if movement.input_vector == Vector2.ZERO:
|
|
||||||
#right_hand_animator.speed_scale = 0
|
|
||||||
#elif movement.sprinting:
|
|
||||||
#right_hand_animator.speed_scale = 1
|
|
||||||
#else:
|
|
||||||
#right_hand_animator.speed_scale = 0.6
|
|
||||||
|
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
@@ -124,7 +164,23 @@ func _process(delta: float) -> void:
|
|||||||
if movement.zoom_factor > 1.0:
|
if movement.zoom_factor > 1.0:
|
||||||
movement.zoom_factor = 1.0
|
movement.zoom_factor = 1.0
|
||||||
|
|
||||||
if editing_mode:
|
current_state.process_state(delta)
|
||||||
|
|
||||||
|
if movement.sprinting:
|
||||||
|
movement.zoom_factor -= sprint_zoom_speed * delta
|
||||||
|
if movement.zoom_factor <= 1.0 - movement.sprint_zoom_factor:
|
||||||
|
movement.zoom_factor = 1.0 - movement.sprint_zoom_factor
|
||||||
|
camera.fov = Data.graphics.hfov * (1.0 / movement.zoom_factor)
|
||||||
|
|
||||||
|
if Input.is_action_just_pressed("View Map"):
|
||||||
|
hud.maximise_minimap()
|
||||||
|
#Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||||
|
if Input.is_action_just_released("View Map"):
|
||||||
|
hud.minimize_minimap()
|
||||||
|
#Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||||
|
|
||||||
|
|
||||||
|
func check_world_button() -> void:
|
||||||
if interaction_raycast.is_colliding() and interaction_raycast.get_collider() is InteractButton:
|
if interaction_raycast.is_colliding() and interaction_raycast.get_collider() is InteractButton:
|
||||||
hud.set_hover_text(interaction_raycast.get_collider().hover_text)
|
hud.set_hover_text(interaction_raycast.get_collider().hover_text)
|
||||||
if !hovering_item or hovering_item != interaction_raycast.get_collider():
|
if !hovering_item or hovering_item != interaction_raycast.get_collider():
|
||||||
@@ -139,107 +195,11 @@ func _process(delta: float) -> void:
|
|||||||
hovering_item = null
|
hovering_item = null
|
||||||
|
|
||||||
if Input.is_action_just_pressed("Interact"):
|
if Input.is_action_just_pressed("Interact"):
|
||||||
edit_tool.interact()
|
|
||||||
if interaction_raycast.get_collider() is InteractButton:
|
if interaction_raycast.get_collider() is InteractButton:
|
||||||
var button: InteractButton = interaction_raycast.get_collider() as InteractButton
|
var button: InteractButton = interaction_raycast.get_collider() as InteractButton
|
||||||
button.press(self)
|
button.press(self)
|
||||||
if interaction_raycast.get_collider() is ItemCard:
|
if interaction_raycast.get_collider() is ItemCard:
|
||||||
add_card(interaction_raycast.get_collider().pick_up())
|
add_card(interaction_raycast.get_collider().pick_up())
|
||||||
if building_mode:
|
|
||||||
if Input.is_action_just_pressed("Primary Fire"):
|
|
||||||
edit_tool.interact_key_held = true
|
|
||||||
if Input.is_action_just_released("Primary Fire"):
|
|
||||||
edit_tool.interact_key_held = false
|
|
||||||
if Input.is_action_just_pressed("Swap Weapons"):
|
|
||||||
edit_tool.interact_key_held = false
|
|
||||||
building_mode = false
|
|
||||||
$FirstPersonViewport/Head2/LeftHand.visible = true
|
|
||||||
$HUD/selection_boxes.visible = true
|
|
||||||
$HUD/PlaceIcon.visible = true
|
|
||||||
$HUD/SwapIcon.visible = true
|
|
||||||
else:
|
|
||||||
if Input.is_action_just_pressed("Primary Fire"):
|
|
||||||
equip_weapon(0)
|
|
||||||
if Input.is_action_just_pressed("Secondary Fire"):
|
|
||||||
equip_weapon(1)
|
|
||||||
if Input.is_action_just_pressed("Select Next Card") and hand.size > 1:
|
|
||||||
increment_selected()
|
|
||||||
swap_card_audio.play()
|
|
||||||
if Input.is_action_just_pressed("Select Previous Card") and hand.size > 1:
|
|
||||||
decrement_selected()
|
|
||||||
swap_card_audio.play()
|
|
||||||
if Input.is_action_just_pressed("Select 1st Card"):
|
|
||||||
if unique_cards.size() >= 1:
|
|
||||||
hand_selected_index = 0
|
|
||||||
swap_card_audio.play()
|
|
||||||
update_selected_box()
|
|
||||||
if Input.is_action_just_pressed("Select 2nd Card"):
|
|
||||||
if unique_cards.size() >= 2:
|
|
||||||
hand_selected_index = 1
|
|
||||||
swap_card_audio.play()
|
|
||||||
update_selected_box()
|
|
||||||
if Input.is_action_just_pressed("Select 3rd Card"):
|
|
||||||
if unique_cards.size() >= 3:
|
|
||||||
hand_selected_index = 2
|
|
||||||
swap_card_audio.play()
|
|
||||||
update_selected_box()
|
|
||||||
if Input.is_action_just_pressed("Select 4th Card"):
|
|
||||||
if unique_cards.size() >= 4:
|
|
||||||
hand_selected_index = 3
|
|
||||||
swap_card_audio.play()
|
|
||||||
update_selected_box()
|
|
||||||
if Input.is_action_just_pressed("Select 5th Card"):
|
|
||||||
if unique_cards.size() >= 5:
|
|
||||||
hand_selected_index = 4
|
|
||||||
swap_card_audio.play()
|
|
||||||
update_selected_box()
|
|
||||||
if Input.is_action_just_pressed("Swap Weapons"):
|
|
||||||
building_mode = true
|
|
||||||
$FirstPersonViewport/Head2/LeftHand.visible = false
|
|
||||||
$HUD/selection_boxes.visible = false
|
|
||||||
$HUD/PlaceIcon.visible = false
|
|
||||||
$HUD/SwapIcon.visible = false
|
|
||||||
|
|
||||||
if weapons[equipped_weapon] != null:
|
|
||||||
weapons[equipped_weapon].release_trigger()
|
|
||||||
weapons[equipped_weapon].release_second_trigger()
|
|
||||||
else:
|
|
||||||
if weapons[equipped_weapon] and weapons_active:
|
|
||||||
if Input.is_action_just_pressed("Primary Fire"):
|
|
||||||
weapons[equipped_weapon].hold_trigger()
|
|
||||||
if Input.is_action_just_released("Primary Fire"):
|
|
||||||
weapons[equipped_weapon].release_trigger()
|
|
||||||
if Input.is_action_pressed("Secondary Fire"):
|
|
||||||
weapons[equipped_weapon].hold_second_trigger()
|
|
||||||
if Input.is_action_just_released("Secondary Fire"):
|
|
||||||
weapons[equipped_weapon].release_second_trigger()
|
|
||||||
if Input.is_action_pressed("Primary Fire"):
|
|
||||||
movement.can_sprint = false
|
|
||||||
if Input.is_action_pressed("Secondary Fire"):
|
|
||||||
movement.can_sprint = false
|
|
||||||
if Input.is_action_just_pressed("Equip Primary Weapon"):
|
|
||||||
if equipped_weapon == 1 and weapons[0]:
|
|
||||||
swap_weapons()
|
|
||||||
if Input.is_action_just_pressed("Equip Secondary Weapon"):
|
|
||||||
if equipped_weapon == 0 and weapons[1]:
|
|
||||||
swap_weapons()
|
|
||||||
if Input.is_action_just_pressed("Swap Weapons"):
|
|
||||||
if weapons[0] and weapons[1]:
|
|
||||||
swap_weapons()
|
|
||||||
|
|
||||||
if movement.sprinting:
|
|
||||||
movement.zoom_factor -= sprint_zoom_speed * delta
|
|
||||||
if movement.zoom_factor <= 1.0 - movement.sprint_zoom_factor:
|
|
||||||
movement.zoom_factor = 1.0 - movement.sprint_zoom_factor
|
|
||||||
camera.fov = Data.graphics.hfov * (1.0 / movement.zoom_factor)
|
|
||||||
|
|
||||||
if Input.is_action_just_pressed("View Map"):
|
|
||||||
hud.maximise_minimap()
|
|
||||||
#Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
|
||||||
if Input.is_action_just_released("View Map"):
|
|
||||||
hud.minimize_minimap()
|
|
||||||
#Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
|
||||||
check_left_hand_valid()
|
|
||||||
|
|
||||||
|
|
||||||
func increment_selected() -> void:
|
func increment_selected() -> void:
|
||||||
@@ -259,14 +219,20 @@ func decrement_selected() -> void:
|
|||||||
update_selected_box()
|
update_selected_box()
|
||||||
|
|
||||||
|
|
||||||
|
func set_card_elements_visibility(value: bool) -> void:
|
||||||
|
$FirstPersonViewport/Head2/LeftHand.visible = value
|
||||||
|
$HUD/selection_boxes.visible = value
|
||||||
|
$HUD/PlaceIcon.visible = value
|
||||||
|
$HUD/SwapIcon.visible = value
|
||||||
|
if cards[0]:
|
||||||
|
$HUD/PlaceIcon.visible = false
|
||||||
|
if cards[1]:
|
||||||
|
$HUD/SwapIcon.visible = false
|
||||||
|
|
||||||
|
|
||||||
func _unhandled_input(event: InputEvent) -> void:
|
func _unhandled_input(event: InputEvent) -> void:
|
||||||
if !is_multiplayer_authority() or paused:
|
if !is_multiplayer_authority() or paused:
|
||||||
return
|
return
|
||||||
if editing_mode and event.is_action_pressed("Ready"):
|
|
||||||
if ready_state:
|
|
||||||
unready_self()
|
|
||||||
else:
|
|
||||||
ready_self()
|
|
||||||
if event.is_action_pressed("Pause"):
|
if event.is_action_pressed("Pause"):
|
||||||
var menu: PauseMenu = pause_menu_scene.instantiate() as PauseMenu
|
var menu: PauseMenu = pause_menu_scene.instantiate() as PauseMenu
|
||||||
pause()
|
pause()
|
||||||
@@ -297,9 +263,10 @@ func unready_self() -> void:
|
|||||||
|
|
||||||
|
|
||||||
func add_card(new_card: Card) -> void:
|
func add_card(new_card: Card) -> void:
|
||||||
hand.append(new_card)
|
hand.add(new_card)
|
||||||
hud.pickup(new_card)
|
hud.pickup(new_card)
|
||||||
place_card_audio.play()
|
place_card_audio.play()
|
||||||
|
add_selection(new_card)
|
||||||
|
|
||||||
|
|
||||||
func unpause() -> void:
|
func unpause() -> void:
|
||||||
@@ -314,78 +281,6 @@ func pause() -> void:
|
|||||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||||
|
|
||||||
|
|
||||||
func enter_editing_mode(value: int) -> void:
|
|
||||||
gauntlet_sprite.visible = true
|
|
||||||
weapons_active = false
|
|
||||||
hud.set_wave_count(value + 1)
|
|
||||||
hud.set_energy_visible(false)
|
|
||||||
hud.grow_wave_start_label()
|
|
||||||
$HUD/selection_boxes.visible = true
|
|
||||||
$HUD/EnergyLabel.visible = true
|
|
||||||
$HUD/weapon_duration.visible = true
|
|
||||||
$HUD/weapon_duration2.visible = true
|
|
||||||
editing_mode = true
|
|
||||||
edit_tool.enabled = true
|
|
||||||
left_hand.visible = true
|
|
||||||
if weapons[equipped_weapon]:
|
|
||||||
weapons[equipped_weapon].release_trigger()
|
|
||||||
weapons[equipped_weapon].visible = false
|
|
||||||
|
|
||||||
|
|
||||||
func exit_editing_mode(value: int) -> void:
|
|
||||||
gauntlet_sprite.visible = false
|
|
||||||
$HUD/selection_boxes.visible = false
|
|
||||||
$HUD/EnergyLabel.visible = false
|
|
||||||
$HUD/weapon_duration.visible = false
|
|
||||||
$HUD/weapon_duration2.visible = false
|
|
||||||
weapons_active = false
|
|
||||||
hud.set_wave_count(value)
|
|
||||||
var offhand_weapon: Weapon = weapons[0] if equipped_weapon == 1 else weapons[1]
|
|
||||||
if offhand_weapon:
|
|
||||||
offhand_weapon.current_energy = offhand_weapon.max_energy
|
|
||||||
if (!weapons[equipped_weapon] and offhand_weapon) or (weapons[0] and equipped_weapon == 1):
|
|
||||||
swap_weapons()
|
|
||||||
if weapons[equipped_weapon]:
|
|
||||||
hud.set_energy_visible(true)
|
|
||||||
weapons[equipped_weapon].current_energy = weapons[equipped_weapon].max_energy
|
|
||||||
#this had to be commented out coz the new energy bar thinks "energy changed" is "energy used"
|
|
||||||
#weapons[equipped_weapon].energy_changed.emit(weapons[equipped_weapon].current_energy)
|
|
||||||
edit_tool.enabled = false
|
|
||||||
edit_tool.delete_tower_preview()
|
|
||||||
left_hand.visible = false
|
|
||||||
hud.unset_hover_text()
|
|
||||||
editing_mode = false
|
|
||||||
weapon_swap_timer.start()
|
|
||||||
|
|
||||||
|
|
||||||
func check_left_hand_valid() -> void:
|
|
||||||
if !editing_mode:
|
|
||||||
return
|
|
||||||
if hand.size == 0:
|
|
||||||
left_hand_sprite.visible = false
|
|
||||||
else:
|
|
||||||
left_hand_sprite.visible = true
|
|
||||||
update_selected_box()
|
|
||||||
|
|
||||||
|
|
||||||
func check_removal() -> void:
|
|
||||||
var index: int = -1
|
|
||||||
for card: Card in unique_cards:
|
|
||||||
if !hand.contents.has(card):
|
|
||||||
index = unique_cards.find(card)
|
|
||||||
if index >= 0:
|
|
||||||
unique_cards.remove_at(index)
|
|
||||||
selection_boxes[index].queue_free()
|
|
||||||
selection_boxes.remove_at(index)
|
|
||||||
for i: int in selection_boxes.size():
|
|
||||||
var card: Card = unique_cards[i]
|
|
||||||
selection_boxes[i].set_card(card)
|
|
||||||
selection_boxes[i].set_key(i)
|
|
||||||
if hand_selected_index == index:
|
|
||||||
decrement_selected()
|
|
||||||
update_selected_box()
|
|
||||||
|
|
||||||
|
|
||||||
func iterate_duration() -> void:
|
func iterate_duration() -> void:
|
||||||
for slot: int in weapons.size():
|
for slot: int in weapons.size():
|
||||||
if weapons[slot] == null:
|
if weapons[slot] == null:
|
||||||
@@ -400,7 +295,8 @@ func iterate_duration() -> void:
|
|||||||
|
|
||||||
|
|
||||||
func draw_to_hand_size() -> void:
|
func draw_to_hand_size() -> void:
|
||||||
while hand.size < hand.max_size:
|
var hand_size: int = 5
|
||||||
|
while hand.size < hand_size:
|
||||||
if draw_pile.size == 0 and discard_pile.size == 0:
|
if draw_pile.size == 0 and discard_pile.size == 0:
|
||||||
return
|
return
|
||||||
if draw_pile.size > 0:
|
if draw_pile.size > 0:
|
||||||
@@ -444,6 +340,8 @@ func update_selected_box() -> void:
|
|||||||
|
|
||||||
|
|
||||||
func equip_weapon(slot: int = 0) -> void:
|
func equip_weapon(slot: int = 0) -> void:
|
||||||
|
if hand.size == 0:
|
||||||
|
return
|
||||||
var energy_cost: int = int(hand.item_at(hand_selected_index).rarity) + 1
|
var energy_cost: int = int(hand.item_at(hand_selected_index).rarity) + 1
|
||||||
energy_cost *= 2
|
energy_cost *= 2
|
||||||
if energy < energy_cost:
|
if energy < energy_cost:
|
||||||
@@ -481,7 +379,6 @@ func equip_weapon(slot: int = 0) -> void:
|
|||||||
weapons[slot].visible = false
|
weapons[slot].visible = false
|
||||||
right_hand.add_child(weapons[slot])
|
right_hand.add_child(weapons[slot])
|
||||||
check_removal()
|
check_removal()
|
||||||
check_left_hand_valid()
|
|
||||||
if slot == 0:
|
if slot == 0:
|
||||||
weapons[slot].energy_spent.connect(hud.new_energy_bar.use_energy)
|
weapons[slot].energy_spent.connect(hud.new_energy_bar.use_energy)
|
||||||
weapons[slot].energy_recharged.connect(hud.new_energy_bar.gain_energy)
|
weapons[slot].energy_recharged.connect(hud.new_energy_bar.gain_energy)
|
||||||
@@ -489,7 +386,7 @@ func equip_weapon(slot: int = 0) -> void:
|
|||||||
if weapons[slot].stats.energy_type == Data.EnergyType.CONTINUOUS:
|
if weapons[slot].stats.energy_type == Data.EnergyType.CONTINUOUS:
|
||||||
hud.new_energy_bar.enable_progress_bar()
|
hud.new_energy_bar.enable_progress_bar()
|
||||||
if weapons[slot].stats.energy_type == Data.EnergyType.DISCRETE:
|
if weapons[slot].stats.energy_type == Data.EnergyType.DISCRETE:
|
||||||
hud.new_energy_bar.create_discrete_icons(weapons[slot].max_energy)
|
hud.new_energy_bar.create_discrete_icons(int(weapons[slot].max_energy))
|
||||||
else:
|
else:
|
||||||
weapons[slot].energy_recharged.connect(hud.new_energy_bar.gain_secondary_energy)
|
weapons[slot].energy_recharged.connect(hud.new_energy_bar.gain_secondary_energy)
|
||||||
hud.new_energy_bar.secondary_max_energy = weapons[slot].max_energy
|
hud.new_energy_bar.secondary_max_energy = weapons[slot].max_energy
|
||||||
@@ -513,12 +410,12 @@ func show_weapon(slot: int = 0) -> void:
|
|||||||
weapons[slot].energy_recharged.disconnect(hud.new_energy_bar.gain_secondary_energy)
|
weapons[slot].energy_recharged.disconnect(hud.new_energy_bar.gain_secondary_energy)
|
||||||
weapons[slot].energy_spent.connect(hud.new_energy_bar.use_energy)
|
weapons[slot].energy_spent.connect(hud.new_energy_bar.use_energy)
|
||||||
weapons[slot].energy_recharged.connect(hud.new_energy_bar.gain_energy)
|
weapons[slot].energy_recharged.connect(hud.new_energy_bar.gain_energy)
|
||||||
hud.set_weapon_energy(weapons[slot].current_energy, weapons[slot].stats.energy_type)
|
hud.set_weapon_energy(int(weapons[slot].current_energy), weapons[slot].stats.energy_type)
|
||||||
hud.new_energy_bar.max_energy = weapons[slot].max_energy
|
hud.new_energy_bar.max_energy = weapons[slot].max_energy
|
||||||
if weapons[slot].stats.energy_type == Data.EnergyType.CONTINUOUS:
|
if weapons[slot].stats.energy_type == Data.EnergyType.CONTINUOUS:
|
||||||
hud.new_energy_bar.enable_progress_bar()
|
hud.new_energy_bar.enable_progress_bar()
|
||||||
if weapons[slot].stats.energy_type == Data.EnergyType.DISCRETE:
|
if weapons[slot].stats.energy_type == Data.EnergyType.DISCRETE:
|
||||||
hud.new_energy_bar.create_discrete_icons(weapons[slot].max_energy)
|
hud.new_energy_bar.create_discrete_icons(int(weapons[slot].max_energy))
|
||||||
hud.new_energy_bar.use_energy(weapons[slot].max_energy - weapons[slot].current_energy, weapons[slot].stats.energy_type)
|
hud.new_energy_bar.use_energy(weapons[slot].max_energy - weapons[slot].current_energy, weapons[slot].stats.energy_type)
|
||||||
var offhand: int = 0 if equipped_weapon == 1 else 1
|
var offhand: int = 0 if equipped_weapon == 1 else 1
|
||||||
if !weapons[offhand]:
|
if !weapons[offhand]:
|
||||||
@@ -530,7 +427,6 @@ func swap_weapons() -> void:
|
|||||||
return
|
return
|
||||||
weapons_active = false
|
weapons_active = false
|
||||||
swap_off_audio.play()
|
swap_off_audio.play()
|
||||||
hud.audio_guard = true
|
|
||||||
if weapons[equipped_weapon]:
|
if weapons[equipped_weapon]:
|
||||||
stow_weapon(equipped_weapon)
|
stow_weapon(equipped_weapon)
|
||||||
equipped_weapon = 0 if equipped_weapon == 1 else 1
|
equipped_weapon = 0 if equipped_weapon == 1 else 1
|
||||||
@@ -558,7 +454,6 @@ func unequip_weapon(slot: int = 0) -> void:
|
|||||||
weapons[slot] = null
|
weapons[slot] = null
|
||||||
cards[slot] = null
|
cards[slot] = null
|
||||||
place_card_audio.play()
|
place_card_audio.play()
|
||||||
check_left_hand_valid()
|
|
||||||
|
|
||||||
|
|
||||||
#MULTIPLAYER NETWORKED FUNCTIONS
|
#MULTIPLAYER NETWORKED FUNCTIONS
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
[gd_scene load_steps=62 format=3 uid="uid://dxgxbtf68lcv5"]
|
[gd_scene load_steps=64 format=3 uid="uid://dxgxbtf68lcv5"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://1fqpoegbdm6n" path="res://PCs/hero.gd" id="1_pihpe"]
|
[ext_resource type="Script" uid="uid://1fqpoegbdm6n" path="res://PCs/hero.gd" id="1_pihpe"]
|
||||||
[ext_resource type="Resource" uid="uid://b5pc3frhx467q" path="res://Classes/Engineer/class.tres" id="2_dbyo0"]
|
[ext_resource type="Resource" uid="uid://b5pc3frhx467q" path="res://Classes/Engineer/class.tres" id="2_dbyo0"]
|
||||||
[ext_resource type="PackedScene" uid="uid://ri8r03wqy80t" path="res://Scenes/8_direction_sprite.tscn" id="2_ib0t5"]
|
[ext_resource type="PackedScene" uid="uid://ri8r03wqy80t" path="res://Scenes/8_direction_sprite.tscn" id="2_ib0t5"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dkbkam81k355s" path="res://Assets/TextureAtlases/gauntlet.tres" id="3_5myy0"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://buvgdem68wtev" path="res://Scenes/Menus/PauseMenu/pause_menu.tscn" id="3_avnsx"]
|
[ext_resource type="PackedScene" uid="uid://buvgdem68wtev" path="res://Scenes/Menus/PauseMenu/pause_menu.tscn" id="3_avnsx"]
|
||||||
[ext_resource type="PackedScene" uid="uid://n8ab1cy7ordc" path="res://card_model/3d_card.tscn" id="4_2mqvj"]
|
[ext_resource type="PackedScene" uid="uid://n8ab1cy7ordc" path="res://card_model/3d_card.tscn" id="4_2mqvj"]
|
||||||
[ext_resource type="Script" uid="uid://cij76at0nbs1v" path="res://PCs/view_movement.gd" id="4_mhexa"]
|
[ext_resource type="Script" uid="uid://cij76at0nbs1v" path="res://PCs/view_movement.gd" id="4_mhexa"]
|
||||||
@@ -13,6 +12,7 @@
|
|||||||
[ext_resource type="Script" uid="uid://do24iuot0j7d7" path="res://Scripts/inventory.gd" id="6_cf5ap"]
|
[ext_resource type="Script" uid="uid://do24iuot0j7d7" path="res://Scripts/inventory.gd" id="6_cf5ap"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cjqxkraykhxxk" path="res://Classes/Engineer/red.png" id="6_yyp8i"]
|
[ext_resource type="Texture2D" uid="uid://cjqxkraykhxxk" path="res://Classes/Engineer/red.png" id="6_yyp8i"]
|
||||||
[ext_resource type="Script" uid="uid://3wvxl8jo4uis" path="res://PCs/weapon_movement.gd" id="7_14ugt"]
|
[ext_resource type="Script" uid="uid://3wvxl8jo4uis" path="res://PCs/weapon_movement.gd" id="7_14ugt"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bj2q72ch8nkek" path="res://card_placing_tool.tscn" id="8_7d213"]
|
||||||
[ext_resource type="Script" uid="uid://b6kjrl7ae1mi0" path="res://PCs/hud.gd" id="8_yl6ka"]
|
[ext_resource type="Script" uid="uid://b6kjrl7ae1mi0" path="res://PCs/hud.gd" id="8_yl6ka"]
|
||||||
[ext_resource type="Script" uid="uid://hy51bq7x0fy8" path="res://Scripts/on_top_camera.gd" id="11_4sdwe"]
|
[ext_resource type="Script" uid="uid://hy51bq7x0fy8" path="res://Scripts/on_top_camera.gd" id="11_4sdwe"]
|
||||||
[ext_resource type="PackedScene" uid="uid://ckl5tw5rmewhp" path="res://left_hand/card_hand_model.glb" id="11_h82f6"]
|
[ext_resource type="PackedScene" uid="uid://ckl5tw5rmewhp" path="res://left_hand/card_hand_model.glb" id="11_h82f6"]
|
||||||
@@ -47,14 +47,14 @@
|
|||||||
[ext_resource type="AudioStream" uid="uid://datdq1i45080i" path="res://Audio/open_002.wav" id="37_sa2xu"]
|
[ext_resource type="AudioStream" uid="uid://datdq1i45080i" path="res://Audio/open_002.wav" id="37_sa2xu"]
|
||||||
[ext_resource type="AudioStream" uid="uid://dd1w61ri7ui4i" path="res://Audio/phaserDown3.ogg" id="40_pnv0q"]
|
[ext_resource type="AudioStream" uid="uid://dd1w61ri7ui4i" path="res://Audio/phaserDown3.ogg" id="40_pnv0q"]
|
||||||
[ext_resource type="AudioStream" uid="uid://bll3n3pr8s4yy" path="res://Audio/phaserUp3.ogg" id="41_hussy"]
|
[ext_resource type="AudioStream" uid="uid://bll3n3pr8s4yy" path="res://Audio/phaserUp3.ogg" id="41_hussy"]
|
||||||
|
[ext_resource type="Script" uid="uid://b5h7jfwkyokes" path="res://PCs/FSM/building_state.gd" id="47_d8pnf"]
|
||||||
|
[ext_resource type="Script" uid="uid://cjdv1onyfej0m" path="res://PCs/FSM/carding_state.gd" id="48_7d213"]
|
||||||
|
[ext_resource type="Script" uid="uid://cf7m4yyiqhhru" path="res://PCs/FSM/fighting_state.gd" id="49_60hic"]
|
||||||
|
|
||||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_jbu13"]
|
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_jbu13"]
|
||||||
radius = 0.3
|
radius = 0.3
|
||||||
height = 1.8
|
height = 1.8
|
||||||
|
|
||||||
[sub_resource type="ViewportTexture" id="ViewportTexture_8f12g"]
|
|
||||||
viewport_path = NodePath("FirstPersonViewport/Head2/LeftHand/SubViewport")
|
|
||||||
|
|
||||||
[sub_resource type="ViewportTexture" id="ViewportTexture_v8f6r"]
|
[sub_resource type="ViewportTexture" id="ViewportTexture_v8f6r"]
|
||||||
viewport_path = NodePath("FirstPersonViewport/Head2/LeftHand/SubViewport2")
|
viewport_path = NodePath("FirstPersonViewport/Head2/LeftHand/SubViewport2")
|
||||||
|
|
||||||
@@ -113,18 +113,17 @@ stream_0/stream = ExtResource("36_lsvj8")
|
|||||||
streams_count = 1
|
streams_count = 1
|
||||||
stream_0/stream = ExtResource("37_kv1mg")
|
stream_0/stream = ExtResource("37_kv1mg")
|
||||||
|
|
||||||
[node name="Hero" type="CharacterBody3D" node_paths=PackedStringArray("camera", "gun_camera", "left_hand_sprite", "left_hand", "right_hand", "edit_tool", "gauntlet_sprite", "sprite", "interaction_raycast", "draw_pile", "hand", "discard_pile", "gauntlet_cards", "hud", "movement", "player_name_tag", "weapon_swap_timer", "ears", "place_card_audio", "swap_card_audio", "ready_audio", "unready_audio", "fullpower_audio", "zeropower_audio", "swap_off_audio", "swap_on_audio")]
|
[node name="Hero" type="CharacterBody3D" node_paths=PackedStringArray("camera", "gun_camera", "left_hand", "right_hand", "edit_tool", "carding_tool", "sprite", "interaction_raycast", "draw_pile", "hand", "discard_pile", "gauntlet_cards", "hud", "movement", "player_name_tag", "weapon_swap_timer", "editing_states", "fighting_state", "default_state", "ears", "place_card_audio", "swap_card_audio", "ready_audio", "unready_audio", "fullpower_audio", "zeropower_audio", "swap_off_audio", "swap_on_audio")]
|
||||||
collision_layer = 2
|
collision_layer = 2
|
||||||
collision_mask = 37
|
collision_mask = 37
|
||||||
script = ExtResource("1_pihpe")
|
script = ExtResource("1_pihpe")
|
||||||
hero_class = ExtResource("2_dbyo0")
|
hero_class = ExtResource("2_dbyo0")
|
||||||
camera = NodePath("ViewMovement/Head")
|
camera = NodePath("ViewMovement/Head")
|
||||||
gun_camera = NodePath("FirstPersonViewport/Head2")
|
gun_camera = NodePath("FirstPersonViewport/Head2")
|
||||||
left_hand_sprite = NodePath("FirstPersonViewport/Head2/LeftHand/Sprite3D")
|
|
||||||
left_hand = NodePath("FirstPersonViewport/Head2/LeftHand")
|
left_hand = NodePath("FirstPersonViewport/Head2/LeftHand")
|
||||||
right_hand = NodePath("FirstPersonViewport/Head2/RightHand")
|
right_hand = NodePath("FirstPersonViewport/Head2/RightHand")
|
||||||
edit_tool = NodePath("ViewMovement/Head/EditTool")
|
edit_tool = NodePath("ViewMovement/Head/EditTool")
|
||||||
gauntlet_sprite = NodePath("FirstPersonViewport/Head2/RightHand/Gauntlet")
|
carding_tool = NodePath("ViewMovement/Head/CardPlacingTool")
|
||||||
sprite = NodePath("EightDirectionSprite")
|
sprite = NodePath("EightDirectionSprite")
|
||||||
interaction_raycast = NodePath("ViewMovement/Head/RayCast3D")
|
interaction_raycast = NodePath("ViewMovement/Head/RayCast3D")
|
||||||
draw_pile = NodePath("DrawPile")
|
draw_pile = NodePath("DrawPile")
|
||||||
@@ -138,6 +137,9 @@ player_name_tag = NodePath("NametagViewport/Label")
|
|||||||
weapon_swap_timer = NodePath("WeaponSwapTimer")
|
weapon_swap_timer = NodePath("WeaponSwapTimer")
|
||||||
card3d_scene = ExtResource("4_2mqvj")
|
card3d_scene = ExtResource("4_2mqvj")
|
||||||
card_select_scene = ExtResource("5_h82f6")
|
card_select_scene = ExtResource("5_h82f6")
|
||||||
|
editing_states = [NodePath("BuildingState"), NodePath("CardingState")]
|
||||||
|
fighting_state = NodePath("FightingState")
|
||||||
|
default_state = NodePath("BuildingState")
|
||||||
ears = NodePath("AudioListener3D")
|
ears = NodePath("AudioListener3D")
|
||||||
place_card_audio = NodePath("PlaceCardAudio")
|
place_card_audio = NodePath("PlaceCardAudio")
|
||||||
swap_card_audio = NodePath("SwapCardAudio")
|
swap_card_audio = NodePath("SwapCardAudio")
|
||||||
@@ -162,7 +164,7 @@ player = NodePath("..")
|
|||||||
camera = NodePath("Head")
|
camera = NodePath("Head")
|
||||||
focus_raycast = NodePath("Head/RayCast3D")
|
focus_raycast = NodePath("Head/RayCast3D")
|
||||||
enable_strafe_tilt = true
|
enable_strafe_tilt = true
|
||||||
tilt_amount_x = 0.7
|
tilt_amount_x = 0.8
|
||||||
|
|
||||||
[node name="Head" type="Camera3D" parent="ViewMovement"]
|
[node name="Head" type="Camera3D" parent="ViewMovement"]
|
||||||
keep_aspect = 0
|
keep_aspect = 0
|
||||||
@@ -176,6 +178,9 @@ hero = NodePath("../../..")
|
|||||||
target_position = Vector3(0, 0, -2)
|
target_position = Vector3(0, 0, -2)
|
||||||
collision_mask = 24
|
collision_mask = 24
|
||||||
|
|
||||||
|
[node name="CardPlacingTool" parent="ViewMovement/Head" node_paths=PackedStringArray("hero") instance=ExtResource("8_7d213")]
|
||||||
|
hero = NodePath("../../..")
|
||||||
|
|
||||||
[node name="RayCast3D" type="RayCast3D" parent="ViewMovement"]
|
[node name="RayCast3D" type="RayCast3D" parent="ViewMovement"]
|
||||||
target_position = Vector3(0, 0, -100)
|
target_position = Vector3(0, 0, -100)
|
||||||
collision_mask = 65535
|
collision_mask = 65535
|
||||||
@@ -200,12 +205,6 @@ tilt_amount_x = 12.0
|
|||||||
tilt_amount_y = 3.0
|
tilt_amount_y = 3.0
|
||||||
weapon_rotation_amount = 0.001
|
weapon_rotation_amount = 0.001
|
||||||
|
|
||||||
[node name="Gauntlet" type="Sprite3D" parent="FirstPersonViewport/Head2/RightHand"]
|
|
||||||
visible = false
|
|
||||||
layers = 2
|
|
||||||
texture_filter = 0
|
|
||||||
texture = ExtResource("3_5myy0")
|
|
||||||
|
|
||||||
[node name="LeftHand" type="Node3D" parent="FirstPersonViewport/Head2"]
|
[node name="LeftHand" type="Node3D" parent="FirstPersonViewport/Head2"]
|
||||||
transform = Transform3D(0.235, 0, 0, 0, 0.235, 0, 0, 0, 0.235, -0.645, -0.26, -1.04)
|
transform = Transform3D(0.235, 0, 0, 0, 0.235, 0, 0, 0, 0.235, -0.645, -0.26, -1.04)
|
||||||
visible = false
|
visible = false
|
||||||
@@ -224,21 +223,15 @@ render_target_update_mode = 4
|
|||||||
[node name="Node2D" parent="FirstPersonViewport/Head2/LeftHand/SubViewport3" instance=ExtResource("4_mwtvp")]
|
[node name="Node2D" parent="FirstPersonViewport/Head2/LeftHand/SubViewport3" instance=ExtResource("4_mwtvp")]
|
||||||
visible = false
|
visible = false
|
||||||
|
|
||||||
[node name="Sprite3D" type="Sprite3D" parent="FirstPersonViewport/Head2/LeftHand"]
|
|
||||||
transform = Transform3D(0.3, 0, 0, 0, 0.3, 0, 0, 0, 0.3, 1.56, -0.245, 0)
|
|
||||||
layers = 2
|
|
||||||
texture_filter = 0
|
|
||||||
texture = SubResource("ViewportTexture_8f12g")
|
|
||||||
|
|
||||||
[node name="Sprite3D2" type="Sprite3D" parent="FirstPersonViewport/Head2/LeftHand"]
|
[node name="Sprite3D2" type="Sprite3D" parent="FirstPersonViewport/Head2/LeftHand"]
|
||||||
transform = Transform3D(0.35, 0, 0, 0, 0.35, 0, 0, 0, 0.35, 4.74969, -0.0599999, 0.0158834)
|
transform = Transform3D(0.35, 0, 0, 0, 0.35, 0, 0, 0, 0.35, 4.72, -0.145, 1.581)
|
||||||
layers = 2
|
layers = 2
|
||||||
sorting_offset = 1.0
|
sorting_offset = 1.0
|
||||||
texture_filter = 0
|
texture_filter = 0
|
||||||
texture = SubResource("ViewportTexture_v8f6r")
|
texture = SubResource("ViewportTexture_v8f6r")
|
||||||
|
|
||||||
[node name="Sprite3D3" type="Sprite3D" parent="FirstPersonViewport/Head2/LeftHand"]
|
[node name="Sprite3D3" type="Sprite3D" parent="FirstPersonViewport/Head2/LeftHand"]
|
||||||
transform = Transform3D(0.35, 0, 0, 0, 0.35, 0, 0, 0, 0.35, 6.03, -0.0599999, 0.0158834)
|
transform = Transform3D(0.35, 0, 0, 0, 0.35, 0, 0, 0, 0.35, 6.01, -0.145, 1.581)
|
||||||
layers = 2
|
layers = 2
|
||||||
sorting_offset = 1.0
|
sorting_offset = 1.0
|
||||||
texture_filter = 0
|
texture_filter = 0
|
||||||
@@ -816,6 +809,23 @@ bus = &"SFX"
|
|||||||
stream = ExtResource("41_hussy")
|
stream = ExtResource("41_hussy")
|
||||||
bus = &"SFX"
|
bus = &"SFX"
|
||||||
|
|
||||||
|
[node name="BuildingState" type="Node" parent="." node_paths=PackedStringArray("swap_state", "hero")]
|
||||||
|
script = ExtResource("47_d8pnf")
|
||||||
|
swap_state = NodePath("../CardingState")
|
||||||
|
hero = NodePath("..")
|
||||||
|
metadata/_custom_type_script = "uid://b5h7jfwkyokes"
|
||||||
|
|
||||||
|
[node name="CardingState" type="Node" parent="." node_paths=PackedStringArray("swap_state", "hero")]
|
||||||
|
script = ExtResource("48_7d213")
|
||||||
|
swap_state = NodePath("../BuildingState")
|
||||||
|
hero = NodePath("..")
|
||||||
|
metadata/_custom_type_script = "uid://cjdv1onyfej0m"
|
||||||
|
|
||||||
|
[node name="FightingState" type="Node" parent="." node_paths=PackedStringArray("hero")]
|
||||||
|
script = ExtResource("49_60hic")
|
||||||
|
hero = NodePath("..")
|
||||||
|
metadata/_custom_type_script = "uid://cf7m4yyiqhhru"
|
||||||
|
|
||||||
[connection signal="timeout" from="WeaponSwapTimer" to="." method="_on_timer_timeout"]
|
[connection signal="timeout" from="WeaponSwapTimer" to="." method="_on_timer_timeout"]
|
||||||
|
|
||||||
[editable path="FirstPersonViewport/Head2/LeftHand/card_hand_model"]
|
[editable path="FirstPersonViewport/Head2/LeftHand/card_hand_model"]
|
||||||
|
|||||||
14
PCs/hud.gd
14
PCs/hud.gd
@@ -29,7 +29,6 @@ extends CanvasLayer
|
|||||||
var last_lives_count: int = 120
|
var last_lives_count: int = 120
|
||||||
var enemy_names: Array[String]
|
var enemy_names: Array[String]
|
||||||
var map_anchor: Node3D
|
var map_anchor: Node3D
|
||||||
var audio_guard: bool = false
|
|
||||||
var cards: Array[EnemyCardUI] = []
|
var cards: Array[EnemyCardUI] = []
|
||||||
|
|
||||||
|
|
||||||
@@ -162,20 +161,13 @@ func set_energy_amount(value: int) -> void:
|
|||||||
func set_crosshair_visible(value: bool) -> void:
|
func set_crosshair_visible(value: bool) -> void:
|
||||||
crosshair.set_visible(value)
|
crosshair.set_visible(value)
|
||||||
|
|
||||||
#TODO: the fuck is audio_guard for?
|
|
||||||
@warning_ignore("unused_parameter")
|
@warning_ignore("unused_parameter")
|
||||||
func set_weapon_energy(value: int, energy_type: Data.EnergyType) -> void:
|
func set_weapon_energy(value: int, energy_type: Data.EnergyType) -> void:
|
||||||
#weapon_energy_bar.value = value
|
if value == 0:
|
||||||
if player.editing_mode:
|
|
||||||
audio_guard = true
|
|
||||||
if value == 0 and !audio_guard:
|
|
||||||
player.zeropower_audio.play()
|
player.zeropower_audio.play()
|
||||||
audio_guard = true
|
if value == 100:
|
||||||
if value == 100 and !audio_guard:
|
|
||||||
player.fullpower_audio.play()
|
player.fullpower_audio.play()
|
||||||
audio_guard = true
|
|
||||||
if value > 0 and value < 100:
|
|
||||||
audio_guard = false
|
|
||||||
|
|
||||||
|
|
||||||
func maximise_minimap() -> void:
|
func maximise_minimap() -> void:
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ func _process(delta: float) -> void:
|
|||||||
if enable_strafe_tilt:
|
if enable_strafe_tilt:
|
||||||
tilt = get_strafe_tilt(player.velocity)
|
tilt = get_strafe_tilt(player.velocity)
|
||||||
if enable_mouse_sway:
|
if enable_mouse_sway:
|
||||||
sway = weapon_sway(delta)
|
sway = weapon_sway()
|
||||||
rotation = lerp(rotation, tilt + sway, 10 * delta)
|
rotation = lerp(rotation, tilt + sway, 10 * delta)
|
||||||
|
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ func get_strafe_tilt(player_velocity: Vector3) -> Vector3:
|
|||||||
return tilt_vector
|
return tilt_vector
|
||||||
|
|
||||||
|
|
||||||
func weapon_sway(delta: float) -> Vector3:
|
func weapon_sway() -> Vector3:
|
||||||
var vector: Vector3 = Vector3.ZERO
|
var vector: Vector3 = Vector3.ZERO
|
||||||
vector.x = mouse_input.y * weapon_rotation_amount * (-1 if invert_weapon_sway else 1)
|
vector.x = mouse_input.y * weapon_rotation_amount * (-1 if invert_weapon_sway else 1)
|
||||||
vector.y = mouse_input.x * weapon_rotation_amount * (-1 if invert_weapon_sway else 1)
|
vector.y = mouse_input.x * weapon_rotation_amount * (-1 if invert_weapon_sway else 1)
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ func setup_with_basic_text(hero: HeroClass, text: String) -> void:
|
|||||||
for tag: TowerLabel in added_tags:
|
for tag: TowerLabel in added_tags:
|
||||||
tag.queue_free()
|
tag.queue_free()
|
||||||
added_tags = []
|
added_tags = []
|
||||||
var added_labels: Array[Card] = []
|
|
||||||
var new_label: Label = Label.new()
|
var new_label: Label = Label.new()
|
||||||
new_label.text = text
|
new_label.text = text
|
||||||
tower_label_container.add_child(new_label)
|
tower_label_container.add_child(new_label)
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ func randomize_cards() -> void:
|
|||||||
cards[x].set_card(chosen_card)
|
cards[x].set_card(chosen_card)
|
||||||
cards[x].view_tower()
|
cards[x].view_tower()
|
||||||
choice_buttons[x].press_cost = price_dict[chosen_card.rarity]
|
choice_buttons[x].press_cost = price_dict[chosen_card.rarity]
|
||||||
choice_buttons[x].hover_text = "Spend $" + str(choice_buttons[x].press_cost) + " to acquire " + chosen_card.display_name + "?"
|
choice_buttons[x].hover_text = "#Interact# Spend $" + str(choice_buttons[x].press_cost) + " to acquire " + chosen_card.display_name
|
||||||
if chosen_card.faction == Card.Faction.MAGE:
|
if chosen_card.faction == Card.Faction.MAGE:
|
||||||
Data.save_data.saw_mage_card_in_shop()
|
Data.save_data.saw_mage_card_in_shop()
|
||||||
for x: int in 2:
|
for x: int in 2:
|
||||||
@@ -61,7 +61,7 @@ func randomize_cards() -> void:
|
|||||||
cards[x+3].set_card(chosen_card)
|
cards[x+3].set_card(chosen_card)
|
||||||
cards[x+3].view_tower()
|
cards[x+3].view_tower()
|
||||||
choice_buttons[x+3].press_cost = price_dict[chosen_card.rarity]
|
choice_buttons[x+3].press_cost = price_dict[chosen_card.rarity]
|
||||||
choice_buttons[x+3].hover_text = "Spend $" + str(choice_buttons[x+3].press_cost) + " to acquire " + chosen_card.display_name + "?"
|
choice_buttons[x+3].hover_text = "#Interact# Spend $" + str(choice_buttons[x+3].press_cost) + " to acquire " + chosen_card.display_name
|
||||||
if chosen_card.faction == Card.Faction.MAGE:
|
if chosen_card.faction == Card.Faction.MAGE:
|
||||||
Data.save_data.saw_mage_card_in_shop()
|
Data.save_data.saw_mage_card_in_shop()
|
||||||
for x: int in 1:
|
for x: int in 1:
|
||||||
@@ -76,7 +76,7 @@ func randomize_cards() -> void:
|
|||||||
cards[x+5].set_card(chosen_card)
|
cards[x+5].set_card(chosen_card)
|
||||||
cards[x+5].view_tower()
|
cards[x+5].view_tower()
|
||||||
choice_buttons[x+5].press_cost = price_dict[chosen_card.rarity]
|
choice_buttons[x+5].press_cost = price_dict[chosen_card.rarity]
|
||||||
choice_buttons[x+5].hover_text = "Spend $" + str(choice_buttons[x+5].press_cost) + " to acquire " + chosen_card.display_name + "?"
|
choice_buttons[x+5].hover_text = "#Interact# Spend $" + str(choice_buttons[x+5].press_cost) + " to acquire " + chosen_card.display_name
|
||||||
if chosen_card.faction == Card.Faction.MAGE:
|
if chosen_card.faction == Card.Faction.MAGE:
|
||||||
Data.save_data.saw_mage_card_in_shop()
|
Data.save_data.saw_mage_card_in_shop()
|
||||||
for x: CollisionShape3D in choice_colliders:
|
for x: CollisionShape3D in choice_colliders:
|
||||||
|
|||||||
@@ -71,7 +71,6 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.08327, 0.835364, 0.235621)
|
|||||||
collision_layer = 16
|
collision_layer = 16
|
||||||
collision_mask = 0
|
collision_mask = 0
|
||||||
script = ExtResource("1_x8sts")
|
script = ExtResource("1_x8sts")
|
||||||
hover_text = "[center]#Interact# to [do thing]"
|
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="InteractButton"]
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="InteractButton"]
|
||||||
shape = SubResource("BoxShape3D_3r1g8")
|
shape = SubResource("BoxShape3D_3r1g8")
|
||||||
@@ -83,7 +82,6 @@ collision_layer = 16
|
|||||||
collision_mask = 0
|
collision_mask = 0
|
||||||
script = ExtResource("1_x8sts")
|
script = ExtResource("1_x8sts")
|
||||||
button_press_value = 1
|
button_press_value = 1
|
||||||
hover_text = "[center]#Interact# to [do thing]"
|
|
||||||
|
|
||||||
[node name="CollisionShape3D2" type="CollisionShape3D" parent="InteractButton2"]
|
[node name="CollisionShape3D2" type="CollisionShape3D" parent="InteractButton2"]
|
||||||
shape = SubResource("BoxShape3D_3r1g8")
|
shape = SubResource("BoxShape3D_3r1g8")
|
||||||
@@ -95,7 +93,6 @@ collision_layer = 16
|
|||||||
collision_mask = 0
|
collision_mask = 0
|
||||||
script = ExtResource("1_x8sts")
|
script = ExtResource("1_x8sts")
|
||||||
button_press_value = 2
|
button_press_value = 2
|
||||||
hover_text = "[center]#Interact# to [do thing]"
|
|
||||||
|
|
||||||
[node name="CollisionShape3D3" type="CollisionShape3D" parent="InteractButton3"]
|
[node name="CollisionShape3D3" type="CollisionShape3D" parent="InteractButton3"]
|
||||||
shape = SubResource("BoxShape3D_3r1g8")
|
shape = SubResource("BoxShape3D_3r1g8")
|
||||||
@@ -107,7 +104,6 @@ collision_layer = 16
|
|||||||
collision_mask = 0
|
collision_mask = 0
|
||||||
script = ExtResource("1_x8sts")
|
script = ExtResource("1_x8sts")
|
||||||
button_press_value = 5
|
button_press_value = 5
|
||||||
hover_text = "[center]#Interact# to [do thing]"
|
|
||||||
|
|
||||||
[node name="CollisionShape3D4" type="CollisionShape3D" parent="InteractButton4"]
|
[node name="CollisionShape3D4" type="CollisionShape3D" parent="InteractButton4"]
|
||||||
shape = SubResource("BoxShape3D_3r1g8")
|
shape = SubResource("BoxShape3D_3r1g8")
|
||||||
@@ -119,7 +115,6 @@ collision_layer = 16
|
|||||||
collision_mask = 0
|
collision_mask = 0
|
||||||
script = ExtResource("1_x8sts")
|
script = ExtResource("1_x8sts")
|
||||||
button_press_value = 4
|
button_press_value = 4
|
||||||
hover_text = "[center]#Interact# to [do thing]"
|
|
||||||
|
|
||||||
[node name="CollisionShape3D5" type="CollisionShape3D" parent="InteractButton5"]
|
[node name="CollisionShape3D5" type="CollisionShape3D" parent="InteractButton5"]
|
||||||
shape = SubResource("BoxShape3D_3r1g8")
|
shape = SubResource("BoxShape3D_3r1g8")
|
||||||
@@ -131,7 +126,6 @@ collision_layer = 16
|
|||||||
collision_mask = 0
|
collision_mask = 0
|
||||||
script = ExtResource("1_x8sts")
|
script = ExtResource("1_x8sts")
|
||||||
button_press_value = 3
|
button_press_value = 3
|
||||||
hover_text = "[center]#Interact# to [do thing]"
|
|
||||||
|
|
||||||
[node name="CollisionShape3D6" type="CollisionShape3D" parent="InteractButton6"]
|
[node name="CollisionShape3D6" type="CollisionShape3D" parent="InteractButton6"]
|
||||||
shape = SubResource("BoxShape3D_3r1g8")
|
shape = SubResource("BoxShape3D_3r1g8")
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ var tolerance: float = 50.0
|
|||||||
var jumping: bool = false
|
var jumping: bool = false
|
||||||
|
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(_delta: float) -> void:
|
||||||
tolerance = remap(character.health.current_health, character.health.max_health * 0.20, character.health.max_health, 10, 50)
|
tolerance = remap(character.health.current_health, character.health.max_health * 0.20, character.health.max_health, 10, 50)
|
||||||
tolerance = maxf(tolerance, 10)
|
tolerance = maxf(tolerance, 10)
|
||||||
|
|
||||||
|
|||||||
@@ -20,13 +20,14 @@ var current_energy: float = 100.0
|
|||||||
var energy_cost: float = 1.0
|
var energy_cost: float = 1.0
|
||||||
var recharging: bool = false
|
var recharging: bool = false
|
||||||
var recharge_speed: float = 0.0
|
var recharge_speed: float = 0.0
|
||||||
var recharge_acceleration: float = 2.0
|
var recharge_acceleration: float = 3.0
|
||||||
var recharge_max_speed: float = 25.0
|
var recharge_max_speed: float = 30.0
|
||||||
var duration: int = 0
|
var duration: int = 0
|
||||||
#var time_since_trigger: float = 0.0
|
#var time_since_trigger: float = 0.0
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
recharge_timer.wait_time = Data.weapon_recharge_delay
|
||||||
time_between_shots = stats.get_attribute("Fire Delay")
|
time_between_shots = stats.get_attribute("Fire Delay")
|
||||||
damage = int(stats.get_attribute("Damage"))
|
damage = int(stats.get_attribute("Damage"))
|
||||||
#energy_cost = stats.get_attribute("Energy")
|
#energy_cost = stats.get_attribute("Energy")
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ func set_card(new_card: Card) -> void:
|
|||||||
#print(rarity_colors[card.rarity])
|
#print(rarity_colors[card.rarity])
|
||||||
|
|
||||||
|
|
||||||
func press(callback_player: Hero) -> void:
|
func press(_callback_player: Hero) -> void:
|
||||||
pressed.emit(self)
|
pressed.emit(self)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ enum EnemyType {UNDEFINED = 0, LAND = 1, AIR = 2}
|
|||||||
enum Rarity {COMMON = 0, UNCOMMON = 1, RARE = 2, EPIC = 3, LEGENDARY = 4}
|
enum Rarity {COMMON = 0, UNCOMMON = 1, RARE = 2, EPIC = 3, LEGENDARY = 4}
|
||||||
enum CardTags {DAMAGE = 0, UTILITY = 1, TARGETS_FLYING = 2}
|
enum CardTags {DAMAGE = 0, UTILITY = 1, TARGETS_FLYING = 2}
|
||||||
|
|
||||||
|
static var weapon_recharge_delay: float = 1.5
|
||||||
static var starting_cash: int = 10
|
static var starting_cash: int = 10
|
||||||
static var wall_cost: int = 1
|
static var wall_cost: int = 1
|
||||||
static var printer_cost: int = 15
|
static var printer_cost: int = 15
|
||||||
|
|||||||
@@ -97,7 +97,6 @@ func create_path() -> void:
|
|||||||
func update_path() -> void:
|
func update_path() -> void:
|
||||||
if type != Data.EnemyType.LAND:
|
if type != Data.EnemyType.LAND:
|
||||||
return
|
return
|
||||||
path.curve.add_point(global_position + Vector3(0, 0.5, 0))
|
|
||||||
path.curve = Curve3D.new()
|
path.curve = Curve3D.new()
|
||||||
var node: FlowNode = flow_field.get_closest_traversable_point(global_position)
|
var node: FlowNode = flow_field.get_closest_traversable_point(global_position)
|
||||||
path.curve.add_point(node.global_position + Vector3(0, 0.5, 0))
|
path.curve.add_point(node.global_position + Vector3(0, 0.5, 0))
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
class_name GameManager
|
class_name GameManager
|
||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
signal wave_started(wave_number: int)
|
signal wave_started()
|
||||||
signal wave_finished(wave_number: int)
|
signal wave_finished()
|
||||||
signal base_took_damage(remaining_health: int)
|
signal base_took_damage(remaining_health: int)
|
||||||
signal game_setup
|
signal game_setup
|
||||||
signal game_started
|
signal game_started
|
||||||
@@ -92,10 +92,6 @@ func parse_command(text: String, peer_id: int) -> void:
|
|||||||
chatbox.append_message("SERVER", Color.TOMATO, "Unable to set wave")
|
chatbox.append_message("SERVER", Color.TOMATO, "Unable to set wave")
|
||||||
elif text.substr(1, 4) == "seed":
|
elif text.substr(1, 4) == "seed":
|
||||||
chatbox.append_message("SERVER", Color.TOMATO, str(NoiseRandom.noise.seed))
|
chatbox.append_message("SERVER", Color.TOMATO, str(NoiseRandom.noise.seed))
|
||||||
# if text.substr(1, 17) == "show tower ranges":
|
|
||||||
# pass
|
|
||||||
# if text.substr(1, 20) = "show gauntlet ranges":
|
|
||||||
# pass
|
|
||||||
|
|
||||||
|
|
||||||
@rpc("reliable", "call_local")
|
@rpc("reliable", "call_local")
|
||||||
@@ -111,7 +107,6 @@ func spawn_level() -> void:
|
|||||||
level = level_scene.instantiate() as Level
|
level = level_scene.instantiate() as Level
|
||||||
level.game_manager = self
|
level.game_manager = self
|
||||||
for x: EnemySpawner in level.enemy_spawns:
|
for x: EnemySpawner in level.enemy_spawns:
|
||||||
#x.path = level.a_star_graph_3d.visualized_path
|
|
||||||
x.game_manager = self
|
x.game_manager = self
|
||||||
x.enemy_died_callback = enemy_died
|
x.enemy_died_callback = enemy_died
|
||||||
x.enemy_reached_goal_callback = damage_goal
|
x.enemy_reached_goal_callback = damage_goal
|
||||||
@@ -139,8 +134,8 @@ func spawn_players() -> void:
|
|||||||
chatbox.closed.connect(player.unpause)
|
chatbox.closed.connect(player.unpause)
|
||||||
player.set_multiplayer_authority(peer_id)
|
player.set_multiplayer_authority(peer_id)
|
||||||
connected_players_nodes[peer_id] = player
|
connected_players_nodes[peer_id] = player
|
||||||
wave_started.connect(player.exit_editing_mode)
|
wave_started.connect(player.enter_fighting_state)
|
||||||
wave_finished.connect(player.enter_editing_mode)
|
wave_finished.connect(player.exit_fighting_state)
|
||||||
base_took_damage.connect(player.hud.set_lives_count)
|
base_took_damage.connect(player.hud.set_lives_count)
|
||||||
add_child(player)
|
add_child(player)
|
||||||
p_i += 1
|
p_i += 1
|
||||||
@@ -158,7 +153,6 @@ func ready_player(player_ready_true: bool) -> void:
|
|||||||
ready_players += 1
|
ready_players += 1
|
||||||
if ready_players == connected_players_nodes.size():
|
if ready_players == connected_players_nodes.size():
|
||||||
spawn_enemy_wave()
|
spawn_enemy_wave()
|
||||||
#chatbox.append_message("SERVER", Color.TOMATO, "Wave Started!")
|
|
||||||
else:
|
else:
|
||||||
chatbox.append_message("SERVER", Color.TOMATO, str(ready_players) + "/" + str(connected_players_nodes.size()) + " Players ready")
|
chatbox.append_message("SERVER", Color.TOMATO, str(ready_players) + "/" + str(connected_players_nodes.size()) + " Players ready")
|
||||||
|
|
||||||
@@ -167,16 +161,13 @@ func spawn_enemy_wave() -> void:
|
|||||||
level.shop.close()
|
level.shop.close()
|
||||||
wave += 1
|
wave += 1
|
||||||
level.disable_all_tower_frames()
|
level.disable_all_tower_frames()
|
||||||
#level.a_star_graph_3d.find_path()
|
|
||||||
#level.a_star_graph_3d.disable_all_tower_frames()
|
|
||||||
level.flow_field.calculate()
|
level.flow_field.calculate()
|
||||||
for spawn: EnemySpawner in level.enemy_spawns:
|
for spawn: EnemySpawner in level.enemy_spawns:
|
||||||
#spawn.path.disable_visualization()
|
|
||||||
spawn.visible = false
|
spawn.visible = false
|
||||||
spawn.spawn_wave()
|
spawn.spawn_wave()
|
||||||
for tower_base: TowerBase in level.walls.values():
|
for tower_base: TowerBase in level.walls.values():
|
||||||
tower_base.disable_duration_sprites()
|
tower_base.disable_duration_sprites()
|
||||||
wave_started.emit(wave)
|
wave_started.emit()
|
||||||
|
|
||||||
|
|
||||||
func set_upcoming_wave() -> void:
|
func set_upcoming_wave() -> void:
|
||||||
@@ -188,10 +179,10 @@ func set_upcoming_wave() -> void:
|
|||||||
#networked_set_upcoming_wave.rpc(new_wave, 6 + floori(spawn_power / 70.0))
|
#networked_set_upcoming_wave.rpc(new_wave, 6 + floori(spawn_power / 70.0))
|
||||||
|
|
||||||
|
|
||||||
func temp_set_upcoming_wave(wave: Wave, coins: int) -> void:
|
func temp_set_upcoming_wave(new_wave: Wave, coins: int) -> void:
|
||||||
pot = coins
|
pot = coins
|
||||||
connected_players_nodes[multiplayer.get_unique_id()].hud.show_wave_generation_anim(wave)
|
connected_players_nodes[multiplayer.get_unique_id()].hud.show_wave_generation_anim(new_wave)
|
||||||
connected_players_nodes[multiplayer.get_unique_id()].hud.set_upcoming_wave(wave.to_dict())
|
connected_players_nodes[multiplayer.get_unique_id()].hud.set_upcoming_wave(new_wave.to_dict())
|
||||||
|
|
||||||
#TODO: You'll probably have to write a to_dict function for the new wave system
|
#TODO: You'll probably have to write a to_dict function for the new wave system
|
||||||
#before any of this shit works in multiplayer
|
#before any of this shit works in multiplayer
|
||||||
@@ -247,6 +238,7 @@ func damage_goal(enemy: Enemy, penalty: int) -> void:
|
|||||||
func end_wave() -> void:
|
func end_wave() -> void:
|
||||||
for peer_id: int in connected_players_nodes:
|
for peer_id: int in connected_players_nodes:
|
||||||
var player: Hero = connected_players_nodes[peer_id] as Hero
|
var player: Hero = connected_players_nodes[peer_id] as Hero
|
||||||
|
player.hud.set_wave_count(wave)
|
||||||
player.currency += ceili(pot / connected_players_nodes.size())
|
player.currency += ceili(pot / connected_players_nodes.size())
|
||||||
player.energy = 12
|
player.energy = 12
|
||||||
player.iterate_duration()
|
player.iterate_duration()
|
||||||
@@ -258,15 +250,13 @@ func end_wave() -> void:
|
|||||||
if tower_base.has_card:
|
if tower_base.has_card:
|
||||||
tower_base.enable_duration_sprites()
|
tower_base.enable_duration_sprites()
|
||||||
tower_base.iterate_duration()
|
tower_base.iterate_duration()
|
||||||
#level.a_star_graph_3d.enable_non_path_tower_frames()
|
|
||||||
level.enable_non_path_tower_frames()
|
|
||||||
if is_multiplayer_authority():
|
if is_multiplayer_authority():
|
||||||
if NoiseRandom.randf_in_range(23 * wave, 0.0, 1.0) <= shop_chance:
|
if NoiseRandom.randf_in_range(23 * wave, 0.0, 1.0) <= shop_chance:
|
||||||
networked_spawn_shop.rpc()
|
networked_spawn_shop.rpc()
|
||||||
shop_chance = 0.0
|
shop_chance = 0.0
|
||||||
else:
|
else:
|
||||||
shop_chance += 0.09
|
shop_chance += 0.09
|
||||||
wave_finished.emit(wave)
|
wave_finished.emit()
|
||||||
set_upcoming_wave()
|
set_upcoming_wave()
|
||||||
|
|
||||||
|
|
||||||
@@ -326,18 +316,12 @@ func start() -> void:
|
|||||||
set_upcoming_wave()
|
set_upcoming_wave()
|
||||||
level.flow_field.calculate()
|
level.flow_field.calculate()
|
||||||
level.enemy_spawns[0].update_path()
|
level.enemy_spawns[0].update_path()
|
||||||
#level.a_star_graph_3d.make_grid()
|
|
||||||
level.generate_obstacles()
|
level.generate_obstacles()
|
||||||
level.enable_non_path_tower_frames()
|
|
||||||
#level.a_star_graph_3d.disable_all_tower_frames()
|
|
||||||
#level.a_star_graph_3d.enable_non_path_tower_frames()
|
|
||||||
#level.a_star_graph_3d.find_path()
|
|
||||||
|
|
||||||
#Start game
|
#Start game
|
||||||
game_active = true
|
game_active = true
|
||||||
chatbox.append_message("SERVER", Color.TOMATO, "Started with seed: " + str(NoiseRandom.noise.seed))
|
chatbox.append_message("SERVER", Color.TOMATO, "Started with seed: " + str(NoiseRandom.noise.seed))
|
||||||
game_started.emit()
|
game_started.emit()
|
||||||
#print("started game with seed: " + str(gamemode.rng_seed))
|
|
||||||
|
|
||||||
|
|
||||||
func end(outcome: bool) -> void:
|
func end(outcome: bool) -> void:
|
||||||
@@ -374,14 +358,11 @@ func scene_switch_main_menu() -> void:
|
|||||||
multiplayer.multiplayer_peer.close()
|
multiplayer.multiplayer_peer.close()
|
||||||
multiplayer.multiplayer_peer = null
|
multiplayer.multiplayer_peer = null
|
||||||
switch_to_main_menu.emit()
|
switch_to_main_menu.emit()
|
||||||
#get_tree().change_scene_to_file(main_menu_scene_path)
|
|
||||||
|
|
||||||
|
|
||||||
func scene_switch_to_multiplayer_lobby() -> void:
|
func scene_switch_to_multiplayer_lobby() -> void:
|
||||||
switch_to_multi_player.emit()
|
switch_to_multi_player.emit()
|
||||||
#get_tree().change_scene_to_file(multiplayer_lobby_scene_path)
|
|
||||||
|
|
||||||
|
|
||||||
func scene_switch_to_singleplayer_lobby() -> void:
|
func scene_switch_to_singleplayer_lobby() -> void:
|
||||||
switch_to_single_player.emit()
|
switch_to_single_player.emit()
|
||||||
#get_tree().change_scene_to_file(singleplayer_lobby_scene_path)
|
|
||||||
|
|||||||
@@ -81,9 +81,10 @@ func spawn_wall(point: FlowNode, name_id: int, caller_id: int) -> void:
|
|||||||
|
|
||||||
|
|
||||||
func generate_obstacles() -> void:
|
func generate_obstacles() -> void:
|
||||||
|
pass
|
||||||
#print(str(multiplayer.get_unique_id()) + " spawning obstacles with seed: " + str(Game.rng.seed))
|
#print(str(multiplayer.get_unique_id()) + " spawning obstacles with seed: " + str(Game.rng.seed))
|
||||||
var obstacle_count: int = NoiseRandom.randi_in_range(1, 0, 5)
|
#var obstacle_count: int = NoiseRandom.randi_in_range(1, 0, 5)
|
||||||
obstacle_count = 0
|
#obstacle_count = 0
|
||||||
# for index: int in obstacle_count:
|
# for index: int in obstacle_count:
|
||||||
# #var x: int = Game.randi_in_range(10 * index, 1 - a_star_graph_3d.grid_size.x, a_star_graph_3d.grid_size.x - 1)
|
# #var x: int = Game.randi_in_range(10 * index, 1 - a_star_graph_3d.grid_size.x, a_star_graph_3d.grid_size.x - 1)
|
||||||
#var y: int = Game.randi_in_range(32 * index, 1 - a_star_graph_3d.grid_size.y, a_star_graph_3d.grid_size.y - 1)
|
#var y: int = Game.randi_in_range(32 * index, 1 - a_star_graph_3d.grid_size.y, a_star_graph_3d.grid_size.y - 1)
|
||||||
|
|||||||
@@ -72,7 +72,8 @@ func connect_to_server() -> void:
|
|||||||
|
|
||||||
|
|
||||||
func ready_player() -> void:
|
func ready_player() -> void:
|
||||||
var peer_id: int = multiplayer.get_unique_id()
|
pass
|
||||||
|
#var peer_id: int = multiplayer.get_unique_id()
|
||||||
#networked_ready_player.rpc(peer_id)
|
#networked_ready_player.rpc(peer_id)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ static func calculate_pot(wave_number: int, number_of_players: int) -> int:
|
|||||||
static func generate_wave(spawn_power: int, spawn_pool: Array[Enemy], spawners: Array[EnemySpawner]) -> Wave:
|
static func generate_wave(spawn_power: int, spawn_pool: Array[Enemy], spawners: Array[EnemySpawner]) -> Wave:
|
||||||
var wave: Wave = Wave.new()
|
var wave: Wave = Wave.new()
|
||||||
|
|
||||||
var points: int = spawn_power / 10.0
|
var points: int = int(spawn_power / 10.0)
|
||||||
#print("Generating wave with " + str(points) + " points to spend")
|
#print("Generating wave with " + str(points) + " points to spend")
|
||||||
while points > 0:
|
while points > 0:
|
||||||
var new_card: EnemyCard = EnemyCard.new()
|
var new_card: EnemyCard = EnemyCard.new()
|
||||||
@@ -72,7 +72,7 @@ static func generate_wave(spawn_power: int, spawn_pool: Array[Enemy], spawners:
|
|||||||
#Now that we know which rarities we could afford, lets just choose a
|
#Now that we know which rarities we could afford, lets just choose a
|
||||||
#random one
|
#random one
|
||||||
var chosen_rarity: int = randi_range(0, highest_rarity)
|
var chosen_rarity: int = randi_range(0, highest_rarity)
|
||||||
new_card.rarity = chosen_rarity
|
new_card.rarity = chosen_rarity as Data.Rarity
|
||||||
|
|
||||||
#Add that new enemy to the wave and spend the points!
|
#Add that new enemy to the wave and spend the points!
|
||||||
wave.enemy_groups.append(new_card)
|
wave.enemy_groups.append(new_card)
|
||||||
|
|||||||
@@ -6,12 +6,12 @@
|
|||||||
[sub_resource type="Resource" id="Resource_bukji"]
|
[sub_resource type="Resource" id="Resource_bukji"]
|
||||||
script = ExtResource("1_qgv2j")
|
script = ExtResource("1_qgv2j")
|
||||||
key = "Fire Delay"
|
key = "Fire Delay"
|
||||||
value = 0.5
|
value = 0.45
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_2e75s"]
|
[sub_resource type="Resource" id="Resource_2e75s"]
|
||||||
script = ExtResource("1_qgv2j")
|
script = ExtResource("1_qgv2j")
|
||||||
key = "Damage"
|
key = "Damage"
|
||||||
value = 1.0
|
value = 2.0
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_1vpnf"]
|
[sub_resource type="Resource" id="Resource_1vpnf"]
|
||||||
script = ExtResource("1_qgv2j")
|
script = ExtResource("1_qgv2j")
|
||||||
|
|||||||
@@ -30,15 +30,25 @@ func set_card(card: Card) -> void:
|
|||||||
func set_key(slot: int) -> void:
|
func set_key(slot: int) -> void:
|
||||||
match(slot):
|
match(slot):
|
||||||
0:
|
0:
|
||||||
$Label.text = parse_action_tag("#Select 1st Card#")
|
$Label.text = parse_action_tag("#Equip 1#")
|
||||||
1:
|
1:
|
||||||
$Label.text = parse_action_tag("#Select 2nd Card#")
|
$Label.text = parse_action_tag("#Equip 2#")
|
||||||
2:
|
2:
|
||||||
$Label.text = parse_action_tag("#Select 3rd Card#")
|
$Label.text = parse_action_tag("#Equip 3#")
|
||||||
3:
|
3:
|
||||||
$Label.text = parse_action_tag("#Select 4th Card#")
|
$Label.text = parse_action_tag("#Equip 4#")
|
||||||
44:
|
4:
|
||||||
$Label.text = parse_action_tag("#Select 5th Card#")
|
$Label.text = parse_action_tag("#Equip 5#")
|
||||||
|
5:
|
||||||
|
$Label.text = parse_action_tag("#Equip 6#")
|
||||||
|
6:
|
||||||
|
$Label.text = parse_action_tag("#Equip 7#")
|
||||||
|
7:
|
||||||
|
$Label.text = parse_action_tag("#Equip 8#")
|
||||||
|
8:
|
||||||
|
$Label.text = parse_action_tag("#Equip 9#")
|
||||||
|
9:
|
||||||
|
$Label.text = parse_action_tag("#Equip 10#")
|
||||||
|
|
||||||
|
|
||||||
func parse_action_tag(text: String) -> String:
|
func parse_action_tag(text: String) -> String:
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ value = 15.0
|
|||||||
[sub_resource type="Resource" id="Resource_7i2dt"]
|
[sub_resource type="Resource" id="Resource_7i2dt"]
|
||||||
script = ExtResource("1_rbqj6")
|
script = ExtResource("1_rbqj6")
|
||||||
key = "Fire Delay"
|
key = "Fire Delay"
|
||||||
value = 0.2
|
value = 0.14
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_8cirl"]
|
[sub_resource type="Resource" id="Resource_8cirl"]
|
||||||
script = ExtResource("1_rbqj6")
|
script = ExtResource("1_rbqj6")
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ func _process(delta: float) -> void:
|
|||||||
targets = target_list
|
targets = target_list
|
||||||
for x: int in target_icons.size():
|
for x: int in target_icons.size():
|
||||||
if x < targets.size():
|
if x < targets.size():
|
||||||
target_icons[x].global_position = targets[x].sprite.global_position
|
target_icons[x].global_position = targets[x].d_n.global_position
|
||||||
target_icons[x].set_visible(true)
|
target_icons[x].set_visible(true)
|
||||||
else:
|
else:
|
||||||
target_icons[x].set_visible(false)
|
target_icons[x].set_visible(false)
|
||||||
|
|||||||
80
card_placing_tool.gd
Normal file
80
card_placing_tool.gd
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
class_name CardPlacingTool
|
||||||
|
extends Node3D
|
||||||
|
|
||||||
|
@export var hero: Hero
|
||||||
|
@export var ray: RayCast3D
|
||||||
|
|
||||||
|
var enabled: bool = false
|
||||||
|
var tower_preview: Tower
|
||||||
|
var tower_preview_card: Card
|
||||||
|
var last_tower_base: TowerBase
|
||||||
|
var ray_collider: Object
|
||||||
|
|
||||||
|
|
||||||
|
func reset() -> void:
|
||||||
|
delete_tower_preview()
|
||||||
|
|
||||||
|
|
||||||
|
func _process(_delta: float) -> void:
|
||||||
|
if !enabled:
|
||||||
|
reset()
|
||||||
|
return
|
||||||
|
|
||||||
|
if !ray_collider or hero.hand.size == 0 or ray_collider.has_card:
|
||||||
|
delete_tower_preview()
|
||||||
|
|
||||||
|
if ray.is_colliding() and ray.get_collider() is TowerBase:
|
||||||
|
ray_collider = ray.get_collider()
|
||||||
|
if hero.hand.size > 0 and !ray_collider.has_card:
|
||||||
|
if ray_collider != last_tower_base or hero.selected_card != tower_preview_card:
|
||||||
|
spawn_tower_preview()
|
||||||
|
else:
|
||||||
|
ray_collider = null
|
||||||
|
|
||||||
|
|
||||||
|
func interact() -> void:
|
||||||
|
if ray.is_colliding() and ray.get_collider() is TowerBase:
|
||||||
|
var tower_base: TowerBase = ray.get_collider() as TowerBase
|
||||||
|
put_card_in_tower_base(tower_base)
|
||||||
|
|
||||||
|
|
||||||
|
func put_card_in_tower_base(tower_base: TowerBase) -> void:
|
||||||
|
if hero.hand.size <= 0:
|
||||||
|
return
|
||||||
|
var card: Card = hero.selected_card
|
||||||
|
var energy_cost: int = int(card.rarity) + 1
|
||||||
|
energy_cost *= 2
|
||||||
|
if hero.energy < energy_cost:
|
||||||
|
return
|
||||||
|
if tower_base.has_card:
|
||||||
|
tower_base.remove_card()
|
||||||
|
hero.hand.remove_at(hero.hand.contents.find(card))
|
||||||
|
hero.check_removal()
|
||||||
|
#hero.card_sprites[hero.hand_selected_index].queue_free()
|
||||||
|
#hero.card_sprites.remove_at(hero.hand_selected_index)
|
||||||
|
#if !hero.hand.contents.has(card):
|
||||||
|
#hero.decrement_selected()
|
||||||
|
tower_base.add_card(card, multiplayer.get_unique_id())
|
||||||
|
hero.discard_pile.add(card)
|
||||||
|
hero.place_card_audio.play()
|
||||||
|
hero.energy -= energy_cost
|
||||||
|
|
||||||
|
|
||||||
|
func spawn_tower_preview() -> void:
|
||||||
|
delete_tower_preview()
|
||||||
|
var card: Card = hero.selected_card
|
||||||
|
last_tower_base = ray_collider as TowerBase
|
||||||
|
tower_preview_card = card
|
||||||
|
tower_preview = card.turret_scene.instantiate() as Tower
|
||||||
|
tower_preview.stats = card.tower_stats
|
||||||
|
tower_preview.position = Vector3.UP
|
||||||
|
tower_preview.preview_range(true)
|
||||||
|
last_tower_base.add_child(tower_preview)
|
||||||
|
|
||||||
|
|
||||||
|
func delete_tower_preview() -> void:
|
||||||
|
last_tower_base = null
|
||||||
|
if is_instance_valid(tower_preview):
|
||||||
|
tower_preview.queue_free()
|
||||||
|
tower_preview = null
|
||||||
|
tower_preview_card = null
|
||||||
1
card_placing_tool.gd.uid
Normal file
1
card_placing_tool.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://ge2hingujtc8
|
||||||
11
card_placing_tool.tscn
Normal file
11
card_placing_tool.tscn
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
[gd_scene load_steps=2 format=3 uid="uid://bj2q72ch8nkek"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://ge2hingujtc8" path="res://card_placing_tool.gd" id="1_7yi0i"]
|
||||||
|
|
||||||
|
[node name="CardPlacingTool" type="Node3D" node_paths=PackedStringArray("ray")]
|
||||||
|
script = ExtResource("1_7yi0i")
|
||||||
|
ray = NodePath("RayCast3D")
|
||||||
|
|
||||||
|
[node name="RayCast3D" type="RayCast3D" parent="."]
|
||||||
|
target_position = Vector3(0, 0, -20)
|
||||||
|
collision_mask = 25
|
||||||
@@ -52,8 +52,7 @@ runnable=true
|
|||||||
advanced_options=false
|
advanced_options=false
|
||||||
dedicated_server=false
|
dedicated_server=false
|
||||||
custom_features=""
|
custom_features=""
|
||||||
export_filter="exclude"
|
export_filter="all_resources"
|
||||||
export_files=PackedStringArray("res://Classes/Engineer/class.tres", "res://Classes/Engineer/doe.png", "res://Classes/Engineer/podium.tscn", "res://Classes/Engineer/red.png", "res://Classes/Engineer/red_hand.png", "res://Classes/Mage/blue.png", "res://Classes/Mage/blue_hand.png", "res://Classes/Mage/class.tres", "res://Classes/Mage/podium.tscn", "res://Classes/Mage/yeen.png", "res://Classes/NewHero3/class.tres", "res://Classes/NewHero3/green.png", "res://Classes/NewHero3/green_hand.png", "res://Classes/NewHero3/podium.tscn", "res://Classes/NewHero4/class.tres", "res://Classes/NewHero4/podium.tscn", "res://Cards/ascension.tres", "res://Cards/assault.tres", "res://Cards/blowdart.tres", "res://Cards/bomb_launcher.tres", "res://Cards/fireball.tres", "res://Cards/flamethrower.tres", "res://Cards/gatling.tres", "res://Cards/glue_launcher.tres", "res://Cards/icicle.tres", "res://Cards/overclock_card.tres", "res://Cards/reactor.tres", "res://Cards/refrigerator.tres", "res://Cards/rocket_launcher.tres", "res://Cards/sniper.tres")
|
|
||||||
include_filter=""
|
include_filter=""
|
||||||
exclude_filter=""
|
exclude_filter=""
|
||||||
export_path="../../tower_defense/Windows/Decked Out Defense.exe"
|
export_path="../../tower_defense/Windows/Decked Out Defense.exe"
|
||||||
|
|||||||
1
main.gd
1
main.gd
@@ -19,6 +19,7 @@ func load_main_menu() -> void:
|
|||||||
if game_manager:
|
if game_manager:
|
||||||
game_manager.queue_free()
|
game_manager.queue_free()
|
||||||
game_manager = GameManager.new()
|
game_manager = GameManager.new()
|
||||||
|
game_manager.name = "GameManager"
|
||||||
add_child(game_manager)
|
add_child(game_manager)
|
||||||
game_manager.switch_to_main_menu.connect(load_main_menu)
|
game_manager.switch_to_main_menu.connect(load_main_menu)
|
||||||
game_manager.switch_to_single_player.connect(load_singleplayer)
|
game_manager.switch_to_single_player.connect(load_singleplayer)
|
||||||
|
|||||||
@@ -154,31 +154,56 @@ Pause={
|
|||||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":4,"canceled":false,"pressed":false,"double_click":false,"script":null)
|
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":4,"canceled":false,"pressed":false,"double_click":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
"Select 1st Card"={
|
"Equip 1"={
|
||||||
"deadzone": 0.2,
|
"deadzone": 0.2,
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":49,"key_label":0,"unicode":49,"location":0,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":49,"key_label":0,"unicode":49,"location":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
"Select 2nd Card"={
|
"Equip 2"={
|
||||||
"deadzone": 0.2,
|
"deadzone": 0.2,
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":50,"key_label":0,"unicode":50,"location":0,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":50,"key_label":0,"unicode":50,"location":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
"Select 3rd Card"={
|
"Equip 3"={
|
||||||
"deadzone": 0.2,
|
"deadzone": 0.2,
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":51,"key_label":0,"unicode":51,"location":0,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":51,"key_label":0,"unicode":51,"location":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
"Select 4th Card"={
|
"Equip 4"={
|
||||||
"deadzone": 0.2,
|
"deadzone": 0.2,
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":52,"key_label":0,"unicode":52,"location":0,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":52,"key_label":0,"unicode":52,"location":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
"Select 5th Card"={
|
"Equip 5"={
|
||||||
"deadzone": 0.2,
|
"deadzone": 0.2,
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":53,"key_label":0,"unicode":53,"location":0,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":53,"key_label":0,"unicode":53,"location":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
"Equip 6"={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":54,"key_label":0,"unicode":54,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
"Equip 7"={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":55,"key_label":0,"unicode":55,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
"Equip 8"={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":56,"key_label":0,"unicode":56,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
"Equip 9"={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":57,"key_label":0,"unicode":57,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
"Equip 10"={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":48,"key_label":0,"unicode":48,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
[layer_names]
|
[layer_names]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user