Compare commits
2 Commits
056e346a96
...
1b29065bf8
| Author | SHA1 | Date | |
|---|---|---|---|
| 1b29065bf8 | |||
| b64430e10b |
@@ -1,6 +1,6 @@
|
|||||||
extends Node2D
|
extends Node2D
|
||||||
|
|
||||||
signal race_started
|
signal completed()
|
||||||
|
|
||||||
export (int) var delay = 3
|
export (int) var delay = 3
|
||||||
var timer
|
var timer
|
||||||
@@ -32,7 +32,7 @@ func _timeout():
|
|||||||
elif time_left == 0:
|
elif time_left == 0:
|
||||||
# Go !
|
# Go !
|
||||||
$Number.set_text("GO")
|
$Number.set_text("GO")
|
||||||
emit_signal("race_started")
|
emit_signal("completed")
|
||||||
else:
|
else:
|
||||||
$Number.set_text("%d" % time_left)
|
$Number.set_text("%d" % time_left)
|
||||||
|
|
||||||
17
Global.gd
17
Global.gd
@@ -1,5 +1,20 @@
|
|||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
|
signal laps_changed(value)
|
||||||
|
|
||||||
|
enum InputMode { MOUSE, KEYBOARD }
|
||||||
|
enum GameMode { TRAIN, EASY }
|
||||||
|
enum PlayerSkin { CAR, POLICE, BUS }
|
||||||
|
|
||||||
var race_started = false
|
var race_started = false
|
||||||
var laps = 0
|
var laps = 0 setget set_laps
|
||||||
|
|
||||||
|
func set_laps(value):
|
||||||
|
laps = value
|
||||||
|
emit_signal("laps_changed", value)
|
||||||
|
|
||||||
|
var settings = {
|
||||||
|
"input_mode": null,
|
||||||
|
"game_mode": null,
|
||||||
|
"player_skin": null,
|
||||||
|
}
|
||||||
|
|||||||
2
Gui.gd
2
Gui.gd
@@ -4,7 +4,7 @@ onready var lap_counter = get_node("Laps/Value")
|
|||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
pass # Replace with function body.
|
Global.connect("laps_changed", self, "_on_lap_completed")
|
||||||
|
|
||||||
func _on_lap_completed(laps):
|
func _on_lap_completed(laps):
|
||||||
lap_counter.set_text("%d" % laps)
|
lap_counter.set_text("%d" % laps)
|
||||||
|
|||||||
14
Main.gd
14
Main.gd
@@ -1,14 +1,20 @@
|
|||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
get_tree().paused = true
|
||||||
|
|
||||||
func start_game():
|
func start_game():
|
||||||
print("Game starting")
|
|
||||||
$Menu.set_visible(false)
|
$Menu.set_visible(false)
|
||||||
yield($Countdown.start(), "race_started")
|
if not Global.race_started:
|
||||||
Global.race_started = true
|
print("Game starting")
|
||||||
|
Global.race_started = true
|
||||||
|
$GUI.set_visible(true)
|
||||||
|
yield($Countdown.start(), "completed")
|
||||||
|
get_tree().paused = false
|
||||||
|
|
||||||
func pause_game():
|
func pause_game():
|
||||||
$Menu.set_visible(true)
|
$Menu.set_visible(true)
|
||||||
Global.race_started = false
|
get_tree().paused = true
|
||||||
|
|
||||||
func _input(event):
|
func _input(event):
|
||||||
if event.is_action_pressed("ui_cancel"):
|
if event.is_action_pressed("ui_cancel"):
|
||||||
|
|||||||
11
Main.tscn
11
Main.tscn
@@ -1,9 +1,11 @@
|
|||||||
[gd_scene load_steps=5 format=2]
|
[gd_scene load_steps=7 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://Main.gd" type="Script" id=1]
|
[ext_resource path="res://Main.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://RaceTrack.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://RaceTrack.tscn" type="PackedScene" id=2]
|
||||||
[ext_resource path="res://Menu.tscn" type="PackedScene" id=3]
|
[ext_resource path="res://Menu.tscn" type="PackedScene" id=3]
|
||||||
[ext_resource path="res://Countdown.tscn" type="PackedScene" id=4]
|
[ext_resource path="res://Countdown.tscn" type="PackedScene" id=4]
|
||||||
|
[ext_resource path="res://Gui.tscn" type="PackedScene" id=5]
|
||||||
|
[ext_resource path="res://Gui.gd" type="Script" id=6]
|
||||||
|
|
||||||
[node name="Main" type="Node"]
|
[node name="Main" type="Node"]
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
@@ -11,9 +13,14 @@ script = ExtResource( 1 )
|
|||||||
[node name="RaceTrack" parent="." instance=ExtResource( 2 )]
|
[node name="RaceTrack" parent="." instance=ExtResource( 2 )]
|
||||||
|
|
||||||
[node name="Menu" parent="." instance=ExtResource( 3 )]
|
[node name="Menu" parent="." instance=ExtResource( 3 )]
|
||||||
|
pause_mode = 2
|
||||||
|
|
||||||
[node name="Countdown" parent="." instance=ExtResource( 4 )]
|
[node name="Countdown" parent="." instance=ExtResource( 4 )]
|
||||||
|
pause_mode = 2
|
||||||
visible = false
|
visible = false
|
||||||
delay = 3
|
delay = 3
|
||||||
|
|
||||||
|
[node name="GUI" parent="." instance=ExtResource( 5 )]
|
||||||
|
visible = false
|
||||||
|
script = ExtResource( 6 )
|
||||||
[connection signal="game_started" from="Menu" to="." method="start_game"]
|
[connection signal="game_started" from="Menu" to="." method="start_game"]
|
||||||
[connection signal="track_changed" from="Menu" to="RaceTrack" method="_on_Menu_track_changed"]
|
|
||||||
|
|||||||
111
Menu.gd
111
Menu.gd
@@ -1,57 +1,82 @@
|
|||||||
extends Control
|
extends Control
|
||||||
|
|
||||||
signal game_started()
|
signal game_started()
|
||||||
signal track_changed()
|
|
||||||
signal skin_changed(skin)
|
signal skin_changed(skin)
|
||||||
|
|
||||||
enum Actions { PLAY, CHANGE_TRACK, QUIT }
|
enum Actions {
|
||||||
var _focus = null setget _set_focus
|
PLAY,
|
||||||
|
ENTER_OPTIONS,
|
||||||
|
EXIT_OPTIONS,
|
||||||
|
NEXT_TRACK,
|
||||||
|
PREV_TRACK,
|
||||||
|
# PREV_SKIN,
|
||||||
|
# NEXT_SKIN,
|
||||||
|
# PREV_INPUT_MODE,
|
||||||
|
# NEXT_INPUT_MODE,
|
||||||
|
# PREV_GAME_MODE,
|
||||||
|
# NEXT_GAME_MODE,
|
||||||
|
QUIT,
|
||||||
|
}
|
||||||
|
var actions = {} # Registered actions
|
||||||
|
var _focus = null # The node that has focus
|
||||||
|
|
||||||
|
|
||||||
func _set_focus(value):
|
|
||||||
_focus = value
|
|
||||||
print("New focus: ", value)
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready():
|
func _ready():
|
||||||
pass # Replace with function body.
|
_connect_action("Main/Jouer", Actions.PLAY)
|
||||||
|
_connect_action("Main/Options", Actions.ENTER_OPTIONS)
|
||||||
|
_connect_action("Main/Quitter", Actions.QUIT)
|
||||||
|
|
||||||
|
_connect_action("Options/Return", Actions.EXIT_OPTIONS)
|
||||||
|
_connect_action("Options/TrackSelection/LeftArrow", Actions.PREV_TRACK)
|
||||||
|
_connect_action("Options/TrackSelection/RightArrow", Actions.NEXT_TRACK)
|
||||||
|
|
||||||
|
TrackSelection.connect("track_changed", self, "_on_track_changed")
|
||||||
|
_on_track_changed()
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
#func _process(delta):
|
|
||||||
# pass
|
|
||||||
|
|
||||||
func _input(event):
|
func _input(event):
|
||||||
if event is InputEventMouseButton:
|
# TODO: Handle navigation
|
||||||
if _focus != null:
|
if event is InputEventMouseButton and _focus != null:
|
||||||
if event.button_index == BUTTON_LEFT and event.pressed:
|
if event.button_index == BUTTON_LEFT and event.pressed:
|
||||||
match _focus:
|
match actions[_focus]:
|
||||||
Actions.PLAY:
|
Actions.PLAY:
|
||||||
emit_signal("game_started")
|
emit_signal("game_started")
|
||||||
Actions.CHANGE_TRACK:
|
Actions.ENTER_OPTIONS:
|
||||||
emit_signal("track_changed")
|
$Main.set_visible(false)
|
||||||
Actions.QUIT:
|
$Options.set_visible(true)
|
||||||
get_tree().quit()
|
Actions.EXIT_OPTIONS:
|
||||||
|
$Main.set_visible(true)
|
||||||
|
$Options.set_visible(false)
|
||||||
|
Actions.QUIT:
|
||||||
|
get_tree().quit()
|
||||||
|
Actions.PREV_TRACK:
|
||||||
|
TrackSelection.set_previous_track()
|
||||||
|
Actions.NEXT_TRACK:
|
||||||
|
TrackSelection.set_next_track()
|
||||||
|
|
||||||
func _on_Jouer_mouse_exited():
|
|
||||||
get_node("Main/Jouer").set("custom_colors/font_color", Color.white)
|
func _on_track_changed():
|
||||||
|
get_node("Options/TrackSelection/Value").set_text(TrackSelection.get_current_track_name())
|
||||||
|
|
||||||
|
|
||||||
|
func _connect_action(node_path, action):
|
||||||
|
var node = get_node(node_path)
|
||||||
|
node.connect("mouse_entered", self, "set_focus", [node])
|
||||||
|
node.connect("mouse_exited", self, "leave_focus", [node])
|
||||||
|
actions[node] = action
|
||||||
|
|
||||||
|
|
||||||
|
func set_focus(node):
|
||||||
|
_set_active(true, node)
|
||||||
|
_focus = node
|
||||||
|
|
||||||
|
|
||||||
|
func leave_focus(node):
|
||||||
|
_set_active(false, node)
|
||||||
_focus = null
|
_focus = null
|
||||||
|
|
||||||
|
|
||||||
func _on_Jouer_mouse_entered():
|
func _set_active(is_active, node):
|
||||||
get_node("Main/Jouer").set("custom_colors/font_color", Color.orange)
|
# Updates the focus effect for node
|
||||||
_set_focus(Actions.PLAY)
|
var color = Color.orange if is_active else Color.white
|
||||||
|
node.set("custom_colors/font_color", color)
|
||||||
func _on_Options_mouse_exited():
|
|
||||||
get_node("Main/Options").set("custom_colors/font_color", Color.white)
|
|
||||||
_focus = null
|
|
||||||
|
|
||||||
func _on_Options_mouse_entered():
|
|
||||||
get_node("Main/Options").set("custom_colors/font_color", Color.orange)
|
|
||||||
_set_focus(Actions.CHANGE_TRACK)
|
|
||||||
|
|
||||||
|
|
||||||
func _on_Quitter_mouse_entered():
|
|
||||||
get_node("Main/Quitter").set("custom_colors/font_color", Color.orange)
|
|
||||||
_set_focus(Actions.QUIT)
|
|
||||||
|
|
||||||
func _on_Quitter_mouse_exited():
|
|
||||||
get_node("Main/Quitter").set("custom_colors/font_color", Color.white)
|
|
||||||
_focus = null
|
|
||||||
219
Menu.tscn
219
Menu.tscn
@@ -1,14 +1,7 @@
|
|||||||
[gd_scene load_steps=5 format=2]
|
[gd_scene load_steps=3 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://Menu.gd" type="Script" id=1]
|
[ext_resource path="res://Menu.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://Oswald-Bold.otf" type="DynamicFontData" id=2]
|
[ext_resource path="res://font.tres" type="DynamicFont" id=2]
|
||||||
[ext_resource path="res://font.tres" type="DynamicFont" id=3]
|
|
||||||
|
|
||||||
[sub_resource type="DynamicFont" id=1]
|
|
||||||
resource_name = "BaseFont"
|
|
||||||
size = 60
|
|
||||||
use_filter = true
|
|
||||||
font_data = ExtResource( 2 )
|
|
||||||
|
|
||||||
[node name="Menu" type="Control"]
|
[node name="Menu" type="Control"]
|
||||||
margin_right = 1920.0
|
margin_right = 1920.0
|
||||||
@@ -19,36 +12,198 @@ script = ExtResource( 1 )
|
|||||||
[node name="Title" type="Label" parent="."]
|
[node name="Title" type="Label" parent="."]
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
anchor_right = 0.5
|
anchor_right = 0.5
|
||||||
margin_left = -222.36
|
margin_left = -960.0
|
||||||
margin_top = 201.721
|
margin_top = 202.0
|
||||||
margin_right = 20.6399
|
margin_bottom = 285.0
|
||||||
margin_bottom = 284.721
|
|
||||||
rect_scale = Vector2( 2, 2 )
|
rect_scale = Vector2( 2, 2 )
|
||||||
custom_fonts/font = SubResource( 1 )
|
custom_fonts/font = ExtResource( 2 )
|
||||||
custom_colors/font_color = Color( 0.921569, 0.564706, 0.0627451, 1 )
|
custom_colors/font_color = Color( 0.921569, 0.564706, 0.0627451, 1 )
|
||||||
custom_colors/font_color_shadow = Color( 0.423529, 0.2, 0.0352941, 1 )
|
custom_colors/font_color_shadow = Color( 0.423529, 0.2, 0.0352941, 1 )
|
||||||
custom_constants/shadow_offset_x = 2
|
custom_constants/shadow_offset_x = 2
|
||||||
custom_constants/shadow_offset_y = 3
|
custom_constants/shadow_offset_y = 3
|
||||||
custom_constants/shadow_as_outline = 0
|
custom_constants/shadow_as_outline = 0
|
||||||
text = "Car Racer"
|
text = "Car Racer"
|
||||||
|
align = 1
|
||||||
|
valign = 1
|
||||||
|
|
||||||
|
[node name="Options" type="VBoxContainer" parent="."]
|
||||||
|
visible = false
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
margin_left = -960.0
|
||||||
|
margin_top = -89.937
|
||||||
|
margin_bottom = 421.063
|
||||||
|
rect_scale = Vector2( 2, 2 )
|
||||||
|
|
||||||
|
[node name="TrackSelection" type="HBoxContainer" parent="Options"]
|
||||||
|
margin_right = 960.0
|
||||||
|
margin_bottom = 66.0
|
||||||
|
custom_constants/separation = 20
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="Options/TrackSelection"]
|
||||||
|
margin_left = 213.0
|
||||||
|
margin_right = 539.0
|
||||||
|
margin_bottom = 66.0
|
||||||
|
mouse_filter = 0
|
||||||
|
custom_fonts/font = ExtResource( 2 )
|
||||||
|
text = "Piste de course :"
|
||||||
|
align = 1
|
||||||
|
valign = 1
|
||||||
|
|
||||||
|
[node name="LeftArrow" type="Label" parent="Options/TrackSelection"]
|
||||||
|
margin_left = 559.0
|
||||||
|
margin_right = 578.0
|
||||||
|
margin_bottom = 66.0
|
||||||
|
mouse_filter = 0
|
||||||
|
custom_fonts/font = ExtResource( 2 )
|
||||||
|
custom_colors/font_color_shadow = Color( 0.835294, 0.552941, 0.145098, 1 )
|
||||||
|
custom_constants/shadow_offset_x = 2
|
||||||
|
custom_constants/shadow_offset_y = 3
|
||||||
|
text = "<"
|
||||||
|
|
||||||
|
[node name="Value" type="Label" parent="Options/TrackSelection"]
|
||||||
|
margin_left = 598.0
|
||||||
|
margin_right = 708.0
|
||||||
|
margin_bottom = 66.0
|
||||||
|
custom_fonts/font = ExtResource( 2 )
|
||||||
|
text = "Démo"
|
||||||
|
|
||||||
|
[node name="RightArrow" type="Label" parent="Options/TrackSelection"]
|
||||||
|
margin_left = 728.0
|
||||||
|
margin_right = 747.0
|
||||||
|
margin_bottom = 66.0
|
||||||
|
mouse_filter = 0
|
||||||
|
custom_fonts/font = ExtResource( 2 )
|
||||||
|
custom_colors/font_color_shadow = Color( 0.835294, 0.552941, 0.145098, 1 )
|
||||||
|
custom_constants/shadow_offset_x = 2
|
||||||
|
custom_constants/shadow_offset_y = 3
|
||||||
|
text = ">"
|
||||||
|
|
||||||
|
[node name="GameMode" type="HBoxContainer" parent="Options"]
|
||||||
|
margin_top = 70.0
|
||||||
|
margin_right = 960.0
|
||||||
|
margin_bottom = 136.0
|
||||||
|
custom_constants/separation = 20
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="Options/GameMode"]
|
||||||
|
margin_left = 195.0
|
||||||
|
margin_right = 403.0
|
||||||
|
margin_bottom = 66.0
|
||||||
|
mouse_filter = 0
|
||||||
|
custom_fonts/font = ExtResource( 2 )
|
||||||
|
text = "Difficulté :"
|
||||||
|
align = 1
|
||||||
|
valign = 1
|
||||||
|
|
||||||
|
[node name="LeftArrow" type="Label" parent="Options/GameMode"]
|
||||||
|
margin_left = 423.0
|
||||||
|
margin_right = 442.0
|
||||||
|
margin_bottom = 66.0
|
||||||
|
mouse_filter = 0
|
||||||
|
custom_fonts/font = ExtResource( 2 )
|
||||||
|
custom_colors/font_color_shadow = Color( 0.835294, 0.552941, 0.145098, 1 )
|
||||||
|
custom_constants/shadow_offset_x = 2
|
||||||
|
custom_constants/shadow_offset_y = 3
|
||||||
|
text = "<"
|
||||||
|
|
||||||
|
[node name="Value" type="Label" parent="Options/GameMode"]
|
||||||
|
margin_left = 462.0
|
||||||
|
margin_right = 725.0
|
||||||
|
margin_bottom = 66.0
|
||||||
|
custom_fonts/font = ExtResource( 2 )
|
||||||
|
text = "Entraînement"
|
||||||
|
|
||||||
|
[node name="RightArrow" type="Label" parent="Options/GameMode"]
|
||||||
|
margin_left = 745.0
|
||||||
|
margin_right = 764.0
|
||||||
|
margin_bottom = 66.0
|
||||||
|
mouse_filter = 0
|
||||||
|
custom_fonts/font = ExtResource( 2 )
|
||||||
|
custom_colors/font_color_shadow = Color( 0.835294, 0.552941, 0.145098, 1 )
|
||||||
|
custom_constants/shadow_offset_x = 2
|
||||||
|
custom_constants/shadow_offset_y = 3
|
||||||
|
text = ">"
|
||||||
|
|
||||||
|
[node name="InputMode" type="HBoxContainer" parent="Options"]
|
||||||
|
margin_top = 140.0
|
||||||
|
margin_right = 960.0
|
||||||
|
margin_bottom = 206.0
|
||||||
|
custom_constants/separation = 20
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="Options/InputMode"]
|
||||||
|
margin_left = 245.0
|
||||||
|
margin_right = 493.0
|
||||||
|
margin_bottom = 66.0
|
||||||
|
mouse_filter = 0
|
||||||
|
custom_fonts/font = ExtResource( 2 )
|
||||||
|
text = "Contrôlleur :"
|
||||||
|
align = 1
|
||||||
|
valign = 1
|
||||||
|
|
||||||
|
[node name="LeftArrow" type="Label" parent="Options/InputMode"]
|
||||||
|
margin_left = 513.0
|
||||||
|
margin_right = 532.0
|
||||||
|
margin_bottom = 66.0
|
||||||
|
mouse_filter = 0
|
||||||
|
custom_fonts/font = ExtResource( 2 )
|
||||||
|
custom_colors/font_color_shadow = Color( 0.835294, 0.552941, 0.145098, 1 )
|
||||||
|
custom_constants/shadow_offset_x = 2
|
||||||
|
custom_constants/shadow_offset_y = 3
|
||||||
|
text = "<"
|
||||||
|
|
||||||
|
[node name="Value" type="Label" parent="Options/InputMode"]
|
||||||
|
margin_left = 552.0
|
||||||
|
margin_right = 675.0
|
||||||
|
margin_bottom = 66.0
|
||||||
|
custom_fonts/font = ExtResource( 2 )
|
||||||
|
text = "Souris"
|
||||||
|
|
||||||
|
[node name="RightArrow" type="Label" parent="Options/InputMode"]
|
||||||
|
margin_left = 695.0
|
||||||
|
margin_right = 714.0
|
||||||
|
margin_bottom = 66.0
|
||||||
|
mouse_filter = 0
|
||||||
|
custom_fonts/font = ExtResource( 2 )
|
||||||
|
custom_colors/font_color_shadow = Color( 0.835294, 0.552941, 0.145098, 1 )
|
||||||
|
custom_constants/shadow_offset_x = 2
|
||||||
|
custom_constants/shadow_offset_y = 3
|
||||||
|
text = ">"
|
||||||
|
|
||||||
|
[node name="Return" type="Label" parent="Options"]
|
||||||
|
margin_top = 210.0
|
||||||
|
margin_right = 960.0
|
||||||
|
margin_bottom = 276.0
|
||||||
|
mouse_filter = 0
|
||||||
|
custom_fonts/font = ExtResource( 2 )
|
||||||
|
custom_colors/font_color = Color( 1, 1, 1, 1 )
|
||||||
|
custom_colors/font_color_shadow = Color( 0.823529, 0.517647, 0.0823529, 1 )
|
||||||
|
custom_constants/shadow_offset_x = 2
|
||||||
|
custom_constants/shadow_offset_y = 3
|
||||||
|
text = "Retour"
|
||||||
|
align = 1
|
||||||
|
valign = 1
|
||||||
|
|
||||||
[node name="Main" type="VBoxContainer" parent="."]
|
[node name="Main" type="VBoxContainer" parent="."]
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
anchor_top = 0.5
|
anchor_top = 0.5
|
||||||
anchor_right = 0.5
|
anchor_right = 0.5
|
||||||
anchor_bottom = 0.5
|
anchor_bottom = 0.5
|
||||||
margin_left = -139.571
|
margin_left = -960.0
|
||||||
margin_top = -76.9716
|
margin_top = -76.972
|
||||||
margin_right = 9.42896
|
margin_bottom = 180.028
|
||||||
margin_bottom = 129.028
|
|
||||||
rect_scale = Vector2( 2, 2 )
|
rect_scale = Vector2( 2, 2 )
|
||||||
mouse_default_cursor_shape = 9
|
mouse_default_cursor_shape = 9
|
||||||
|
|
||||||
[node name="Jouer" type="Label" parent="Main"]
|
[node name="Jouer" type="Label" parent="Main"]
|
||||||
margin_right = 149.0
|
margin_right = 960.0
|
||||||
margin_bottom = 66.0
|
margin_bottom = 66.0
|
||||||
mouse_filter = 0
|
mouse_filter = 0
|
||||||
custom_fonts/font = ExtResource( 3 )
|
custom_fonts/font = ExtResource( 2 )
|
||||||
custom_colors/font_color = Color( 1, 1, 1, 1 )
|
custom_colors/font_color = Color( 1, 1, 1, 1 )
|
||||||
custom_colors/font_color_shadow = Color( 0.823529, 0.517647, 0.0823529, 1 )
|
custom_colors/font_color_shadow = Color( 0.823529, 0.517647, 0.0823529, 1 )
|
||||||
custom_constants/shadow_offset_x = 2
|
custom_constants/shadow_offset_x = 2
|
||||||
@@ -59,10 +214,10 @@ valign = 1
|
|||||||
|
|
||||||
[node name="Options" type="Label" parent="Main"]
|
[node name="Options" type="Label" parent="Main"]
|
||||||
margin_top = 70.0
|
margin_top = 70.0
|
||||||
margin_right = 149.0
|
margin_right = 960.0
|
||||||
margin_bottom = 136.0
|
margin_bottom = 136.0
|
||||||
mouse_filter = 0
|
mouse_filter = 0
|
||||||
custom_fonts/font = ExtResource( 3 )
|
custom_fonts/font = ExtResource( 2 )
|
||||||
custom_colors/font_color = Color( 1, 1, 1, 1 )
|
custom_colors/font_color = Color( 1, 1, 1, 1 )
|
||||||
custom_colors/font_color_shadow = Color( 0.823529, 0.517647, 0.0823529, 1 )
|
custom_colors/font_color_shadow = Color( 0.823529, 0.517647, 0.0823529, 1 )
|
||||||
custom_constants/shadow_offset_x = 2
|
custom_constants/shadow_offset_x = 2
|
||||||
@@ -72,29 +227,13 @@ align = 1
|
|||||||
|
|
||||||
[node name="Quitter" type="Label" parent="Main"]
|
[node name="Quitter" type="Label" parent="Main"]
|
||||||
margin_top = 140.0
|
margin_top = 140.0
|
||||||
margin_right = 149.0
|
margin_right = 960.0
|
||||||
margin_bottom = 206.0
|
margin_bottom = 206.0
|
||||||
mouse_filter = 0
|
mouse_filter = 0
|
||||||
custom_fonts/font = ExtResource( 3 )
|
custom_fonts/font = ExtResource( 2 )
|
||||||
custom_colors/font_color = Color( 1, 1, 1, 1 )
|
custom_colors/font_color = Color( 1, 1, 1, 1 )
|
||||||
custom_colors/font_color_shadow = Color( 0.823529, 0.517647, 0.0823529, 1 )
|
custom_colors/font_color_shadow = Color( 0.823529, 0.517647, 0.0823529, 1 )
|
||||||
custom_constants/shadow_offset_x = 2
|
custom_constants/shadow_offset_x = 2
|
||||||
custom_constants/shadow_offset_y = 3
|
custom_constants/shadow_offset_y = 3
|
||||||
text = "Quitter"
|
text = "Quitter"
|
||||||
align = 1
|
align = 1
|
||||||
|
|
||||||
[node name="Options" type="VBoxContainer" parent="."]
|
|
||||||
anchor_left = 0.5
|
|
||||||
anchor_top = 0.5
|
|
||||||
anchor_right = 0.5
|
|
||||||
anchor_bottom = 0.5
|
|
||||||
margin_left = -20.0
|
|
||||||
margin_top = -20.0
|
|
||||||
margin_right = 20.0
|
|
||||||
margin_bottom = 20.0
|
|
||||||
[connection signal="mouse_entered" from="Main/Jouer" to="." method="_on_Jouer_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Main/Jouer" to="." method="_on_Jouer_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Main/Options" to="." method="_on_Options_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Main/Options" to="." method="_on_Options_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Main/Quitter" to="." method="_on_Quitter_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Main/Quitter" to="." method="_on_Quitter_mouse_exited"]
|
|
||||||
|
|||||||
@@ -17,17 +17,17 @@
|
|||||||
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0000.png" type="Texture" id=15]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0000.png" type="Texture" id=15]
|
||||||
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0005.png" type="Texture" id=16]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0005.png" type="Texture" id=16]
|
||||||
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0006.png" type="Texture" id=17]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0006.png" type="Texture" id=17]
|
||||||
[ext_resource path="res://track1/policeCar/policeiso_0003.png" type="Texture" id=18]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/policeCar/policeiso_0000.png" type="Texture" id=18]
|
||||||
[ext_resource path="res://track1/policeCar/policeiso_0004.png" type="Texture" id=19]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/policeCar/policeiso_0001.png" type="Texture" id=19]
|
||||||
[ext_resource path="res://track1/policeCar/policeiso_0001.png" type="Texture" id=20]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/policeCar/policeiso_0002.png" type="Texture" id=20]
|
||||||
[ext_resource path="res://track1/policeCar/policeiso_0002.png" type="Texture" id=21]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/policeCar/policeiso_0003.png" type="Texture" id=21]
|
||||||
[ext_resource path="res://track1/policeCar/policeiso_0007.png" type="Texture" id=22]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/policeCar/policeiso_0004.png" type="Texture" id=22]
|
||||||
[ext_resource path="res://track1/policeCar/policeiso_0000.png" type="Texture" id=23]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/policeCar/policeiso_0005.png" type="Texture" id=23]
|
||||||
[ext_resource path="res://track1/policeCar/policeiso_0005.png" type="Texture" id=24]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/policeCar/policeiso_0006.png" type="Texture" id=24]
|
||||||
[ext_resource path="res://track1/policeCar/policeiso_0006.png" type="Texture" id=25]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/policeCar/policeiso_0007.png" type="Texture" id=25]
|
||||||
[ext_resource path="res://CarSprite.gd" type="Script" id=26]
|
[ext_resource path="res://CarSprite.gd" type="Script" id=26]
|
||||||
|
|
||||||
[sub_resource type="SpriteFrames" id=1]
|
[sub_resource type="SpriteFrames" id=6]
|
||||||
animations = [ {
|
animations = [ {
|
||||||
"frames": [ ExtResource( 2 ), ExtResource( 3 ), ExtResource( 4 ), ExtResource( 5 ), ExtResource( 6 ), ExtResource( 7 ), ExtResource( 8 ), ExtResource( 9 ) ],
|
"frames": [ ExtResource( 2 ), ExtResource( 3 ), ExtResource( 4 ), ExtResource( 5 ), ExtResource( 6 ), ExtResource( 7 ), ExtResource( 8 ), ExtResource( 9 ) ],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
@@ -56,6 +56,6 @@ __meta__ = {
|
|||||||
[node name="CarSprite" type="AnimatedSprite" parent="."]
|
[node name="CarSprite" type="AnimatedSprite" parent="."]
|
||||||
position = Vector2( -3.20422, 3.0376 )
|
position = Vector2( -3.20422, 3.0376 )
|
||||||
scale = Vector2( 0.8, 0.8 )
|
scale = Vector2( 0.8, 0.8 )
|
||||||
frames = SubResource( 1 )
|
frames = SubResource( 6 )
|
||||||
animation = "car"
|
animation = "car"
|
||||||
script = ExtResource( 26 )
|
script = ExtResource( 26 )
|
||||||
|
|||||||
111
RaceTrack.tscn
111
RaceTrack.tscn
@@ -1,40 +1,41 @@
|
|||||||
[gd_scene load_steps=41 format=2]
|
[gd_scene load_steps=39 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://RaceTrack.gd" type="Script" id=1]
|
[ext_resource path="res://race_track.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://assets/track_tiles/track.png" type="Texture" id=2]
|
[ext_resource path="res://assets/track_tiles/track.png" type="Texture" id=2]
|
||||||
[ext_resource path="res://TileMap.gd" type="Script" id=3]
|
[ext_resource path="res://TileMap.gd" type="Script" id=3]
|
||||||
[ext_resource path="res://TrackPath.gd" type="Script" id=4]
|
[ext_resource path="res://track_path.gd" type="Script" id=4]
|
||||||
[ext_resource path="res://OpponentCar.gd" type="Script" id=5]
|
[ext_resource path="res://opponent_car.gd" type="Script" id=5]
|
||||||
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0003.png" type="Texture" id=6]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/bus/busiso_0007.png" type="Texture" id=6]
|
||||||
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0004.png" type="Texture" id=7]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/bus/busiso_0004.png" type="Texture" id=7]
|
||||||
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0001.png" type="Texture" id=8]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/bus/busiso_0001.png" type="Texture" id=8]
|
||||||
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0002.png" type="Texture" id=9]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/bus/busiso_0002.png" type="Texture" id=9]
|
||||||
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0007.png" type="Texture" id=10]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/bus/busiso_0003.png" type="Texture" id=10]
|
||||||
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0000.png" type="Texture" id=11]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/bus/busiso_0000.png" type="Texture" id=11]
|
||||||
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0005.png" type="Texture" id=12]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/bus/busiso_0005.png" type="Texture" id=12]
|
||||||
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0006.png" type="Texture" id=13]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/bus/busiso_0006.png" type="Texture" id=13]
|
||||||
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/bus/busiso_0007.png" type="Texture" id=14]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0003.png" type="Texture" id=14]
|
||||||
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/bus/busiso_0004.png" type="Texture" id=15]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0004.png" type="Texture" id=15]
|
||||||
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/bus/busiso_0001.png" type="Texture" id=16]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0001.png" type="Texture" id=16]
|
||||||
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/bus/busiso_0002.png" type="Texture" id=17]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0002.png" type="Texture" id=17]
|
||||||
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/bus/busiso_0003.png" type="Texture" id=18]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0007.png" type="Texture" id=18]
|
||||||
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/bus/busiso_0000.png" type="Texture" id=19]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0000.png" type="Texture" id=19]
|
||||||
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/bus/busiso_0005.png" type="Texture" id=20]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0005.png" type="Texture" id=20]
|
||||||
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/bus/busiso_0006.png" type="Texture" id=21]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0006.png" type="Texture" id=21]
|
||||||
[ext_resource path="res://track1/policeCar/policeiso_0003.png" type="Texture" id=22]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/policeCar/policeiso_0003.png" type="Texture" id=22]
|
||||||
[ext_resource path="res://track1/policeCar/policeiso_0004.png" type="Texture" id=23]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/policeCar/policeiso_0004.png" type="Texture" id=23]
|
||||||
[ext_resource path="res://track1/policeCar/policeiso_0001.png" type="Texture" id=24]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/policeCar/policeiso_0001.png" type="Texture" id=24]
|
||||||
[ext_resource path="res://track1/policeCar/policeiso_0002.png" type="Texture" id=25]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/policeCar/policeiso_0002.png" type="Texture" id=25]
|
||||||
[ext_resource path="res://track1/policeCar/policeiso_0007.png" type="Texture" id=26]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/policeCar/policeiso_0007.png" type="Texture" id=26]
|
||||||
[ext_resource path="res://track1/policeCar/policeiso_0000.png" type="Texture" id=27]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/policeCar/policeiso_0000.png" type="Texture" id=27]
|
||||||
[ext_resource path="res://track1/policeCar/policeiso_0005.png" type="Texture" id=28]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/policeCar/policeiso_0005.png" type="Texture" id=28]
|
||||||
[ext_resource path="res://track1/policeCar/policeiso_0006.png" type="Texture" id=29]
|
[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/policeCar/policeiso_0006.png" type="Texture" id=29]
|
||||||
[ext_resource path="res://CarSprite.gd" type="Script" id=30]
|
[ext_resource path="res://car_sprite.gd" type="Script" id=30]
|
||||||
[ext_resource path="res://Player.gd" type="Script" id=31]
|
[ext_resource path="res://Player.gd" type="Script" id=31]
|
||||||
[ext_resource path="res://PlayerCar.tscn" type="PackedScene" id=32]
|
[ext_resource path="res://wrong_way.tscn" type="PackedScene" id=32]
|
||||||
[ext_resource path="res://wrong_way.tscn" type="PackedScene" id=33]
|
|
||||||
[ext_resource path="res://Gui.tscn" type="PackedScene" id=34]
|
|
||||||
[ext_resource path="res://Gui.gd" type="Script" id=35]
|
|
||||||
|
|
||||||
|
|
||||||
[sub_resource type="Gradient" id=1]
|
[sub_resource type="Gradient" id=1]
|
||||||
colors = PoolColorArray( 0.284025, 0.4375, 0.0803223, 1, 0.30305, 0.480469, 0.0675659, 1 )
|
colors = PoolColorArray( 0.284025, 0.4375, 0.0803223, 1, 0.30305, 0.480469, 0.0675659, 1 )
|
||||||
@@ -117,19 +118,19 @@ width = 1920
|
|||||||
|
|
||||||
[sub_resource type="Curve2D" id=4]
|
[sub_resource type="Curve2D" id=4]
|
||||||
_data = {
|
_data = {
|
||||||
"points": PoolVector2Array( 0, 0, 0, 0, 606.951, 579.696, 0, 0, 0, 0, 755.584, 596.499 )
|
"points": PoolVector2Array( 0, 0, 0, 0, 606.951, 579.696 )
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="SpriteFrames" id=5]
|
[sub_resource type="SpriteFrames" id=5]
|
||||||
animations = [ {
|
animations = [ {
|
||||||
"frames": [ ExtResource( 6 ), ExtResource( 7 ), ExtResource( 8 ), ExtResource( 9 ), ExtResource( 10 ), ExtResource( 11 ), ExtResource( 12 ), ExtResource( 13 ) ],
|
"frames": [ ExtResource( 6 ), ExtResource( 7 ), ExtResource( 8 ), ExtResource( 9 ), ExtResource( 10 ), ExtResource( 11 ), ExtResource( 12 ), ExtResource( 13 ) ],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": "car",
|
"name": "bus",
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [ ExtResource( 14 ), ExtResource( 15 ), ExtResource( 16 ), ExtResource( 17 ), ExtResource( 18 ), ExtResource( 19 ), ExtResource( 20 ), ExtResource( 21 ) ],
|
"frames": [ ExtResource( 14 ), ExtResource( 15 ), ExtResource( 16 ), ExtResource( 17 ), ExtResource( 18 ), ExtResource( 19 ), ExtResource( 20 ), ExtResource( 21 ) ],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": "bus",
|
"name": "car",
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [ ExtResource( 22 ), ExtResource( 23 ), ExtResource( 24 ), ExtResource( 25 ), ExtResource( 26 ), ExtResource( 27 ), ExtResource( 28 ), ExtResource( 29 ) ],
|
"frames": [ ExtResource( 22 ), ExtResource( 23 ), ExtResource( 24 ), ExtResource( 25 ), ExtResource( 26 ), ExtResource( 27 ), ExtResource( 28 ), ExtResource( 29 ) ],
|
||||||
@@ -138,6 +139,24 @@ animations = [ {
|
|||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
} ]
|
} ]
|
||||||
|
|
||||||
|
[sub_resource type="SpriteFrames" id=6]
|
||||||
|
animations = [ {
|
||||||
|
"frames": [ ExtResource( 6 ), ExtResource( 7 ), ExtResource( 8 ), ExtResource( 9 ), ExtResource( 10 ), ExtResource( 11 ), ExtResource( 12 ), ExtResource( 13 ) ],
|
||||||
|
"loop": true,
|
||||||
|
"name": "bus",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [ ExtResource( 14 ), ExtResource( 15 ), ExtResource( 16 ), ExtResource( 17 ), ExtResource( 18 ), ExtResource( 19 ), ExtResource( 20 ), ExtResource( 21 ) ],
|
||||||
|
"loop": true,
|
||||||
|
"name": "car",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [ ExtResource( 27 ), ExtResource( 24 ), ExtResource( 25 ), ExtResource( 22 ), ExtResource( 23 ), ExtResource( 28 ), ExtResource( 29 ), ExtResource( 26 ) ],
|
||||||
|
"loop": true,
|
||||||
|
"name": "police",
|
||||||
|
"speed": 5.0
|
||||||
|
} ]
|
||||||
|
|
||||||
[node name="RaceTrack" type="Node"]
|
[node name="RaceTrack" type="Node"]
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
@@ -160,7 +179,7 @@ script = ExtResource( 4 )
|
|||||||
|
|
||||||
[node name="Opponent" type="PathFollow2D" parent="TrackPath"]
|
[node name="Opponent" type="PathFollow2D" parent="TrackPath"]
|
||||||
position = Vector2( 606.951, 579.696 )
|
position = Vector2( 606.951, 579.696 )
|
||||||
rotation = 0.112561
|
rotation = 0.112563
|
||||||
script = ExtResource( 5 )
|
script = ExtResource( 5 )
|
||||||
|
|
||||||
[node name="OpponentCar" type="Node2D" parent="TrackPath/Opponent"]
|
[node name="OpponentCar" type="Node2D" parent="TrackPath/Opponent"]
|
||||||
@@ -177,19 +196,21 @@ skin = "police"
|
|||||||
|
|
||||||
[node name="Player" type="PathFollow2D" parent="TrackPath"]
|
[node name="Player" type="PathFollow2D" parent="TrackPath"]
|
||||||
position = Vector2( 606.951, 579.696 )
|
position = Vector2( 606.951, 579.696 )
|
||||||
rotation = 0.112561
|
rotation = 0.112563
|
||||||
script = ExtResource( 31 )
|
script = ExtResource( 31 )
|
||||||
|
|
||||||
[node name="PlayerCar" parent="TrackPath/Player" instance=ExtResource( 32 )]
|
[node name="PlayerCar" type="Node2D" parent="TrackPath/Player"]
|
||||||
position = Vector2( 1.89564, -22.3528 )
|
position = Vector2( 1.89564, -22.3528 )
|
||||||
scale = Vector2( 0.25, 0.25 )
|
scale = Vector2( 0.25, 0.25 )
|
||||||
script = null
|
|
||||||
|
|
||||||
[node name="Wrong Way" parent="." instance=ExtResource( 33 )]
|
[node name="CarSprite" type="AnimatedSprite" parent="TrackPath/Player/PlayerCar"]
|
||||||
|
position = Vector2( -3.20422, 3.0376 )
|
||||||
|
scale = Vector2( 0.8, 0.8 )
|
||||||
|
frames = SubResource( 6 )
|
||||||
|
animation = "car"
|
||||||
|
script = ExtResource( 30 )
|
||||||
|
|
||||||
|
[node name="Wrong Way" parent="." instance=ExtResource( 32 )]
|
||||||
visible = false
|
visible = false
|
||||||
|
|
||||||
[node name="GUI" parent="." instance=ExtResource( 34 )]
|
|
||||||
script = ExtResource( 35 )
|
|
||||||
[connection signal="player_moved" from="." to="TrackPath/Player" method="_on_RaceTrack_player_moved"]
|
[connection signal="player_moved" from="." to="TrackPath/Player" method="_on_RaceTrack_player_moved"]
|
||||||
[connection signal="wrong_way" from="." to="Wrong Way" method="_on_RaceTrack_wrong_way"]
|
[connection signal="wrong_way" from="." to="Wrong Way" method="_on_RaceTrack_wrong_way"]
|
||||||
[connection signal="lap_completed" from="TrackPath/Player" to="GUI" method="_on_lap_completed"]
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ enum { LEFT, RIGHT, UP, DOWN }
|
|||||||
# Enum for tiles from tile_set
|
# Enum for tiles from tile_set
|
||||||
enum { DOWN_LEFT, DOWN_RIGHT, LEFT_RIGHT, START, UP_DOWN, UP_LEFT, UP_RIGHT }
|
enum { DOWN_LEFT, DOWN_RIGHT, LEFT_RIGHT, START, UP_DOWN, UP_LEFT, UP_RIGHT }
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
func _ready():
|
||||||
func _reset():
|
TrackSelection.connect("track_changed", self, "_reload_track")
|
||||||
_reload_track()
|
_reload_track()
|
||||||
|
|
||||||
func _reload_track():
|
func _reload_track():
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://Oswald-Bold.otf" type="DynamicFontData" id=1]
|
[ext_resource path="res://assets/Oswald-Bold.otf" type="DynamicFontData" id=1]
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
resource_name = "BaseFont"
|
resource_name = "BaseFont"
|
||||||
|
|||||||
@@ -25,10 +25,6 @@ config/icon="res://icon.png"
|
|||||||
Global="*res://Global.gd"
|
Global="*res://Global.gd"
|
||||||
TrackSelection="*res://track_selection.gd"
|
TrackSelection="*res://track_selection.gd"
|
||||||
|
|
||||||
[debug]
|
|
||||||
|
|
||||||
settings/stdout/print_fps=true
|
|
||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
||||||
window/size/width=1920
|
window/size/width=1920
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ func get_track_offset(coords):
|
|||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
|
TrackSelection.connect("track_changed", self, "_reset_state")
|
||||||
_reset_state()
|
_reset_state()
|
||||||
|
|
||||||
func _reset_state():
|
func _reset_state():
|
||||||
@@ -6,8 +6,12 @@ var tile_size : int = 128
|
|||||||
var half_size : int = tile_size / 2
|
var half_size : int = tile_size / 2
|
||||||
onready var map = get_node("../TileMap/")
|
onready var map = get_node("../TileMap/")
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
TrackSelection.connect("track_changed", self, "_reset_state")
|
||||||
|
_reset_state()
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _reset():
|
func _reset_state():
|
||||||
var track = TrackSelection.get_current_track()
|
var track = TrackSelection.get_current_track()
|
||||||
_build_track(track)
|
_build_track(track)
|
||||||
$Opponent.set_offset(0.0)
|
$Opponent.set_offset(0.0)
|
||||||
@@ -1,24 +1,34 @@
|
|||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
|
signal track_changed()
|
||||||
|
|
||||||
const TRACKS_PATH = "res://assets/tracks/"
|
const TRACKS_PATH = "res://assets/tracks/"
|
||||||
|
|
||||||
var _tracks = []
|
var _tracks = []
|
||||||
var _selected : int = 1
|
var _selected : int
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
_load_tracks()
|
_load_tracks()
|
||||||
|
_selected = 0
|
||||||
|
emit_signal("track_changed")
|
||||||
|
|
||||||
|
|
||||||
func set_next_track():
|
func set_next_track():
|
||||||
_selected = wrapi(_selected + 1, 0, _tracks.size())
|
_selected = wrapi(_selected + 1, 0, _tracks.size())
|
||||||
print("set_next_track : ", _selected)
|
emit_signal("track_changed")
|
||||||
|
|
||||||
|
|
||||||
func set_previous_track():
|
func set_previous_track():
|
||||||
_selected = wrapi(_selected - 1, 0, _tracks.size())
|
_selected = wrapi(_selected - 1, 0, _tracks.size())
|
||||||
|
emit_signal("track_changed")
|
||||||
|
|
||||||
|
|
||||||
func get_current_track():
|
func get_current_track():
|
||||||
return _tracks[_selected]
|
return _tracks[_selected]["path"]
|
||||||
|
|
||||||
|
|
||||||
|
func get_current_track_name():
|
||||||
|
return _tracks[_selected]["name"]
|
||||||
|
|
||||||
|
|
||||||
func _load_tracks():
|
func _load_tracks():
|
||||||
@@ -27,8 +37,12 @@ func _load_tracks():
|
|||||||
var file = File.new()
|
var file = File.new()
|
||||||
file.open(path, File.READ)
|
file.open(path, File.READ)
|
||||||
var track = _load_from_txt(file.get_as_text())
|
var track = _load_from_txt(file.get_as_text())
|
||||||
|
var track_name = path.get_file().rstrip(".%s" % path.get_extension())
|
||||||
if track.size() > 1:
|
if track.size() > 1:
|
||||||
loaded.append(track)
|
loaded.append({
|
||||||
|
"name": track_name,
|
||||||
|
"path": track,
|
||||||
|
})
|
||||||
else:
|
else:
|
||||||
print("Error in track file : ", path)
|
print("Error in track file : ", path)
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
[gd_scene load_steps=4 format=2]
|
[gd_scene load_steps=4 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://Oswald-Bold.otf" type="DynamicFontData" id=1]
|
[ext_resource path="res://assets/Oswald-Bold.otf" type="DynamicFontData" id=1]
|
||||||
[ext_resource path="res://Wrong Way.gd" type="Script" id=2]
|
[ext_resource path="res://wrong_way.gd" type="Script" id=2]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[sub_resource type="DynamicFont" id=5]
|
[sub_resource type="DynamicFont" id=5]
|
||||||
size = 40
|
size = 40
|
||||||
|
|||||||
Reference in New Issue
Block a user