Skip to content

Commit 54573d4

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents b6f7ce0 + ed5307a commit 54573d4

5 files changed

Lines changed: 63 additions & 5 deletions

File tree

2d/checkpoint.gd

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
extends Area2D
2+
3+
var activated = false
4+
5+
func _ready():
6+
$Label.visible = false
7+
8+
func _on_checkpoint_body_entered(body):
9+
if body.is_in_group("player") and not activated:
10+
activated = true
11+
$Label.visible = true
12+
body.last_checkpoint = self
13+
14+
func get_spawn_position():
15+
return $spawn_point.global_position

2d/checkpoint.tscn

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[gd_scene load_steps=5 format=2]
2+
3+
[ext_resource path="res://assets/Roboto-Medium.ttf" type="DynamicFontData" id=1]
4+
[ext_resource path="res://2d/checkpoint.gd" type="Script" id=2]
5+
6+
[sub_resource type="DynamicFont" id=1]
7+
font_data = ExtResource( 1 )
8+
9+
[sub_resource type="RectangleShape2D" id=2]
10+
extents = Vector2( 17.3624, 172.791 )
11+
12+
[node name="checkpoint" type="Area2D"]
13+
script = ExtResource( 2 )
14+
15+
[node name="Label" type="Label" parent="."]
16+
margin_right = 40.0
17+
margin_bottom = 14.0
18+
rect_rotation = -89.9999
19+
custom_fonts/font = SubResource( 1 )
20+
custom_colors/font_color = Color( 0.51, 1.16, 30.06, 1 )
21+
text = "CHECKPOINT"
22+
__meta__ = {
23+
"_edit_use_anchors_": false
24+
}
25+
26+
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
27+
position = Vector2( 17.1005, -115.586 )
28+
shape = SubResource( 2 )
29+
30+
[node name="spawn_point" type="Node2D" parent="."]
31+
position = Vector2( 21.0224, -58.2321 )
32+
[connection signal="body_entered" from="." to="." method="_on_checkpoint_body_entered"]

2d/game.tscn

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[gd_scene load_steps=5 format=2]
1+
[gd_scene load_steps=6 format=2]
22

33
[ext_resource path="res://2d/Scene2D.tscn" type="PackedScene" id=1]
44
[ext_resource path="res://script/game.gd" type="Script" id=2]
@@ -51,6 +51,13 @@ void fragment() {
5151
shader = SubResource( 1 )
5252
shader_param/ZoomStrength = 0.0
5353

54+
[sub_resource type="Environment" id=4]
55+
background_mode = 4
56+
background_canvas_max_layer = 5
57+
glow_enabled = true
58+
glow_intensity = 1.28
59+
glow_strength = 0.84
60+
5461
[node name="game" type="Node2D"]
5562
script = ExtResource( 2 )
5663

@@ -66,7 +73,10 @@ __meta__ = {
6673
[node name="Viewport" type="Viewport" parent="ViewportContainer"]
6774
size = Vector2( 1024, 600 )
6875
handle_input_locally = false
69-
usage = 0
76+
render_direct_to_screen = true
7077
render_target_update_mode = 3
7178

79+
[node name="WorldEnvironment" type="WorldEnvironment" parent="ViewportContainer/Viewport"]
80+
environment = SubResource( 4 )
81+
7282
[node name="scene" parent="ViewportContainer/Viewport" instance=ExtResource( 1 )]

default_env.tres

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
[sub_resource type="ProceduralSky" id=1]
44

55
[resource]
6-
background_mode = 2
76
background_sky = SubResource( 1 )
7+
glow_intensity = 1.49

script/player.gd

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ var start_pos
88
var dead = false
99
var anchors
1010

11+
var last_checkpoint
1112

1213
func _ready():
1314
start_pos = position
@@ -65,9 +66,9 @@ func die():
6566
func _integrate_forces(state):
6667
if state.linear_velocity.length() > max_velocity:
6768
state.linear_velocity = state.linear_velocity.normalized() * max_velocity
68-
69+
6970
if dead:
70-
state.transform = Transform2D(0, start_pos)
71+
state.transform = Transform2D(0, last_checkpoint.get_spawn_position() if last_checkpoint else start_pos)
7172
state.linear_velocity = Vector2.ZERO
7273
dead = false
7374

0 commit comments

Comments
 (0)