add timer reset on menu selection
This commit is contained in:
parent
e57e35209e
commit
01bb4f3a4f
6 changed files with 84 additions and 69 deletions
|
@ -10,6 +10,21 @@
|
|||
radius = 8.0
|
||||
height = 34.0
|
||||
|
||||
[sub_resource type="Animation" id="Animation_3soig"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("label_round:self_modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_wl2vo"]
|
||||
resource_name = "show_rounds"
|
||||
length = 3.0
|
||||
|
@ -26,21 +41,6 @@ tracks/0/keys = {
|
|||
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_3soig"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("label_round:self_modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_55lyd"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_3soig"),
|
||||
|
|
102
scenes/game.tscn
102
scenes/game.tscn
|
@ -3,6 +3,57 @@
|
|||
[ext_resource type="Script" path="res://scripts/game.gd" id="1_7syh4"]
|
||||
[ext_resource type="Script" path="res://scripts/times.gd" id="2_80mhm"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_ph30r"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("times_container:position")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(92.1386, 36.868)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("overlaycolor:self_modulate")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 0)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("timer:self_modulate")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1)]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath("times_container:scale")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_gjxtp"]
|
||||
resource_name = "game_end"
|
||||
length = 2.0
|
||||
|
@ -55,57 +106,6 @@ tracks/3/keys = {
|
|||
"values": [Vector2(1, 1), Vector2(1.5, 1.5)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_ph30r"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("times_container:position")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(92.1386, 36.868)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("overlaycolor:self_modulate")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 0)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("timer:self_modulate")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1)]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath("times_container:scale")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_wuihg"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_ph30r"),
|
||||
|
|
|
@ -150,5 +150,7 @@ text = "Rounds:"
|
|||
wait_time = 5.0
|
||||
|
||||
[connection signal="toggled" from="MenuDisplay/btn_fullscreen" to="." method="_on_btn_fullscreen_toggled"]
|
||||
[connection signal="map_changed" from="MenuDisplay/map_container" to="." method="_on_map_container_map_changed"]
|
||||
[connection signal="item_selected" from="MenuDisplay/rounds_selection" to="." method="_on_rounds_selection_item_selected"]
|
||||
[connection signal="item_selected" from="MenuDisplay/rounds_selection" to="MenuDisplay/rounds_selection" method="_on_item_selected"]
|
||||
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]
|
||||
|
|
|
@ -14,13 +14,13 @@ extends Node2D
|
|||
|
||||
const caroffset= 32+4 #space cars on start line
|
||||
|
||||
var viewCarMargin=Vector2(0.7,0.7) #1=zoom out full speed when car is at border. 0.9 zoom out full speed when car is 10% away from border
|
||||
var viewCarMargin=Vector2(0.6,0.6) #1=zoom out full speed when car is at border. 0.9 zoom out full speed when car is 10% away from border
|
||||
var viewCarMargin_zoomstart=viewCarMargin-Vector2(0.2,0.2) #start zooming
|
||||
var viewCarMargin_zoombackup=viewCarMargin_zoomstart-Vector2(0.1,0.1) #start zooming back in
|
||||
var zoomspeed=0.5
|
||||
var zoomspeed_backup=0.1 #relative to screen size
|
||||
var zoom_normal=1.5
|
||||
const CAMERA_POSITION_SPEED=0.05 #0.0 - 1.0, higher=faster
|
||||
const CAMERA_POSITION_SPEED=0.5 #0.0 - 1.0, higher=faster
|
||||
|
||||
var running=false
|
||||
|
||||
|
@ -103,7 +103,8 @@ func _process(delta: float) -> void:
|
|||
|
||||
meanCarPosition/=displayedCarCount
|
||||
|
||||
camera.position=lerp(camera.position,meanCarPosition,CAMERA_POSITION_SPEED)
|
||||
#camera.position=lerp(camera.position,meanCarPosition,CAMERA_POSITION_SPEED)
|
||||
camera.position=meanCarPosition
|
||||
|
||||
|
||||
var viewsize = camera.get_viewport_rect().size
|
||||
|
|
|
@ -3,6 +3,8 @@ extends HFlowContainer
|
|||
var button_prefix="btn_map_"
|
||||
var disabled_mod_color=Color(0.3,0.3,0.3,1.0)
|
||||
|
||||
signal map_changed
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
for btn in get_children():
|
||||
|
@ -13,6 +15,7 @@ func _ready() -> void:
|
|||
|
||||
|
||||
func _on_btn_map(btn):
|
||||
map_changed.emit()
|
||||
for b in get_children():
|
||||
b.self_modulate=disabled_mod_color #show all others disabled
|
||||
btn.self_modulate=Color(1,1,1,1) #show selected enabled
|
||||
|
|
|
@ -3,6 +3,7 @@ extends Node
|
|||
|
||||
@onready var countdown: Label = $MenuDisplay/countdown
|
||||
|
||||
|
||||
func _ready():
|
||||
removeAssignedKeys()
|
||||
Gamestate.removeAllPlayers()
|
||||
|
@ -38,6 +39,7 @@ func _unhandled_key_input(event: InputEvent) -> void:
|
|||
|
||||
|
||||
|
||||
|
||||
func _on_timer_timeout() -> void: #Start Game
|
||||
print("Game starting")
|
||||
get_tree().change_scene_to_file("res://scenes/game.tscn")
|
||||
|
@ -63,3 +65,10 @@ func _on_btn_fullscreen_toggled(toggled_on: bool) -> void:
|
|||
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
|
||||
else:
|
||||
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
|
||||
|
||||
|
||||
func _on_rounds_selection_item_selected(index: int) -> void:
|
||||
$Timer.start()
|
||||
|
||||
func _on_map_container_map_changed() -> void:
|
||||
$Timer.start()
|
||||
|
|
Loading…
Reference in a new issue