more tweaks to leaderboard, also changed how gun points during sway
This commit is contained in:
@@ -88,6 +88,17 @@ size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
theme_override_constants/separation = 30
|
||||
|
||||
[node name="LoginStatusLabel" type="Label" parent="MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Logged in with: "
|
||||
|
||||
[node name="UserName" type="TextEdit" parent="MarginContainer/VBoxContainer"]
|
||||
custom_minimum_size = Vector2(0, 150)
|
||||
layout_mode = 2
|
||||
theme = ExtResource("2_3fflq")
|
||||
text = "Profile 1"
|
||||
placeholder_text = "Profile Name"
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
|
||||
custom_minimum_size = Vector2(0, 75)
|
||||
layout_mode = 2
|
||||
@@ -120,6 +131,7 @@ theme_override_font_sizes/font_size = 150
|
||||
text = "exit"
|
||||
|
||||
[node name="Add Leaderboard Menu" type="Control" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
@@ -154,7 +166,7 @@ grow_vertical = 2
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Add Leaderboard Menu/MarginContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="NewLeaderboardName" type="TextEdit" parent="Add Leaderboard Menu/MarginContainer/HBoxContainer"]
|
||||
[node name="NewLeaderboardName" type="LineEdit" parent="Add Leaderboard Menu/MarginContainer/HBoxContainer"]
|
||||
custom_minimum_size = Vector2(800, 0)
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
@@ -169,6 +181,7 @@ icon = ExtResource("7_ia0hc")
|
||||
[node name="Authentication" parent="." instance=ExtResource("17_m04lp")]
|
||||
layout_mode = 1
|
||||
|
||||
[connection signal="text_changed" from="MarginContainer/VBoxContainer/UserName" to="." method="_on_user_name_text_changed"]
|
||||
[connection signal="item_selected" from="MarginContainer/VBoxContainer/HBoxContainer/OptionButton" to="." method="_on_option_button_item_selected"]
|
||||
[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer/Add Leaderboard" to="." method="_on_add_leaderboard_pressed"]
|
||||
[connection signal="pressed" from="MarginContainer/VBoxContainer/Continue" to="." method="_on_continue_pressed"]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=29 format=3 uid="uid://otkecr0hcyon"]
|
||||
[gd_scene load_steps=31 format=3 uid="uid://otkecr0hcyon"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bj1y0fbjtul4a" path="res://post_processing.tscn" id="1_48lr2"]
|
||||
[ext_resource type="PackedScene" uid="uid://drwae3loscbw7" path="res://assets/player.tscn" id="1_ibypk"]
|
||||
@@ -20,6 +20,8 @@
|
||||
[ext_resource type="Terrain3DAssets" uid="uid://dal3jhw6241qg" path="res://demo/data/assets.tres" id="19_wqead"]
|
||||
[ext_resource type="PackedScene" uid="uid://b6d8oy7iuad4a" path="res://cloud1.tscn" id="20_wqead"]
|
||||
[ext_resource type="Script" uid="uid://1q8lyvac5gft" path="res://scripts/cloudSpawner.gd" id="21_mlcq0"]
|
||||
[ext_resource type="PackedScene" uid="uid://bvjrsc86n2ak0" path="res://assets/deposit_money.tscn" id="21_v6g1i"]
|
||||
[ext_resource type="PackedScene" uid="uid://bessq6hl7qsh8" path="res://assets/stats.tscn" id="22_v6g1i"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_vr1m7"]
|
||||
offsets = PackedFloat32Array(0.2, 1)
|
||||
@@ -426,3 +428,9 @@ light_color = Color(1, 0.885, 0.77, 1)
|
||||
light_energy = 15.0
|
||||
shadow_enabled = true
|
||||
spot_angle = 50.83
|
||||
|
||||
[node name="DEPOSIT MONEY" parent="." instance=ExtResource("21_v6g1i")]
|
||||
transform = Transform3D(-0.993502, 0, -0.11381, 0, 1, 0, 0.11381, 0, -0.993502, 22.3872, 2.28075, -1.67325)
|
||||
|
||||
[node name="Stats" parent="." instance=ExtResource("22_v6g1i")]
|
||||
transform = Transform3D(-0.992703, 0, -0.120587, 0, 1, 0, 0.120587, 0, -0.992703, 18.3029, 3.10808, -2.49889)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_resource type="VisualShader" load_steps=31 format=3 uid="uid://dtleyj0ot0g1n"]
|
||||
[gd_resource type="VisualShader" load_steps=31 format=3 uid="uid://moixdam5rxx7"]
|
||||
|
||||
[sub_resource type="VisualShaderNodeFresnel" id="VisualShaderNodeFresnel_jqdis"]
|
||||
default_input_values = [2, false, 3, 1.5]
|
||||
|
||||
@@ -222,6 +222,9 @@ target_position = Vector3(0, 0, -200)
|
||||
collision_mask = 105
|
||||
collide_with_areas = true
|
||||
|
||||
[node name="GunLookTarget" type="Marker3D" parent="Head/Recoil/Camera3D/BulletRay"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.265447, 0, -4.48192)
|
||||
|
||||
[node name="InteractRay" type="RayCast3D" parent="Head/Recoil/Camera3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.00322104, -0.0232438)
|
||||
target_position = Vector3(0, 0, -2.5)
|
||||
|
||||
@@ -12,8 +12,8 @@ gradient = SubResource("Gradient_idjmm")
|
||||
width = 24
|
||||
|
||||
[sub_resource type="Curve" id="Curve_idjmm"]
|
||||
_limits = [0.0, 2.0, 0.0, 24.0]
|
||||
_data = [Vector2(5, 0), 0.0, 0.66, 0, 0, Vector2(12, 2), 0.0, 0.0, 0, 0, Vector2(20, 0), -0.66, 0.0, 0, 0]
|
||||
_limits = [0.0, 1.0, 0.0, 24.0]
|
||||
_data = [Vector2(5, 0), 0.0, 0.44, 0, 0, Vector2(12, 1), 0.0, 0.0, 0, 0, Vector2(20, 0), -0.37, 0.0, 0, 0]
|
||||
point_count = 3
|
||||
|
||||
[sub_resource type="PhysicalSkyMaterial" id="PhysicalSkyMaterial_xp6wm"]
|
||||
|
||||
@@ -17,3 +17,4 @@ func _process(delta: float) -> void:
|
||||
|
||||
func interact():
|
||||
SignalBus.emit_signal("money_deposited")
|
||||
Leaderboard.save_leaderboard_data()
|
||||
|
||||
@@ -28,11 +28,17 @@ func save_leaderboard_data():
|
||||
func load_leaderboard_data():
|
||||
var auth = Firebase.Auth.auth
|
||||
var COLLECTION_ID = get_leaderboard_name()
|
||||
|
||||
if auth.localid:
|
||||
var collection: FirestoreCollection = Firebase.Firestore.collection(COLLECTION_ID)
|
||||
var task = await collection.get_doc(auth.localid)
|
||||
var result = task.get_value("high_score")
|
||||
var collection : FirestoreCollection = Firebase.Firestore.collection(COLLECTION_ID)
|
||||
|
||||
var document = await collection.get_doc(auth.localid)
|
||||
|
||||
if document:
|
||||
print(document)
|
||||
return document
|
||||
else:
|
||||
print("Failed to load document from Firebase")
|
||||
|
||||
func get_leaderboard_name():
|
||||
print("CURRENT LEADERBOARD ID",GameGlobals.all_user_leaderboards[GameGlobals.user_id][GameGlobals.last_leaderboard_id])
|
||||
return "leaderboard_" + str(GameGlobals.all_user_leaderboards[GameGlobals.user_id][GameGlobals.last_leaderboard_id])
|
||||
|
||||
@@ -8,8 +8,11 @@ var last_scene
|
||||
@onready var option_button: OptionButton = $MarginContainer/VBoxContainer/HBoxContainer/OptionButton
|
||||
@onready var add_leaderboard: Button = $"MarginContainer/VBoxContainer/HBoxContainer/Add Leaderboard"
|
||||
@onready var add_leaderboard_menu: Control = $"Add Leaderboard Menu"
|
||||
@onready var new_leaderboard_name: TextEdit = $"Add Leaderboard Menu/MarginContainer/HBoxContainer/NewLeaderboardName"
|
||||
@onready var new_leaderboard_name: LineEdit = $"Add Leaderboard Menu/MarginContainer/HBoxContainer/NewLeaderboardName"
|
||||
@onready var confirm_leaderboard_add: Button = $"Add Leaderboard Menu/MarginContainer/HBoxContainer/Confirm"
|
||||
@onready var user_name: TextEdit = $MarginContainer/VBoxContainer/UserName
|
||||
@onready var login_status_label: Label = $MarginContainer/VBoxContainer/LoginStatusLabel
|
||||
|
||||
|
||||
|
||||
func _enter_tree() -> void:
|
||||
@@ -23,6 +26,9 @@ func _ready() -> void:
|
||||
refresh_option_list()
|
||||
continue_text_check()
|
||||
|
||||
user_name.text = GameGlobals.user_names[GameGlobals.user_id]
|
||||
login_status()
|
||||
|
||||
|
||||
func _on_continue_pressed() -> void:
|
||||
var level
|
||||
@@ -79,3 +85,11 @@ func _on_confirm_pressed() -> void:
|
||||
func _on_option_button_item_selected(index: int) -> void:
|
||||
GameGlobals.last_leaderboard_id = option_button.selected
|
||||
continue_text_check()
|
||||
|
||||
|
||||
func _on_user_name_text_changed() -> void:
|
||||
GameGlobals.user_names[GameGlobals.user_id] = user_name.text
|
||||
|
||||
func login_status():
|
||||
if Firebase.Auth.check_auth_file():
|
||||
login_status_label.text = "Logged in"
|
||||
|
||||
@@ -68,6 +68,7 @@ var gun_is_holstered = false
|
||||
@onready var level_control = get_tree().current_scene
|
||||
@onready var interact_ray = $Head/Recoil/Camera3D/InteractRay
|
||||
@onready var bullet_ray = $Head/Recoil/Camera3D/BulletRay
|
||||
@onready var gun_look_target: Marker3D = $Head/Recoil/Camera3D/BulletRay/GunLookTarget
|
||||
@onready var wall_ray_1: RayCast3D = $wall_ray1
|
||||
@onready var wall_ray_2: RayCast3D = $wall_ray2
|
||||
@onready var wall_ray_3: RayCast3D = $wall_ray3
|
||||
@@ -695,12 +696,18 @@ func weapon_tilt(input_x, delta):
|
||||
camera.rotation.z = lerp(camera.rotation.z, -input_x * HEAD_TILT_AMT, 5 * delta)
|
||||
|
||||
func weapon_sway(delta):
|
||||
#aim gun at center screen
|
||||
if !gun_ray.is_colliding():
|
||||
gun.look_at(gun_look_target.global_position)
|
||||
|
||||
#apply sway
|
||||
if !ads:
|
||||
var joy_input = Vector2(Input.get_joy_axis(0,JOY_AXIS_RIGHT_X)*5,Input.get_joy_axis(0,JOY_AXIS_RIGHT_Y)*5)
|
||||
mouse_input = lerp(mouse_input, Vector2.ZERO, 10 * delta)
|
||||
joy_input = lerp(joy_input,Vector2.ZERO,10 * delta)
|
||||
weapon_holder.rotation.x = lerp(weapon_holder.rotation.x, (mouse_input.y + joy_input.y) * weapon_sway_amount, 5 * delta)
|
||||
weapon_holder.rotation.y = lerp(weapon_holder.rotation.y, (mouse_input.x + joy_input.x) * weapon_sway_amount, 5 * delta)
|
||||
|
||||
else:
|
||||
if gun != null:
|
||||
if gun.weapon_info.ads == true:
|
||||
|
||||
@@ -149,6 +149,7 @@ func load_user_data():
|
||||
|
||||
|
||||
func save_game_data(level_name):
|
||||
Leaderboard.save_leaderboard_data()
|
||||
var level_control = get_tree().current_scene
|
||||
var player = level_control.player
|
||||
var game_save_path = str("user://user_",str(GameGlobals.user_id),"_",str(GameGlobals.all_user_leaderboards[GameGlobals.user_id][GameGlobals.last_leaderboard_id]),"_last_level","_data.save")
|
||||
|
||||
@@ -10,7 +10,7 @@ extends Node3D
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
Leaderboard.load_leaderboard_data()
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
|
||||
Reference in New Issue
Block a user