Skip to content

Commit faae60a

Browse files
committed
Port 2D demos to Godot 3.1
Opened them, saved all scenes, ran the project. Did necessary fixes here and there, fixed some warnings (but some remain in bigger demos). Did not port JRPG demo yet (#306) nor the two platformer demos.
1 parent a6ce6db commit faae60a

File tree

90 files changed

+703
-3500
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+703
-3500
lines changed

2d/dodge_the_creeps/HUD.tscn

Lines changed: 4 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -4,63 +4,31 @@
44
[ext_resource path="res://fonts/Xolonium-Regular.ttf" type="DynamicFontData" id=2]
55

66
[sub_resource type="DynamicFont" id=1]
7-
87
size = 64
9-
use_mipmaps = false
10-
use_filter = false
118
font_data = ExtResource( 2 )
12-
_sections_unfolded = [ "Font", "Settings" ]
139

1410
[sub_resource type="DynamicFont" id=2]
15-
1611
size = 72
17-
use_mipmaps = false
18-
use_filter = false
1912
font_data = ExtResource( 2 )
20-
_sections_unfolded = [ "Font", "Settings" ]
2113

2214
[sub_resource type="DynamicFont" id=3]
23-
2415
size = 48
25-
use_mipmaps = false
26-
use_filter = false
2716
font_data = ExtResource( 2 )
28-
_sections_unfolded = [ "Font", "Settings" ]
2917

3018
[node name="HUD" type="CanvasLayer"]
31-
32-
layer = 1
33-
offset = Vector2( 0, 0 )
34-
rotation = 0.0
35-
scale = Vector2( 1, 1 )
36-
transform = Transform2D( 1, 0, 0, 1, 0, 0 )
3719
script = ExtResource( 1 )
3820

39-
[node name="ScoreLabel" type="Label" parent="." index="0"]
40-
21+
[node name="ScoreLabel" type="Label" parent="."]
4122
anchor_left = 0.5
42-
anchor_top = 0.0
4323
anchor_right = 0.5
44-
anchor_bottom = 0.0
4524
margin_left = -25.0
4625
margin_right = 25.0
4726
margin_bottom = 100.0
48-
rect_pivot_offset = Vector2( 0, 0 )
49-
rect_clip_content = false
50-
mouse_filter = 2
51-
mouse_default_cursor_shape = 0
52-
size_flags_horizontal = 1
53-
size_flags_vertical = 4
5427
custom_fonts/font = SubResource( 1 )
5528
text = "0"
5629
align = 1
57-
percent_visible = 1.0
58-
lines_skipped = 0
59-
max_lines_visible = -1
60-
_sections_unfolded = [ "Anchor", "Margin", "custom_fonts" ]
61-
62-
[node name="MessageLabel" type="Label" parent="." index="1"]
6330

31+
[node name="MessageLabel" type="Label" parent="."]
6432
anchor_left = 0.5
6533
anchor_top = 0.5
6634
anchor_right = 0.5
@@ -69,31 +37,17 @@ margin_left = -200.0
6937
margin_top = -150.0
7038
margin_right = 200.0
7139
margin_bottom = 50.0
72-
rect_pivot_offset = Vector2( 0, 0 )
73-
rect_clip_content = false
74-
mouse_filter = 2
75-
mouse_default_cursor_shape = 0
76-
size_flags_horizontal = 1
77-
size_flags_vertical = 4
7840
custom_fonts/font = SubResource( 2 )
7941
text = "Dodge the
8042
Creeps!"
8143
align = 1
8244
valign = 1
83-
percent_visible = 1.0
84-
lines_skipped = 0
85-
max_lines_visible = -1
86-
_sections_unfolded = [ "Anchor", "Margin", "custom_fonts" ]
8745

88-
[node name="MessageTimer" type="Timer" parent="." index="2"]
89-
90-
process_mode = 1
46+
[node name="MessageTimer" type="Timer" parent="."]
9147
wait_time = 2.0
9248
one_shot = true
93-
autostart = false
94-
95-
[node name="StartButton" type="Button" parent="." index="3"]
9649

50+
[node name="StartButton" type="Button" parent="."]
9751
anchor_left = 0.5
9852
anchor_top = 1.0
9953
anchor_right = 0.5
@@ -102,25 +56,8 @@ margin_left = -100.0
10256
margin_top = -200.0
10357
margin_right = 100.0
10458
margin_bottom = -100.0
105-
rect_pivot_offset = Vector2( 0, 0 )
106-
rect_clip_content = false
107-
focus_mode = 2
108-
mouse_filter = 0
109-
mouse_default_cursor_shape = 0
110-
size_flags_horizontal = 1
111-
size_flags_vertical = 1
11259
custom_fonts/font = SubResource( 3 )
113-
toggle_mode = false
114-
enabled_focus_mode = 2
115-
shortcut = null
116-
group = null
11760
text = "Start"
118-
flat = false
119-
align = 1
120-
_sections_unfolded = [ "Anchor", "Margin", "Visibility", "custom_fonts" ]
12161

12262
[connection signal="timeout" from="MessageTimer" to="." method="_on_MessageTimer_timeout"]
123-
12463
[connection signal="pressed" from="StartButton" to="." method="_on_StartButton_pressed"]
125-
126-

2d/dodge_the_creeps/Main.tscn

Lines changed: 12 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -8,105 +8,52 @@
88
[ext_resource path="res://art/gameover.wav" type="AudioStream" id=6]
99

1010
[sub_resource type="Curve2D" id=1]
11-
12-
bake_interval = 5.0
1311
_data = {
1412
"points": PoolVector2Array( 0, 0, 0, 0, 1.70602, 3.56798, 0, 0, 0, 0, 482.263, 3.26522, 0, 0, 0, 0, 480.489, 729.458, 0, 0, 0, 0, 0.794434, 732.118, 0, 0, 0, 0, 1.97066, 3.83263 )
1513
}
1614

17-
[node name="Main" type="Node" index="0"]
18-
15+
[node name="Main" type="Node"]
1916
script = ExtResource( 1 )
2017
Mob = ExtResource( 2 )
2118

22-
[node name="ColorRect" type="ColorRect" parent="." index="0"]
23-
24-
anchor_left = 0.0
25-
anchor_top = 0.0
26-
anchor_right = 0.0
27-
anchor_bottom = 0.0
19+
[node name="ColorRect" type="ColorRect" parent="."]
2820
margin_right = 486.0
2921
margin_bottom = 734.0
30-
rect_pivot_offset = Vector2( 0, 0 )
31-
rect_clip_content = false
32-
mouse_filter = 0
33-
mouse_default_cursor_shape = 0
34-
size_flags_horizontal = 1
35-
size_flags_vertical = 1
3622
color = Color( 0.253451, 0.425288, 0.429412, 1 )
3723

38-
[node name="Player" parent="." index="1" instance=ExtResource( 3 )]
24+
[node name="Player" parent="." instance=ExtResource( 3 )]
3925

40-
[node name="MobTimer" type="Timer" parent="." index="2"]
41-
42-
process_mode = 1
26+
[node name="MobTimer" type="Timer" parent="."]
4327
wait_time = 0.5
44-
one_shot = false
45-
autostart = false
46-
47-
[node name="ScoreTimer" type="Timer" parent="." index="3"]
4828

49-
process_mode = 1
50-
wait_time = 1.0
51-
one_shot = false
52-
autostart = false
29+
[node name="ScoreTimer" type="Timer" parent="."]
5330

54-
[node name="StartTimer" type="Timer" parent="." index="4"]
55-
56-
process_mode = 1
31+
[node name="StartTimer" type="Timer" parent="."]
5732
wait_time = 2.0
5833
one_shot = true
59-
autostart = false
60-
61-
[node name="StartPosition" type="Position2D" parent="." index="5"]
6234

35+
[node name="StartPosition" type="Position2D" parent="."]
6336
position = Vector2( 240, 450 )
64-
_sections_unfolded = [ "Transform" ]
65-
66-
[node name="HUD" parent="." index="6" instance=ExtResource( 4 )]
67-
68-
transform = Transform2D( 1, 0, 0, 1, 0, 0 )
6937

70-
[node name="Music" type="AudioStreamPlayer" parent="." index="7"]
38+
[node name="HUD" parent="." instance=ExtResource( 4 )]
7139

40+
[node name="Music" type="AudioStreamPlayer" parent="."]
7241
stream = ExtResource( 5 )
7342
volume_db = -8.0
74-
autoplay = false
75-
mix_target = 0
76-
bus = "Master"
77-
78-
[node name="DeathSound" type="AudioStreamPlayer" parent="." index="8"]
7943

44+
[node name="DeathSound" type="AudioStreamPlayer" parent="."]
8045
stream = ExtResource( 6 )
8146
volume_db = -5.0
82-
autoplay = false
83-
mix_target = 0
84-
bus = "Master"
85-
86-
[node name="MobPath" type="Path2D" parent="." index="9"]
8747

48+
[node name="MobPath" type="Path2D" parent="."]
8849
curve = SubResource( 1 )
8950

90-
[node name="MobSpawnLocation" type="PathFollow2D" parent="MobPath" index="0"]
91-
51+
[node name="MobSpawnLocation" type="PathFollow2D" parent="MobPath"]
9252
position = Vector2( 1.70602, 3.56798 )
9353
rotation = -0.000630111
94-
offset = 0.0
95-
h_offset = 0.0
96-
v_offset = 0.0
97-
rotate = true
98-
cubic_interp = true
99-
loop = true
100-
lookahead = 4.0
10154

10255
[connection signal="hit" from="Player" to="." method="game_over"]
103-
10456
[connection signal="timeout" from="MobTimer" to="." method="_on_MobTimer_timeout"]
105-
10657
[connection signal="timeout" from="ScoreTimer" to="." method="_on_ScoreTimer_timeout"]
107-
10858
[connection signal="timeout" from="StartTimer" to="." method="_on_StartTimer_timeout"]
109-
11059
[connection signal="start_game" from="HUD" to="." method="new_game"]
111-
112-

2d/dodge_the_creeps/Mob.tscn

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
[ext_resource path="res://art/enemySwimming_2.png" type="Texture" id=7]
1010

1111
[sub_resource type="SpriteFrames" id=1]
12-
1312
animations = [ {
1413
"frames": [ ExtResource( 2 ), ExtResource( 3 ) ],
1514
"loop": true,
@@ -28,55 +27,32 @@ animations = [ {
2827
} ]
2928

3029
[sub_resource type="CapsuleShape2D" id=2]
31-
32-
custom_solver_bias = 0.0
3330
radius = 34.8222
3431
height = 28.8308
3532

3633
[node name="Mob" type="RigidBody2D"]
37-
3834
input_pickable = true
39-
collision_layer = 1
4035
collision_mask = 0
41-
mode = 0
42-
mass = 1.0
43-
friction = 1.0
44-
bounce = 0.0
4536
gravity_scale = 0.0
46-
custom_integrator = false
47-
continuous_cd = 0
48-
contacts_reported = 0
49-
contact_monitor = false
50-
sleeping = false
51-
can_sleep = true
52-
linear_velocity = Vector2( 0, 0 )
5337
linear_damp = 0.1
54-
angular_velocity = 0.0
5538
angular_damp = 1.0
5639
script = ExtResource( 1 )
57-
_sections_unfolded = [ "Angular", "Collision", "Transform" ]
5840
__meta__ = {
5941
"_edit_group_": true
6042
}
6143
MIN_SPEED = 150
6244
MAX_SPEED = 250
6345

64-
[node name="AnimatedSprite" type="AnimatedSprite" parent="." index="0"]
65-
46+
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
6647
scale = Vector2( 0.75, 0.75 )
6748
frames = SubResource( 1 )
6849
animation = "swim"
50+
frame = 1
6951
playing = true
70-
_sections_unfolded = [ "Transform" ]
71-
72-
[node name="Collision" type="CollisionShape2D" parent="." index="1"]
7352

53+
[node name="Collision" type="CollisionShape2D" parent="."]
7454
rotation = 1.5708
7555
shape = SubResource( 2 )
76-
_sections_unfolded = [ "Transform", "Visibility" ]
77-
78-
[node name="Visibility" type="VisibilityNotifier2D" parent="." index="2"]
79-
80-
rect = Rect2( -10, -10, 20, 20 )
8156

57+
[node name="Visibility" type="VisibilityNotifier2D" parent="."]
8258

2d/dodge_the_creeps/Player.gd

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ func _ready():
1313
func start(pos):
1414
position = pos
1515
show()
16-
$Collision.disabled = false
16+
# Must be deferred as we can't change physics properties on a physics callback
17+
$Collision.set_deferred("disabled", false)
1718

1819
func _process(delta):
1920
velocity = Vector2()
@@ -45,10 +46,8 @@ func _process(delta):
4546
$AnimatedSprite.animation = "up"
4647
$AnimatedSprite.flip_v = velocity.y > 0
4748

48-
func _on_Player_body_entered( body ):
49-
$Collision.disabled = true
49+
func _on_Player_body_entered(_body):
50+
# Must be deferred as we can't change physics properties on a physics callback
51+
$Collision.set_deferred("disabled", true)
5052
hide()
5153
emit_signal("hit")
52-
53-
54-

0 commit comments

Comments
 (0)