cleanup old files

This commit is contained in:
2020-10-30 15:30:37 +01:00
parent edc4b5630d
commit d5ad9b8e1c
6 changed files with 34 additions and 265 deletions

View File

@@ -14,27 +14,33 @@ font_data = ExtResource( 2 )
script = ExtResource( 1 )
[node name="Title" type="Label" parent="."]
margin_left = 701.404
margin_top = 169.251
margin_right = 944.404
margin_bottom = 252.251
anchor_left = 0.5
anchor_right = 0.5
margin_left = -222.36
margin_top = 201.721
margin_right = 20.6399
margin_bottom = 284.721
rect_scale = Vector2( 2, 2 )
custom_fonts/font = SubResource( 1 )
custom_colors/font_color = Color( 0.219608, 0.137255, 0.709804, 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_constants/shadow_offset_x = 2
custom_constants/shadow_offset_y = 3
custom_constants/shadow_as_outline = 0
text = "Car Racer"
[node name="ButtonBox" type="VBoxContainer" parent="."]
margin_left = 800.375
margin_top = 448.991
margin_right = 949.375
margin_bottom = 654.991
[node name="Main" type="VBoxContainer" parent="."]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -139.571
margin_top = -76.9716
margin_right = 9.42896
margin_bottom = 129.028
rect_scale = Vector2( 2, 2 )
[node name="Jouer" type="Label" parent="ButtonBox"]
[node name="Jouer" type="Label" parent="Main"]
margin_right = 149.0
margin_bottom = 66.0
custom_fonts/font = ExtResource( 3 )
@@ -44,7 +50,7 @@ custom_constants/shadow_offset_y = 3
text = "Jouer"
align = 1
[node name="Options" type="Label" parent="ButtonBox"]
[node name="Options" type="Label" parent="Main"]
margin_top = 70.0
margin_right = 149.0
margin_bottom = 136.0
@@ -55,7 +61,7 @@ custom_constants/shadow_offset_y = 3
text = "Options"
align = 1
[node name="Quitter" type="Label" parent="ButtonBox"]
[node name="Quitter" type="Label" parent="Main"]
margin_top = 140.0
margin_right = 149.0
margin_bottom = 206.0
@@ -65,3 +71,13 @@ custom_constants/shadow_offset_x = 2
custom_constants/shadow_offset_y = 3
text = "Quitter"
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

View File

@@ -1,53 +0,0 @@
extends TileMap
signal player_moved(track_offset)
signal wrong_way(coords)
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# TODO:
# - Find a mean to import tracks (arrays of cell coordinates).
# ( - Autopopulate the map according to track data )
# - Build the track Curve2D from track and tiles data
# - Keyboard controls !!
const TRACK_TILES = [
Vector2(1,0), Vector2(2,0), Vector2(3,0), Vector2(3,1),
Vector2(2,1), Vector2(1,1), Vector2(0,1), Vector2(0,0)
]
var laps = 0
var current_cell = TRACK_TILES[0]
func get_track_offset(coords):
var offset = float(TRACK_TILES.find(coords)) / float(len(TRACK_TILES))
return offset
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
func _input(event):
# Check if the mouse if following the tiles track
if event is InputEventMouseMotion:
var hover_cell = world_to_map(event.position)
if hover_cell != current_cell: # The mouse moved to a new cell
# Check the tile is on path
if TRACK_TILES.find(hover_cell) != -1:
# Check if a lap is finished
if hover_cell == TRACK_TILES[0] and current_cell == TRACK_TILES[-1]:
laps += 1
get_node("/root/Node2D/GUI/Laps/Value/").set_text("%d" % laps)
# Check we are following the path
if TRACK_TILES[TRACK_TILES.find(hover_cell) - 1] == current_cell:
emit_signal("player_moved", laps + get_track_offset(hover_cell))
emit_signal("wrong_way", Vector2(-1, -1))
current_cell = hover_cell
else:
emit_signal("wrong_way", map_to_world(hover_cell))
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass

View File

@@ -1,53 +0,0 @@
extends TileMap
signal player_moved(track_offset)
signal lap_completed(laps)
signal wrong_way(coords)
# TODO:
# - Find a mean to import tracks (arrays of cell coordinates).
# ( - Autopopulate the map according to track data )
# - Build the track Curve2D from track and tiles data
# - Keyboard controls !!
const TRACK_TILES = [
Vector2(7,1), Vector2(8,1), Vector2(9,1), Vector2(9,2), Vector2(9,3),
Vector2(8,3), Vector2(7,3), Vector2(7,4), Vector2(7,5), Vector2(7,6),
Vector2(6,6), Vector2(6,5), Vector2(6,4), Vector2(6,3), Vector2(5,3),
Vector2(4,3), Vector2(4,2), Vector2(4,1), Vector2(5,1), Vector2(6,1),
]
var laps = 0
var current_cell = TRACK_TILES[0]
func get_track_offset(coords):
var offset = float(TRACK_TILES.find(coords)) / float(len(TRACK_TILES))
return offset
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
func _input(event):
# Check if the mouse if following the tiles track
if event is InputEventMouseMotion:
var hover_cell = world_to_map(event.position)
if hover_cell != current_cell: # The mouse moved to a new cell
# Check the tile is on path
if TRACK_TILES.find(hover_cell) != -1:
# Check if a lap is finished
if hover_cell == TRACK_TILES[0] and current_cell == TRACK_TILES[-1]:
laps += 1
emit_signal("lap_completed", laps)
# Check we are following the path
if TRACK_TILES[TRACK_TILES.find(hover_cell) - 1] == current_cell:
emit_signal("player_moved", laps + get_track_offset(hover_cell))
emit_signal("wrong_way", Vector2(-1, -1))
current_cell = hover_cell
else:
emit_signal("wrong_way", map_to_world(hover_cell))
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass

View File

@@ -1,33 +0,0 @@
extends PathFollow2D
export (int) var threshold = 5 # Range to snap around axis direction, in degrees.
func _ready():
set_unit_offset(0.0)
func snap_rotation(r):
"""
Snap rotation to multiples of 45°
Also snaps within a certain range of direction axis
"""
if r >= 0 - threshold and r <= 0 + threshold: # Right
r = 0
elif r >= 180 - threshold or r <= -180 + threshold: # Left
r = 180
elif r >= 90 - threshold and r <= 90 + threshold: # Down
r = 90
elif r >= -90 - threshold and r <= -90 + threshold: # Up
r = -90
elif r > 0 + threshold and r < 90 - threshold:
r = 45
elif r > 90 + threshold and r < 180 - threshold:
r = 135
elif r > -90 + threshold and r < 0 - threshold:
r = -45
elif r > -180 + threshold and r < -90 - threshold:
r = -135
return r
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta):
set_rotation_degrees( snap_rotation(get_rotation_degrees()) )

View File

@@ -1,112 +0,0 @@
[gd_scene load_steps=7 format=2]
[ext_resource path="res://track1/track1.png" type="Texture" id=1]
[ext_resource path="res://TileMap.gd" type="Script" id=2]
[ext_resource path="res://Track.tscn" type="PackedScene" id=3]
[ext_resource path="res://Gui.tscn" type="PackedScene" id=4]
[ext_resource path="res://wrong_way.tscn" type="PackedScene" id=5]
[sub_resource type="TileSet" id=1]
0/name = "rd"
0/texture = ExtResource( 1 )
0/tex_offset = Vector2( 0, 0 )
0/modulate = Color( 1, 1, 1, 1 )
0/region = Rect2( -35, -35, 315, 315 )
0/tile_mode = 0
0/occluder_offset = Vector2( 0, 0 )
0/navigation_offset = Vector2( 0, 0 )
0/shapes = [ ]
0/z_index = 0
1/name = "lr"
1/texture = ExtResource( 1 )
1/tex_offset = Vector2( 0, 0 )
1/modulate = Color( 1, 1, 1, 1 )
1/region = Rect2( 280, 0, 245, 280 )
1/tile_mode = 0
1/occluder_offset = Vector2( 0, 0 )
1/navigation_offset = Vector2( 0, 0 )
1/shapes = [ ]
1/z_index = 0
2/name = "ld"
2/texture = ExtResource( 1 )
2/tex_offset = Vector2( 0, 0 )
2/modulate = Color( 1, 1, 1, 1 )
2/region = Rect2( 525, 0, 280, 280 )
2/tile_mode = 0
2/occluder_offset = Vector2( 0, 0 )
2/navigation_offset = Vector2( 0, 0 )
2/shapes = [ ]
2/z_index = 0
3/name = "track1.png 3"
3/texture = ExtResource( 1 )
3/tex_offset = Vector2( 0, 0 )
3/modulate = Color( 1, 1, 1, 1 )
3/region = Rect2( -35, 280, 315, 245 )
3/tile_mode = 0
3/occluder_offset = Vector2( 0, 0 )
3/navigation_offset = Vector2( 0, 0 )
3/shapes = [ ]
3/z_index = 0
4/name = "track1.png 4"
4/texture = ExtResource( 1 )
4/tex_offset = Vector2( 0, 0 )
4/modulate = Color( 1, 1, 1, 1 )
4/region = Rect2( 525, 280, 280, 245 )
4/tile_mode = 0
4/occluder_offset = Vector2( 0, 0 )
4/navigation_offset = Vector2( 0, 0 )
4/shapes = [ ]
4/z_index = 0
5/name = "ur"
5/texture = ExtResource( 1 )
5/tex_offset = Vector2( 0, 0 )
5/modulate = Color( 1, 1, 1, 1 )
5/region = Rect2( -35, 525, 315, 280 )
5/tile_mode = 0
5/occluder_offset = Vector2( 0, 0 )
5/navigation_offset = Vector2( 0, 0 )
5/shapes = [ ]
5/z_index = 0
6/name = "rl"
6/texture = ExtResource( 1 )
6/tex_offset = Vector2( 0, 0 )
6/modulate = Color( 1, 1, 1, 1 )
6/region = Rect2( 280, 525, 245, 280 )
6/tile_mode = 0
6/occluder_offset = Vector2( 0, 0 )
6/navigation_offset = Vector2( 0, 0 )
6/shapes = [ ]
6/z_index = 0
7/name = "ul"
7/texture = ExtResource( 1 )
7/tex_offset = Vector2( 0, 0 )
7/modulate = Color( 1, 1, 1, 1 )
7/region = Rect2( 525, 525, 280, 280 )
7/tile_mode = 0
7/occluder_offset = Vector2( 0, 0 )
7/navigation_offset = Vector2( 0, 0 )
7/shapes = [ ]
7/z_index = 0
[node name="Node2D" type="Node2D"]
[node name="TileMap" type="TileMap" parent="."]
tile_set = SubResource( 1 )
cell_size = Vector2( 320, 320 )
format = 1
tile_data = PoolIntArray( 0, 0, 0, 1, 1, 0, 2, 1, 0, 3, 2, 0, 65536, 5, 0, 65537, 1, 0, 65538, 1, 0, 65539, 7, 0 )
script = ExtResource( 2 )
[node name="Track" parent="." instance=ExtResource( 3 )]
[node name="GUI" parent="." instance=ExtResource( 4 )]
[node name="Wrong Way" parent="." instance=ExtResource( 5 )]
[node name="Background" type="CanvasLayer" parent="."]
layer = -1
[node name="ColorRect" type="ColorRect" parent="Background"]
margin_right = 1920.0
margin_bottom = 1080.0
color = Color( 0.121569, 0.301961, 0.0862745, 1 )

View File

@@ -16,10 +16,14 @@ _global_script_class_icons={
[application]
config/name="Src"
run/main_scene="res://Track2.tscn"
run/main_scene="res://Main.tscn"
run/low_processor_mode=true
config/icon="res://icon.png"
[autoload]
Global="*res://Global.gd"
[debug]
settings/stdout/print_fps=true