oh fuck im gonna have to learn to clean up previous commits
This commit is contained in:
@@ -98,7 +98,7 @@ func process_looking_at_level() -> void:
|
||||
if tower_preview:
|
||||
delete_tower_preview()
|
||||
point = level.flow_field.get_closest_buildable_point(ray_point)
|
||||
if level.walls.has(point) or !point.buildable or hero.energy < Data.wall_cost:
|
||||
if level.walls.has(point) or !point.buildable or hero.energy < Data.wall_cost or !hero.building_mode:
|
||||
wall_preview.set_visible(false)
|
||||
valid_point = false
|
||||
clear_previous_point()
|
||||
@@ -132,14 +132,14 @@ func process_looking_at_tower() -> void:
|
||||
ray_collider.set_color(Color.RED)
|
||||
ray_collider.set_float(0.0)
|
||||
if hero.hand.size > 0 and !ray_collider.has_card:
|
||||
if ray_collider != last_tower_base or hero.hand.item_at(hero.hand_selected_index) != tower_preview_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.hand.item_at(hero.hand_selected_index)
|
||||
var card: Card = hero.selected_card
|
||||
tower_preview_card = card
|
||||
tower_preview = card.turret_scene.instantiate() as Tower
|
||||
tower_preview.stats = card.tower_stats
|
||||
@@ -178,21 +178,25 @@ func refund_wall(wall: TowerBase) -> void:
|
||||
|
||||
|
||||
func put_card_in_tower_base(tower_base: TowerBase) -> void:
|
||||
var energy_cost: int = int(hero.hand.item_at(hero.hand_selected_index).rarity) + 1
|
||||
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 hero.hand.size > 0:
|
||||
if tower_base.has_card:
|
||||
tower_base.remove_card()
|
||||
var card: Card = hero.hand.remove_at(hero.hand_selected_index)
|
||||
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
|
||||
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:
|
||||
|
||||
@@ -15,6 +15,7 @@ target_position = Vector3(0, 0, -20)
|
||||
collision_mask = 25
|
||||
|
||||
[node name="WallPreview" parent="." instance=ExtResource("2_pjtpe")]
|
||||
visible = false
|
||||
|
||||
[node name="ProgressBar" type="TextureProgressBar" parent="."]
|
||||
anchors_preset = 8
|
||||
|
||||
203
PCs/hero.gd
203
PCs/hero.gd
@@ -9,11 +9,11 @@ signal ready_state_changed(state: bool)
|
||||
@export var left_hand_sprite: Sprite3D
|
||||
@export var left_hand: Node3D
|
||||
@export var right_hand: Node3D
|
||||
@export var right_hand_animator: AnimationPlayer
|
||||
#@export var right_hand_animator: AnimationPlayer
|
||||
@export var edit_tool: PathEditTool
|
||||
@export var gauntlet_sprite: Sprite3D
|
||||
@export var sprite: EightDirectionSprite3D
|
||||
@export var hand_sprite: Sprite2D
|
||||
#@export var hand_sprite: Sprite2D
|
||||
@export var interaction_raycast: RayCast3D
|
||||
@export var draw_pile: Inventory
|
||||
@export var hand: Inventory
|
||||
@@ -25,6 +25,8 @@ signal ready_state_changed(state: bool)
|
||||
@export var sprint_zoom_speed: float = 0.2
|
||||
@export var player_name_tag: Label
|
||||
@export var weapon_swap_timer: Timer
|
||||
@export var card3d_scene: PackedScene
|
||||
@export var card_select_scene: PackedScene
|
||||
|
||||
@export_subgroup("Audio")
|
||||
@export var ears: AudioListener3D
|
||||
@@ -37,6 +39,9 @@ signal ready_state_changed(state: bool)
|
||||
@export var swap_off_audio: AudioStreamPlayer
|
||||
@export var swap_on_audio: AudioStreamPlayer
|
||||
|
||||
var building_mode: bool = true
|
||||
var selection_boxes: Array[CardSelectionBox] = []
|
||||
var unique_cards: Array[Card] = []
|
||||
var hand_card_scene: PackedScene = preload("res://Scenes/UI/card_hand.tscn")
|
||||
var card_sprites: Array[CardInHand]
|
||||
var game_manager: GameManager
|
||||
@@ -66,6 +71,11 @@ var energy: int = 0 :
|
||||
hud.set_energy_amount(value)
|
||||
get:
|
||||
return energy
|
||||
var selected_card: Card :
|
||||
set(_value):
|
||||
pass
|
||||
get():
|
||||
return unique_cards[hand_selected_index]
|
||||
|
||||
|
||||
func set_zoom_factor(value: float) -> void:
|
||||
@@ -74,13 +84,13 @@ func set_zoom_factor(value: float) -> void:
|
||||
|
||||
func _ready() -> void:
|
||||
if is_multiplayer_authority():
|
||||
right_hand_animator.play("weapon_sway")
|
||||
right_hand_animator.speed_scale = 0
|
||||
#right_hand_animator.play("weapon_sway")
|
||||
#right_hand_animator.speed_scale = 0
|
||||
ears.make_current()
|
||||
camera.make_current()
|
||||
sprite.queue_free()
|
||||
hand.max_size = 5
|
||||
hand_sprite.texture = hero_class.hand_texture
|
||||
#hand_sprite.texture = hero_class.hand_texture
|
||||
player_name_tag.queue_free()
|
||||
for card: Card in hero_class.deck:
|
||||
draw_pile.add(card)
|
||||
@@ -98,12 +108,12 @@ func _ready() -> void:
|
||||
func _physics_process(_delta: float) -> void:
|
||||
if !is_multiplayer_authority() or paused:
|
||||
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
|
||||
#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:
|
||||
@@ -135,20 +145,61 @@ func _process(delta: float) -> void:
|
||||
button.press(self)
|
||||
if interaction_raycast.get_collider() is ItemCard:
|
||||
add_card(interaction_raycast.get_collider().pick_up())
|
||||
if Input.is_action_just_pressed("Equip Primary Weapon"):
|
||||
equip_weapon(0)
|
||||
if Input.is_action_just_pressed("Equip Secondary Weapon"):
|
||||
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("Primary Fire"):
|
||||
edit_tool.interact_key_held = true
|
||||
if Input.is_action_just_released("Primary Fire"):
|
||||
edit_tool.interact_key_held = false
|
||||
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()
|
||||
@@ -193,17 +244,19 @@ func _process(delta: float) -> void:
|
||||
|
||||
func increment_selected() -> void:
|
||||
hand_selected_index += 1
|
||||
if hand_selected_index >= hand.size:
|
||||
if hand_selected_index >= unique_cards.size():
|
||||
hand_selected_index = 0
|
||||
update_selected_box()
|
||||
|
||||
|
||||
func decrement_selected() -> void:
|
||||
if hand.size == 0:
|
||||
if unique_cards.size() == 0:
|
||||
hand_selected_index = 0
|
||||
return
|
||||
hand_selected_index -= 1
|
||||
if hand_selected_index < 0:
|
||||
hand_selected_index = hand.size - 1
|
||||
hand_selected_index = unique_cards.size() - 1
|
||||
update_selected_box()
|
||||
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
@@ -267,6 +320,10 @@ func enter_editing_mode(value: int) -> void:
|
||||
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
|
||||
@@ -277,6 +334,10 @@ func enter_editing_mode(value: int) -> void:
|
||||
|
||||
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]
|
||||
@@ -302,28 +363,27 @@ func check_left_hand_valid() -> void:
|
||||
return
|
||||
if hand.size == 0:
|
||||
left_hand_sprite.visible = false
|
||||
#gauntlet.texture.region = Rect2(64, 0, 64, 64)
|
||||
else:
|
||||
left_hand_sprite.visible = true
|
||||
#gauntlet.texture.region = Rect2(0, 0, 64, 64)
|
||||
var selected_card: Card = hand.item_at(hand_selected_index)
|
||||
for index: int in card_sprites.size():
|
||||
if hand_selected_index == index:
|
||||
var tween: Tween = create_tween()
|
||||
tween.set_ease(Tween.EASE_OUT)
|
||||
tween.set_trans(Tween.TRANS_CUBIC)
|
||||
tween.tween_property(card_sprites[index], "position", Vector2(200.0 * index, -20.0), 0.5)
|
||||
else:
|
||||
var tween: Tween = create_tween()
|
||||
tween.set_ease(Tween.EASE_OUT)
|
||||
tween.set_trans(Tween.TRANS_CUBIC)
|
||||
tween.tween_property(card_sprites[index], "position", Vector2(200.0 * index, 80.0), 0.5)
|
||||
#if index < inventory.contents[selected_card]:
|
||||
#card_sprites[index].visible = true
|
||||
#card_sprites[index].set_card(selected_card)
|
||||
##card_sprites[index].view_weapon()
|
||||
#else:
|
||||
#card_sprites[index].visible = false
|
||||
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:
|
||||
@@ -346,22 +406,46 @@ func draw_to_hand_size() -> void:
|
||||
if draw_pile.size > 0:
|
||||
var card: Card = draw_pile.remove_at(0)
|
||||
hand.add(card)
|
||||
var display: CardInHand = hand_card_scene.instantiate()
|
||||
var display: Card3D = card3d_scene.instantiate()
|
||||
display.set_card(card)
|
||||
$FirstPersonViewport/Head2/LeftHand/SubViewport.add_child(display)
|
||||
card_sprites.append(display)
|
||||
var tween: Tween = create_tween()
|
||||
tween.set_ease(Tween.EASE_OUT)
|
||||
tween.set_trans(Tween.TRANS_CUBIC)
|
||||
tween.tween_property(display, "position", Vector2(200.0 * hand.size, 80.0), 0.5)
|
||||
display.position = Vector3(0.01 * hand.size, 0.0, -0.001 * hand.size)
|
||||
display.rotation_degrees = Vector3(0.0, 0.0, -10.0 * hand.size)
|
||||
$FirstPersonViewport/Head2/LeftHand/Cards.add_child(display)
|
||||
#var tween: Tween = create_tween()
|
||||
#tween.set_ease(Tween.EASE_OUT)
|
||||
#tween.set_trans(Tween.TRANS_CUBIC)
|
||||
#tween.tween_property(display, "position", Vector2(200.0 * hand.size, 80.0), 0.5)
|
||||
else:
|
||||
for x: int in discard_pile.size:
|
||||
draw_pile.add(discard_pile.remove_at(0))
|
||||
draw_pile.shuffle()
|
||||
unique_cards = []
|
||||
selection_boxes = []
|
||||
for card: Card in hand.contents:
|
||||
if !unique_cards.has(card):
|
||||
unique_cards.append(card)
|
||||
for i: int in $HUD/selection_boxes.get_child_count():
|
||||
$HUD/selection_boxes.get_child(i).queue_free()
|
||||
for i: int in unique_cards.size():
|
||||
var card: Card = unique_cards[i]
|
||||
var box: CardSelectionBox = card_select_scene.instantiate()
|
||||
box.set_card(card)
|
||||
box.set_key(i)
|
||||
selection_boxes.append(box)
|
||||
$HUD/selection_boxes.add_child(box)
|
||||
hand_selected_index = 0
|
||||
update_selected_box()
|
||||
|
||||
|
||||
func update_selected_box() -> void:
|
||||
for box: CardSelectionBox in selection_boxes:
|
||||
box.deselect()
|
||||
selection_boxes[hand_selected_index].select()
|
||||
|
||||
|
||||
func equip_weapon(slot: int = 0) -> void:
|
||||
var energy_cost: int = int(hand.item_at(hand_selected_index).rarity) + 1
|
||||
energy_cost *= 2
|
||||
if energy < energy_cost:
|
||||
return
|
||||
if weapons[slot] != null:
|
||||
@@ -369,13 +453,13 @@ func equip_weapon(slot: int = 0) -> void:
|
||||
if hand.size > 0:
|
||||
energy -= energy_cost
|
||||
place_card_audio.play()
|
||||
cards[slot] = hand.remove_at(hand_selected_index)
|
||||
card_sprites[hand_selected_index].queue_free()
|
||||
card_sprites.remove_at(hand_selected_index)
|
||||
cards[slot] = hand.remove_at(hand.contents.find(selected_card))
|
||||
#card_sprites[hand_selected_index].queue_free()
|
||||
#card_sprites.remove_at(hand_selected_index)
|
||||
discard_pile.add(cards[slot])
|
||||
#TODO: Alternate thing to do with the hand i guess
|
||||
#if !inventory.contents.has(cards[slot]):
|
||||
decrement_selected()
|
||||
#decrement_selected()
|
||||
weapons[slot] = cards[slot].weapon_scene.instantiate()
|
||||
weapons[slot].name = str(weapons_spawn_count)
|
||||
weapons[slot].duration = cards[slot].duration
|
||||
@@ -396,6 +480,7 @@ func equip_weapon(slot: int = 0) -> void:
|
||||
weapons[slot].set_hero(self)
|
||||
weapons[slot].visible = false
|
||||
right_hand.add_child(weapons[slot])
|
||||
check_removal()
|
||||
check_left_hand_valid()
|
||||
if slot == 0:
|
||||
weapons[slot].energy_spent.connect(hud.new_energy_bar.use_energy)
|
||||
|
||||
@@ -5,14 +5,17 @@
|
||||
[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://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="PackedScene" uid="uid://dixtx38u4jhd7" path="res://Scenes/UI/card_hand.tscn" id="4_mwtvp"]
|
||||
[ext_resource type="PackedScene" uid="uid://gdd1xupf4oxx" path="res://UI/CardSelectionBox/card_selection_box.tscn" id="5_h82f6"]
|
||||
[ext_resource type="PackedScene" uid="uid://dqt1ggtkpkuhs" path="res://PCs/PathEditTool/path_edit_tool.tscn" id="5_jlxb3"]
|
||||
[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="Script" uid="uid://3wvxl8jo4uis" path="res://PCs/weapon_movement.gd" id="7_14ugt"]
|
||||
[ext_resource type="Script" uid="uid://b6kjrl7ae1mi0" path="res://PCs/hud.gd" id="8_yl6ka"]
|
||||
[ext_resource type="Texture2D" uid="uid://ctkixdue3o7ec" path="res://Classes/Engineer/red_hand.png" id="9_gxh2h"]
|
||||
[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="Script" uid="uid://ckkioruqgbs8p" path="res://Scripts/minimap_cam.gd" id="12_3hpi3"]
|
||||
[ext_resource type="Texture2D" uid="uid://b6iego7256jf2" path="res://Assets/Textures/wavecounter.png" id="14_l34nu"]
|
||||
[ext_resource type="PackedScene" uid="uid://24x18qxqhy0i" path="res://Scenes/UI/lives_bar.tscn" id="15_cqpib"]
|
||||
@@ -49,25 +52,6 @@
|
||||
radius = 0.3
|
||||
height = 1.8
|
||||
|
||||
[sub_resource type="Environment" id="Environment_ekmug"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_2q50p"]
|
||||
resource_name = "weapon_sway"
|
||||
length = 0.8
|
||||
loop_mode = 1
|
||||
tracks/0/type = "position_3d"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = PackedFloat32Array(0, 1, 0.615, -0.275, -1, 0.2, 1, 0.59, -0.255, -1, 0.4, 1, 0.615, -0.275, -1, 0.6, 1, 0.66, -0.255, -1, 0.8, 1, 0.615, -0.275, -1)
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_2wknc"]
|
||||
_data = {
|
||||
&"weapon_sway": SubResource("Animation_2q50p")
|
||||
}
|
||||
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_8f12g"]
|
||||
viewport_path = NodePath("FirstPersonViewport/Head2/LeftHand/SubViewport")
|
||||
|
||||
@@ -129,7 +113,7 @@ stream_0/stream = ExtResource("36_lsvj8")
|
||||
streams_count = 1
|
||||
stream_0/stream = ExtResource("37_kv1mg")
|
||||
|
||||
[node name="Hero" type="CharacterBody3D" node_paths=PackedStringArray("camera", "gun_camera", "left_hand_sprite", "left_hand", "right_hand", "right_hand_animator", "edit_tool", "gauntlet_sprite", "sprite", "hand_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_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")]
|
||||
collision_layer = 2
|
||||
collision_mask = 37
|
||||
script = ExtResource("1_pihpe")
|
||||
@@ -139,11 +123,9 @@ gun_camera = NodePath("FirstPersonViewport/Head2")
|
||||
left_hand_sprite = NodePath("FirstPersonViewport/Head2/LeftHand/Sprite3D")
|
||||
left_hand = NodePath("FirstPersonViewport/Head2/LeftHand")
|
||||
right_hand = NodePath("FirstPersonViewport/Head2/RightHand")
|
||||
right_hand_animator = NodePath("FirstPersonViewport/Head2/RightHand/AnimationPlayer")
|
||||
edit_tool = NodePath("ViewMovement/Head/EditTool")
|
||||
gauntlet_sprite = NodePath("FirstPersonViewport/Head2/RightHand/Gauntlet")
|
||||
sprite = NodePath("EightDirectionSprite")
|
||||
hand_sprite = NodePath("FirstPersonViewport/Head2/LeftHand/SubViewport/Sprite2D")
|
||||
interaction_raycast = NodePath("ViewMovement/Head/RayCast3D")
|
||||
draw_pile = NodePath("DrawPile")
|
||||
hand = NodePath("Hand")
|
||||
@@ -154,6 +136,8 @@ hud = NodePath("HUD")
|
||||
movement = NodePath("PlayerMovement")
|
||||
player_name_tag = NodePath("NametagViewport/Label")
|
||||
weapon_swap_timer = NodePath("WeaponSwapTimer")
|
||||
card3d_scene = ExtResource("4_2mqvj")
|
||||
card_select_scene = ExtResource("5_h82f6")
|
||||
ears = NodePath("AudioListener3D")
|
||||
place_card_audio = NodePath("PlaceCardAudio")
|
||||
swap_card_audio = NodePath("SwapCardAudio")
|
||||
@@ -177,6 +161,8 @@ script = ExtResource("4_mhexa")
|
||||
player = NodePath("..")
|
||||
camera = NodePath("Head")
|
||||
focus_raycast = NodePath("Head/RayCast3D")
|
||||
enable_strafe_tilt = true
|
||||
tilt_amount_x = 0.7
|
||||
|
||||
[node name="Head" type="Camera3D" parent="ViewMovement"]
|
||||
keep_aspect = 0
|
||||
@@ -202,37 +188,27 @@ render_target_update_mode = 4
|
||||
[node name="Head2" type="Camera3D" parent="FirstPersonViewport" node_paths=PackedStringArray("clone_camera")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.62, 0)
|
||||
cull_mask = 2
|
||||
environment = SubResource("Environment_ekmug")
|
||||
projection = 1
|
||||
script = ExtResource("11_4sdwe")
|
||||
clone_camera = NodePath("../../ViewMovement/Head")
|
||||
|
||||
[node name="RightHand" type="Node3D" parent="FirstPersonViewport/Head2"]
|
||||
transform = Transform3D(0.7, 0, 0, 0, 0.7, 0, 0, 0, 0.7, 0.66, -0.255, -0.221557)
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="FirstPersonViewport/Head2/RightHand"]
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_2wknc")
|
||||
}
|
||||
[node name="RightHand" type="Node3D" parent="FirstPersonViewport/Head2" node_paths=PackedStringArray("player")]
|
||||
transform = Transform3D(0.7, 0, 0, 0, 0.7, 0, 0, 0, 0.7, 0.41, -0.17, -0.495)
|
||||
script = ExtResource("7_14ugt")
|
||||
player = NodePath("../../..")
|
||||
enable_strafe_tilt = true
|
||||
tilt_amount_x = 12.0
|
||||
tilt_amount_y = 3.0
|
||||
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"]
|
||||
transform = Transform3D(0.235, 0, 0, 0, 0.235, 0, 0, 0, 0.235, -0.665, -0.275, -0.221557)
|
||||
|
||||
[node name="SubViewport" type="SubViewport" parent="FirstPersonViewport/Head2/LeftHand"]
|
||||
transparent_bg = true
|
||||
size = Vector2i(1400, 800)
|
||||
render_target_update_mode = 4
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="FirstPersonViewport/Head2/LeftHand/SubViewport"]
|
||||
texture_filter = 1
|
||||
position = Vector2(512, 256)
|
||||
scale = Vector2(8, 8)
|
||||
texture = ExtResource("9_gxh2h")
|
||||
transform = Transform3D(0.235, 0, 0, 0, 0.235, 0, 0, 0, 0.235, -0.645, -0.26, -1.04)
|
||||
visible = false
|
||||
|
||||
[node name="SubViewport2" type="SubViewport" parent="FirstPersonViewport/Head2/LeftHand"]
|
||||
transparent_bg = true
|
||||
@@ -268,6 +244,15 @@ sorting_offset = 1.0
|
||||
texture_filter = 0
|
||||
texture = SubResource("ViewportTexture_xme80")
|
||||
|
||||
[node name="card_hand_model" parent="FirstPersonViewport/Head2/LeftHand" instance=ExtResource("11_h82f6")]
|
||||
transform = Transform3D(-4.16989, -0.848374, -3.61733e-07, -0.824933, 4.05468, -0.993384, 0.198049, -0.973442, -4.13774, 1.56596, 0.519149, 3.37051)
|
||||
|
||||
[node name="Body_004" parent="FirstPersonViewport/Head2/LeftHand/card_hand_model/Armature/Skeleton3D" index="0"]
|
||||
layers = 2
|
||||
|
||||
[node name="Cards" type="Node3D" parent="FirstPersonViewport/Head2/LeftHand"]
|
||||
transform = Transform3D(4.25532, 0, 0, 0, 4.25532, 0, 0, 0, 4.25532, 2.01277, 0.787234, 3.39179)
|
||||
|
||||
[node name="MiniMapViewport" type="SubViewport" parent="."]
|
||||
size = Vector2i(256, 256)
|
||||
render_target_update_mode = 4
|
||||
@@ -325,7 +310,7 @@ script = ExtResource("6_cf5ap")
|
||||
[node name="DiscardPile" type="Node" parent="."]
|
||||
script = ExtResource("6_cf5ap")
|
||||
|
||||
[node name="PlayerMovement" type="Node" parent="." node_paths=PackedStringArray("player", "head")]
|
||||
[node name="PlayerMovement" type="Node" parent="." node_paths=PackedStringArray("player", "head", "weapon_holder")]
|
||||
script = ExtResource("20_cfhw8")
|
||||
player = NodePath("..")
|
||||
head = NodePath("../ViewMovement")
|
||||
@@ -333,6 +318,7 @@ toggle_sprint = true
|
||||
max_look_down_angle = 80.0
|
||||
max_look_up_angle = 80.0
|
||||
enable_jumping = true
|
||||
weapon_holder = NodePath("../FirstPersonViewport/Head2/RightHand")
|
||||
|
||||
[node name="HUD" type="CanvasLayer" parent="." node_paths=PackedStringArray("player", "wave_count", "lives_count", "currency_count", "minimap_outline", "minimap", "minimap_cam", "minimap_viewport", "fps_label", "hover_text", "enemy_sprites", "enemy_counts", "wave_start_label", "place_icon", "swap_icon", "place_text", "swap_text", "new_energy_bar", "energy_label", "primary_duration", "secondary_duration")]
|
||||
script = ExtResource("8_yl6ka")
|
||||
@@ -370,6 +356,7 @@ mouse_filter = 2
|
||||
texture = SubResource("ViewportTexture_mk87g")
|
||||
|
||||
[node name="PlaceIcon" type="TextureRect" parent="HUD"]
|
||||
visible = false
|
||||
anchors_preset = 3
|
||||
anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
@@ -391,12 +378,13 @@ anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
bbcode_enabled = true
|
||||
text = "#Equip Primary Weapon#"
|
||||
text = "#Primary Fire#"
|
||||
scroll_active = false
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="SwapIcon" type="TextureRect" parent="HUD"]
|
||||
visible = false
|
||||
anchors_preset = 3
|
||||
anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
@@ -418,7 +406,7 @@ anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
bbcode_enabled = true
|
||||
text = "#Equip Secondary Weapon#"
|
||||
text = "#Secondary Fire#"
|
||||
scroll_active = false
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
@@ -781,6 +769,14 @@ text = "secondary weapon rounds left = 0"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="selection_boxes" type="HBoxContainer" parent="HUD"]
|
||||
visible = false
|
||||
offset_left = 73.0
|
||||
offset_top = 457.0
|
||||
offset_right = 753.0
|
||||
offset_bottom = 585.0
|
||||
alignment = 1
|
||||
|
||||
[node name="WeaponSwapTimer" type="Timer" parent="."]
|
||||
wait_time = 0.4
|
||||
one_shot = true
|
||||
@@ -821,3 +817,5 @@ stream = ExtResource("41_hussy")
|
||||
bus = &"SFX"
|
||||
|
||||
[connection signal="timeout" from="WeaponSwapTimer" to="." method="_on_timer_timeout"]
|
||||
|
||||
[editable path="FirstPersonViewport/Head2/LeftHand/card_hand_model"]
|
||||
|
||||
@@ -72,8 +72,8 @@ func set_energy_visible(value: bool) -> void:
|
||||
func _process(_delta: float) -> void:
|
||||
fps_label.text = "FPS: " + str(Engine.get_frames_per_second())
|
||||
wave_start_label.text = parse_action_tag("[center]Press #Ready# to start wave")
|
||||
place_text.text = parse_action_tag("[center]#Equip Primary Weapon#")
|
||||
swap_text.text = parse_action_tag("[center]#Equip Secondary Weapon#")
|
||||
place_text.text = parse_action_tag("[center]#Primary Fire#")
|
||||
swap_text.text = parse_action_tag("[center]#Secondary Fire#")
|
||||
|
||||
|
||||
func grow_wave_start_label() -> void:
|
||||
|
||||
@@ -64,6 +64,7 @@ var prev_crouch_height: float = 0.0
|
||||
var new_crouch_height: float = 0.0
|
||||
var default_camera_height: float = 0.0
|
||||
var change_crouch: bool = false
|
||||
@export var weapon_holder: WeaponMovement
|
||||
|
||||
var head_angle: float = 0.0
|
||||
var look_sens: float :
|
||||
@@ -225,6 +226,8 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
head_angle -= event.relative.y * (look_sens / zoom_factor) * (-1 if invert_y else 1)
|
||||
head_angle = clamp(head_angle, deg_to_rad(-max_look_down_angle), deg_to_rad(max_look_up_angle))
|
||||
head.rotation.x = head_angle
|
||||
if weapon_holder:
|
||||
weapon_holder.mouse_input = event.relative
|
||||
elif event is InputEventJoypadMotion:
|
||||
if event.axis == JOY_AXIS_RIGHT_X:
|
||||
look_vector.x = event.axis_value
|
||||
|
||||
42
PCs/weapon_movement.gd
Normal file
42
PCs/weapon_movement.gd
Normal file
@@ -0,0 +1,42 @@
|
||||
class_name WeaponMovement
|
||||
extends Node3D
|
||||
|
||||
@export var player: CharacterBody3D
|
||||
|
||||
@export_category("Strafe Tilting")
|
||||
@export var enable_strafe_tilt: bool = false
|
||||
@export var tilt_max_effect_speed: float = 4.317
|
||||
@export var tilt_amount_x: float = 0.75
|
||||
@export var tilt_amount_y: float = 0.0
|
||||
|
||||
@export var weapon_rotation_amount: float = 1
|
||||
@export var enable_mouse_sway: bool = true
|
||||
var mouse_input: Vector2
|
||||
var invert_weapon_sway: bool = true
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
var tilt: Vector3 = Vector3.ZERO
|
||||
var sway: Vector3 = Vector3.ZERO
|
||||
if enable_strafe_tilt:
|
||||
tilt = get_strafe_tilt(player.velocity)
|
||||
if enable_mouse_sway:
|
||||
sway = weapon_sway(delta)
|
||||
rotation = lerp(rotation, tilt + sway, 10 * delta)
|
||||
|
||||
|
||||
func get_strafe_tilt(player_velocity: Vector3) -> Vector3:
|
||||
var side_dot: float = player_velocity.normalized().dot(-global_transform.basis.z)
|
||||
var front_dot: float = player_velocity.normalized().dot(-global_transform.basis.x)
|
||||
var tilt_speed_factor: float = player_velocity.length() / tilt_max_effect_speed
|
||||
var tilt_vector: Vector3 = Vector3.ZERO
|
||||
tilt_vector.z = deg_to_rad(tilt_amount_x * front_dot * tilt_speed_factor)
|
||||
tilt_vector.x = deg_to_rad(tilt_amount_y * -side_dot * tilt_speed_factor)
|
||||
return tilt_vector
|
||||
|
||||
|
||||
func weapon_sway(delta: float) -> Vector3:
|
||||
var vector: Vector3 = Vector3.ZERO
|
||||
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)
|
||||
return vector
|
||||
1
PCs/weapon_movement.gd.uid
Normal file
1
PCs/weapon_movement.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://3wvxl8jo4uis
|
||||
Reference in New Issue
Block a user