mirror of
https://github.com/Nokorpo/LibreAim.git
synced 2025-06-11 02:13:43 +09:00
timer and kills counter
This commit is contained in:
parent
47f0d06250
commit
67c5576b4f
4 changed files with 111 additions and 8 deletions
6
assets/fonts/100_outline.tres
Normal file
6
assets/fonts/100_outline.tres
Normal file
|
@ -0,0 +1,6 @@
|
|||
[gd_resource type="LabelSettings" format=3 uid="uid://crnxcugovdaio"]
|
||||
|
||||
[resource]
|
||||
font_size = 100
|
||||
outline_size = 10
|
||||
outline_color = Color(0, 0, 0, 1)
|
|
@ -1,10 +1,11 @@
|
|||
[gd_scene load_steps=12 format=3 uid="uid://cdbhv0p0jfr75"]
|
||||
[gd_scene load_steps=17 format=3 uid="uid://cdbhv0p0jfr75"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/levels/World.gd" id="1_02ggb"]
|
||||
[ext_resource type="Script" path="res://scripts/characters/CharacterBody3D.gd" id="1_77co2"]
|
||||
[ext_resource type="Texture2D" uid="uid://mhv5qf7fdeig" path="res://assets/images/texture_08.png" id="1_s1bsx"]
|
||||
[ext_resource type="Script" path="res://scripts/ui/Crosshair.gd" id="4_jkxyl"]
|
||||
[ext_resource type="Script" path="res://scripts/levels/Pause.gd" id="5_4wxgd"]
|
||||
[ext_resource type="LabelSettings" uid="uid://crnxcugovdaio" path="res://assets/fonts/100_outline.tres" id="5_k01xn"]
|
||||
|
||||
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_hein3"]
|
||||
sky_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
|
||||
|
@ -29,6 +30,48 @@ points = PackedVector3Array(-0.125207, -0.532801, -0.480507, 0.0227831, 0.47607,
|
|||
|
||||
[sub_resource type="CapsuleMesh" id="CapsuleMesh_41626"]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_rkont"]
|
||||
font_size = 300
|
||||
outline_size = 30
|
||||
outline_color = Color(0, 0, 0, 1)
|
||||
|
||||
[sub_resource type="Animation" id="Animation_jsqua"]
|
||||
resource_name = "kill"
|
||||
length = 0.2
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Player/Head/Kill:visible")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [true, true, false]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_8dsmr"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Player/Head/Kill:visible")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_s0jl0"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_8dsmr"),
|
||||
"kill": SubResource("Animation_jsqua")
|
||||
}
|
||||
|
||||
[node name="World" type="Node3D"]
|
||||
script = ExtResource("1_02ggb")
|
||||
|
||||
|
@ -116,6 +159,40 @@ size_flags_horizontal = 0
|
|||
size_flags_vertical = 0
|
||||
script = ExtResource("4_jkxyl")
|
||||
|
||||
[node name="Kill" type="Label" parent="Player/Head"]
|
||||
anchors_preset = 5
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
offset_left = -93.5
|
||||
offset_top = 50.0
|
||||
offset_right = 93.5
|
||||
offset_bottom = 462.0
|
||||
grow_horizontal = 2
|
||||
text = "X"
|
||||
label_settings = SubResource("LabelSettings_rkont")
|
||||
|
||||
[node name="Timer" type="Label" parent="Player/Head"]
|
||||
offset_left = 100.0
|
||||
offset_top = 50.0
|
||||
offset_right = 140.0
|
||||
offset_bottom = 138.0
|
||||
text = "60s"
|
||||
label_settings = ExtResource("5_k01xn")
|
||||
|
||||
[node name="Kills" type="Label" parent="Player/Head"]
|
||||
offset_left = 100.0
|
||||
offset_top = 150.0
|
||||
offset_right = 140.0
|
||||
offset_bottom = 250.0
|
||||
text = "0"
|
||||
label_settings = ExtResource("5_k01xn")
|
||||
|
||||
[node name="AnimationKill" type="AnimationPlayer" parent="Player/Head"]
|
||||
root_node = NodePath("../../..")
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_s0jl0")
|
||||
}
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="Pause" type="Control" parent="CanvasLayer"]
|
||||
|
@ -161,6 +238,9 @@ text = "Resume"
|
|||
layout_mode = 2
|
||||
text = "Menu"
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
|
||||
[connection signal="pause_game" from="Player" to="CanvasLayer/Pause" method="_on_player_pause_game"]
|
||||
[connection signal="pressed" from="CanvasLayer/Pause/Buttons/Resume" to="CanvasLayer/Pause" method="_on_resume_pressed"]
|
||||
[connection signal="pressed" from="CanvasLayer/Pause/Buttons/Menu" to="CanvasLayer/Pause" method="_on_menu_pressed"]
|
||||
[connection signal="timeout" from="Timer" to="Player" method="_on_timer_timeout"]
|
||||
|
|
|
@ -12,15 +12,18 @@ var user_sensitivity = 0.14
|
|||
var mouse_sensitivity = 0.00990624999999999
|
||||
|
||||
var spread_bullets = true
|
||||
var count_down_started = false
|
||||
var damage = 10
|
||||
var shot_count = 0
|
||||
|
||||
var seconds = 5
|
||||
|
||||
var direction = Vector3()
|
||||
|
||||
@onready var head = $Head
|
||||
@onready var camera = $Head/Camera3D
|
||||
@onready var raycast = $Head/Camera3D/RayCast3D
|
||||
@onready var timer = $"../Timer"
|
||||
@onready var timer_label = $Head/Timer
|
||||
@onready var bullet_hole = preload("res://scenes/ui/BulletHole.tscn")
|
||||
|
||||
# Get the gravity from the project settings to be synced with RigidBody nodes.
|
||||
|
@ -28,6 +31,7 @@ var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
|
|||
|
||||
func _ready():
|
||||
emit_signal("pause_game", false)
|
||||
timer_label.set_text((str(seconds) + "s"))
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||
if DataManager.get_data("sensitivity_game_value"):
|
||||
conversion_sensitivity = DataManager.get_data("sensitivity_game_value")
|
||||
|
@ -49,8 +53,8 @@ func fire():
|
|||
if target.is_in_group("Enemy"):
|
||||
target.health -= damage
|
||||
shot_count += 1
|
||||
if (!count_down_started):
|
||||
count_down_started = true
|
||||
if (timer.is_stopped()):
|
||||
timer.start()
|
||||
|
||||
func _input(event):
|
||||
if event is InputEventMouseMotion:
|
||||
|
@ -109,3 +113,12 @@ func random_spread() -> float:
|
|||
velocity_spread = velocity.length()
|
||||
randomize()
|
||||
return deg_to_rad(randf_range(-spread, spread) * velocity_spread)
|
||||
|
||||
|
||||
func _on_timer_timeout():
|
||||
seconds -= 1
|
||||
timer_label.set_text((str(seconds) + "s"))
|
||||
if (int(seconds) <= -1):
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||
get_tree().change_scene_to_file("res://scenes/ui/MainScreen.tscn")
|
||||
|
||||
|
|
|
@ -5,7 +5,9 @@ var location_target = Vector3()
|
|||
var count_kills = 0
|
||||
var id_spawn_target = 0
|
||||
|
||||
|
||||
@onready var animation_kill = $Player/Head/AnimationKill
|
||||
@onready var kill = $Player/Head/Kill
|
||||
@onready var kills = $Player/Head/Kills
|
||||
#@onready var anim_hit = $FPS/Head/Camera3D/AnimationHit
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
|
@ -13,6 +15,8 @@ func _ready():
|
|||
id_spawn_target = 0
|
||||
count_kills = 0
|
||||
|
||||
kill.visible = false
|
||||
|
||||
for x in range(Global.game_type.number_of_initial_targets):
|
||||
spawn_target()
|
||||
|
||||
|
@ -61,9 +65,9 @@ func spawn_target():
|
|||
|
||||
func messageHit():
|
||||
count_kills += 1
|
||||
#$FPS/Head/Camera3D/LeftVBoxContainer/Kills.set_text((str(count_kills)))
|
||||
#if not anim_hit.is_playing():
|
||||
# anim_hit.play("animationHit")
|
||||
kills.set_text((str(count_kills)))
|
||||
if not animation_kill.is_playing():
|
||||
animation_kill.play("kill")
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(_delta):
|
||||
pass
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue