Commit 5cb784e5 authored by Nathan Lovato's avatar Nathan Lovato

Reorganize code and project for tutorials

parent b78cfb5f
Pipeline #5247 passed with stage
in 13 minutes and 28 seconds
......@@ -6,9 +6,9 @@
[ext_resource path="res://Score/ScoreLabel.tscn" type="PackedScene" id=4]
[ext_resource path="res://Gnu/Gnu.tscn" type="PackedScene" id=5]
[ext_resource path="res://Foreground.gd" type="Script" id=6]
[ext_resource path="res://PillarSpawner/PillarSpawner.tscn" type="PackedScene" id=7]
[ext_resource path="res://Pillar/PillarSpawner.tscn" type="PackedScene" id=7]
[ext_resource path="res://SpriteSpawner/SpriteSpawner.gd" type="Script" id=8]
[ext_resource path="res://SpriteSpawner/GroundSprite.tscn" type="PackedScene" id=9]
[ext_resource path="res://SpriteSpawner/PurpleMiasma.tscn" type="PackedScene" id=9]
[ext_resource path="res://SpriteSpawner/Fence.tscn" type="PackedScene" id=10]
[sub_resource type="Gradient" id=1]
......@@ -93,7 +93,7 @@ tracks/0/keys = {
"values": [ Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 0 ) ]
}
[node name="Game" type="Node2D" index="0"]
[node name="Game" type="Node2D"]
script = ExtResource( 1 )
......
[gd_scene load_steps=3 format=2]
[ext_resource path="res://assets/pillar_top.png" type="Texture" id=1]
[ext_resource path="res://assets/pillar_bottom.png" type="Texture" id=2]
[node name="Pillar" type="StaticBody2D"]
[node name="pillar_top" type="Sprite" parent="."]
position = Vector2( -10, -584 )
texture = ExtResource( 1 )
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
position = Vector2( 0, 46 )
polygon = PoolVector2Array( -120, -240, 100, -240, 100, -1060, -120, -1060 )
[node name="pillar_bottom" type="Sprite" parent="."]
position = Vector2( 0, 526 )
texture = ExtResource( 2 )
[node name="CollisionPolygon2D2" type="CollisionPolygon2D" parent="."]
position = Vector2( 0, 1226 )
polygon = PoolVector2Array( -120, -240, 100, -240, 100, -1060, -120, -1060 )
......@@ -7,6 +7,10 @@ onready var checkpoint = $Checkpoint
onready var anim_player = $AnimationPlayer
func fade_out():
anim_player.play("fade_out")
func _ready():
var p = global_position
set_as_toplevel(true)
......@@ -18,7 +22,3 @@ func _ready():
func _on_Checkpoint_body_entered(body):
emit_signal("checkpoint_reached")
func fade_out():
anim_player.play("fade_out")
......@@ -4,6 +4,9 @@
[ext_resource path="res://assets/pillar_top.png" type="Texture" id=2]
[ext_resource path="res://assets/pillar_bottom.png" type="Texture" id=3]
[sub_resource type="RectangleShape2D" id=1]
custom_solver_bias = 0.0
......
......@@ -17,12 +17,6 @@ var pillar_scene = preload("res://Pillar/Pillar.tscn")
var WINDOW_WIDTH = ProjectSettings.get('display/window/size/width')
func _ready():
randomize()
for i in range(3):
spawn_pillar()
func spawn_pillar():
var pillar = pillar_scene.instance()
pillar.global_position = get_random_position()
......@@ -36,3 +30,9 @@ func get_random_position():
return Vector2(
position.x + WINDOW_WIDTH,
spawn_area.get_random_vertical_position())
func _ready():
randomize()
for i in range(3):
spawn_pillar()
[gd_scene load_steps=3 format=2]
[ext_resource path="res://PillarSpawner/PillarSpawner.gd" type="Script" id=1]
[ext_resource path="res://PillarSpawner/SpawnArea.gd" type="Script" id=2]
[ext_resource path="res://Pillar/PillarSpawner.gd" type="Script" id=1]
[ext_resource path="res://Pillar/SpawnArea.gd" type="Script" id=2]
[node name="PillarSpawner" type="Node2D" index="0"]
......
......@@ -9,12 +9,6 @@ var directory = Directory.new()
var _score = 0
func _init():
if not directory.file_exists(SCORES_PATH):
save(_score)
load_score()
func register(new_score):
"""Saves and returns the highest score"""
if new_score > _score:
......@@ -39,3 +33,9 @@ func reset():
"""Erases the high score file from the disk and resets the highest score"""
directory.remove(SCORES_PATH)
_score = 0
func _init():
if not directory.file_exists(SCORES_PATH):
save(_score)
load_score()
......@@ -3,21 +3,35 @@
[ext_resource path="res://assets/fence.png" type="Texture" id=1]
[sub_resource type="RectangleShape2D" id=1]
custom_solver_bias = 0.0
extents = Vector2( 260, 20 )
[node name="Fence" type="Sprite"]
texture = ExtResource( 1 )
offset = Vector2( 241, -60 )
[node name="VisibilityEnabler2D" type="VisibilityNotifier2D" parent="."]
[node name="VisibilityEnabler2D" type="VisibilityNotifier2D" parent="." index="0"]
position = Vector2( 520, 0 )
rect = Rect2( -10, -10, 20, 20 )
[node name="Area2D" type="StaticBody2D" parent="." index="1"]
[node name="Area2D" type="StaticBody2D" parent="."]
input_pickable = false
collision_layer = 2
collision_mask = 0
constant_linear_velocity = Vector2( 0, 0 )
constant_angular_velocity = 0.0
friction = 1.0
bounce = 0.0
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D" index="0"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
position = Vector2( 260, -110 )
shape = SubResource( 1 )
[connection signal="screen_exited" from="VisibilityEnabler2D" to="." method="queue_free"]
......@@ -4,21 +4,37 @@
[ext_resource path="res://assets/particle_hairy.png" type="Texture" id=2]
[sub_resource type="Gradient" id=1]
offsets = PoolRealArray( 0, 0.2, 0.834146, 1 )
colors = PoolColorArray( 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 )
[sub_resource type="GradientTexture" id=2]
flags = 4
gradient = SubResource( 1 )
width = 2048
[sub_resource type="Curve" id=3]
min_value = 0.0
max_value = 1.0
bake_resolution = 100
_data = [ Vector2( 0.00428528, 0.0173051 ), 0.0, 1.40242, 0, 0, Vector2( 0.292929, 0.747705 ), 0.956195, 0.956195, 0, 0, Vector2( 1, 1 ), 0.0, 0.0, 0, 0 ]
[sub_resource type="CurveTexture" id=4]
flags = 4
width = 2048
curve = SubResource( 3 )
[sub_resource type="ParticlesMaterial" id=5]
render_priority = 0
trail_divisor = 1
emission_shape = 2
emission_box_extents = Vector3( 640, 20, 1 )
flag_align_y = false
flag_rotate_y = false
flag_disable_z = true
spread = 24.68
flatness = 0.32
......@@ -29,33 +45,64 @@ angular_velocity = 20.0
angular_velocity_random = 1.0
orbit_velocity = 0.0
orbit_velocity_random = 0.0
linear_accel = 0.0
linear_accel_random = 0.0
radial_accel = 0.0
radial_accel_random = 0.0
tangential_accel = 0.0
tangential_accel_random = 0.0
damping = 25.29
damping_random = 0.0
angle = 15.0
angle_random = 1.0
scale = 0.7
scale_random = 0.54
scale_curve = SubResource( 4 )
color_ramp = SubResource( 2 )
hue_variation = 0.0
hue_variation_random = 1.0
anim_speed = 0.0
anim_speed_random = 0.0
anim_offset = 0.0
anim_offset_random = 0.0
anim_loop = false
[node name="PurpleMiasma" type="Sprite" index="0"]
[node name="Ground" type="Sprite"]
modulate = Color( 0.356863, 0.133333, 0.65098, 1 )
texture = ExtResource( 1 )
offset = Vector2( 540, -120.697 )
region_rect = Rect2( 0, 0, 1080, 400 )
[node name="PurpleMiasma" type="Particles2D" parent="."]
[node name="Particles2D" type="Particles2D" parent="." index="0"]
position = Vector2( 510, -310.41 )
emitting = true
amount = 20
lifetime = 3.0
one_shot = false
preprocess = 2.0
speed_scale = 1.0
explosiveness = 0.0
randomness = 0.0
fixed_fps = 0
fract_delta = true
visibility_rect = Rect2( -640, -100.058, 1280, 200 )
local_coords = true
draw_order = 0
process_material = SubResource( 5 )
texture = ExtResource( 2 )
normal_map = null
h_frames = 1
v_frames = 1
[node name="VisibilityNotifier2D" type="VisibilityNotifier2D" parent="." index="1"]
[node name="VisibilityNotifier2D" type="VisibilityNotifier2D" parent="."]
modulate = Color( 0.647059, 0.0117647, 0.0117647, 1 )
position = Vector2( 1090, -260 )
z_index = 100
rect = Rect2( -10, -10, 20, 20 )
[connection signal="screen_exited" from="VisibilityNotifier2D" to="." method="queue_free"]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment