Browse Source

refactor minigame

Arnaud Vergnet 2 years ago
parent
commit
d28716d346
35 changed files with 336 additions and 629 deletions
  1. 40
    10
      mini-game/MiniGame.gd
  2. 11
    6
      mini-game/MiniGame.tscn
  3. 5
    21
      mini-game/scenes/bonuses/bonus1.tscn
  4. 5
    21
      mini-game/scenes/bonuses/bonus2.tscn
  5. 5
    22
      mini-game/scenes/bonuses/bonus3.tscn
  6. 5
    22
      mini-game/scenes/bonuses/bonus4.tscn
  7. 5
    25
      mini-game/scenes/bonuses/bonus5.tscn
  8. 5
    42
      mini-game/scenes/decor/scoreUI.gd
  9. 0
    4
      mini-game/scenes/decor/scoreUI.tscn
  10. 20
    0
      mini-game/scenes/decor/startTimerUI.gd
  11. 2
    2
      mini-game/scenes/decor/startTimerUI.tscn
  12. 0
    18
      mini-game/scenes/decor/start_timer_UI.gd
  13. 0
    28
      mini-game/scenes/effets/ScrollingBG.tscn
  14. 0
    3
      mini-game/scenes/effets/collision_obstacle.tscn
  15. 0
    3
      mini-game/scenes/effets/pick_bonus.tscn
  16. 3
    22
      mini-game/scenes/obstacles/obstacle1.tscn
  17. 4
    23
      mini-game/scenes/obstacles/obstacle2.tscn
  18. 4
    22
      mini-game/scenes/obstacles/obstacle3.tscn
  19. 4
    22
      mini-game/scenes/obstacles/obstacle4.tscn
  20. 4
    25
      mini-game/scenes/obstacles/obstacle5.tscn
  21. 93
    0
      mini-game/scenes/players/player.gd
  22. 3
    5
      mini-game/scenes/players/player.tscn
  23. 0
    6
      mini-game/scenes/players/player1.tscn
  24. 42
    0
      mini-game/scenes/spawner/pickup.gd
  25. 24
    0
      mini-game/scenes/spawner/pickup.tscn
  26. 51
    0
      mini-game/scenes/spawner/spawner.gd
  27. 1
    2
      mini-game/scenes/spawner/spawner.tscn
  28. 0
    19
      mini-game/scripts/ScrollingBG.gd
  29. 0
    9
      mini-game/scripts/Signals.gd
  30. 0
    20
      mini-game/scripts/bonus1.gd
  31. 0
    22
      mini-game/scripts/obstacle1.gd
  32. 0
    16
      mini-game/scripts/player1.gd
  33. 0
    111
      mini-game/scripts/player2.gd
  34. 0
    14
      mini-game/scripts/scroll_movement.gd
  35. 0
    64
      mini-game/scripts/spawner.gd

+ 40
- 10
mini-game/MiniGame.gd View File

@@ -4,16 +4,18 @@ signal game_over
4 4
 
5 5
 onready var foreground := $foreground
6 6
 onready var spawner := $spawner
7
-onready var player := $player2
7
+onready var player := $player
8 8
 onready var scoreUI := $scoreUI
9
-onready var start_timer_UI := $start_timer_UI
9
+onready var start_timer_UI := $startTimerUI
10 10
 onready var instructionsUI := $instructionsUI
11
+onready var timer := $Timer
11 12
 
12 13
 var next_timeline_lose := ""
13 14
 var next_timeline_win := ""
14 15
 
15 16
 var game_mode = ""
16 17
 var game_goal = 10
18
+var current_goal = 0
17 19
 var game_difficulty = "easy"
18 20
 var game_version = 0
19 21
 
@@ -21,8 +23,7 @@ var MUSIC = "res://music/mini_jeu.ogg"
21 23
 
22 24
 
23 25
 func _ready():
24
-	Signals.connect("die", self, "on_game_over")
25
-	Signals.connect("win", self, "on_win")
26
+	pass
26 27
 
27 28
 
28 29
 func setup(mode: String, goal: int, difficulty: String, next_lose: String, next_win: String, version: int):
@@ -34,7 +35,7 @@ func setup(mode: String, goal: int, difficulty: String, next_lose: String, next_
34 35
 	game_version = version
35 36
 	print("setup minigame: " + mode + " " + next_lose + " " + next_win)
36 37
 	set_mode(mode)
37
-	scoreUI.init(mode, game_goal)
38
+	scoreUI.init(mode)
38 39
 	next_timeline_lose = next_lose
39 40
 	next_timeline_win = next_win
40 41
 
@@ -58,25 +59,30 @@ func start():
58 59
 	add_child(t)
59 60
 	t.start()
60 61
 	for n in range(3,0,-1):
61
-		start_timer_UI.update_timer(String(n))
62
+		start_timer_UI.update_timer(n)
62 63
 		yield(t, "timeout")
63
-	start_timer_UI.update_timer("GO !")
64
+	start_timer_UI.update_timer(0)
64 65
 	instructionsUI._init()
65 66
 	foreground.start()
66
-	player.start(game_mode, game_goal)
67
+	player.start()
67 68
 	yield(t, "timeout")
68 69
 	yield(t, "timeout")
69 70
 	start_timer_UI.hide()
70 71
 	spawner.start(game_difficulty, game_version)
71
-	scoreUI.start(game_mode)
72
+	if game_mode == "score":
73
+		scoreUI.start(0)
74
+	else:
75
+		scoreUI.start(game_goal)
72 76
 	t.queue_free()
77
+	if game_mode == "time":
78
+		timer.start()
73 79
 
74 80
 
75 81
 func stop():
76 82
 	foreground.stop()
77 83
 	player.stop()
78 84
 	spawner.stop()
79
-	scoreUI.stop()
85
+	timer.stop()
80 86
 
81 87
 
82 88
 func on_win():
@@ -87,3 +93,27 @@ func on_win():
87 93
 func on_game_over():
88 94
 	stop()
89 95
 	emit_signal("game_over", next_timeline_lose)
96
+
97
+
98
+func _on_player_die() -> void:
99
+	on_game_over()
100
+
101
+
102
+func _on_player_hit() -> void:
103
+	pass
104
+
105
+
106
+func _on_player_score() -> void:
107
+	if game_mode == "score":
108
+		current_goal += 1
109
+		scoreUI.update_score(current_goal)
110
+		if current_goal >= game_goal:
111
+			on_win()
112
+
113
+
114
+func _on_Timer_timeout() -> void:
115
+	if game_mode == "time":
116
+		current_goal += 1
117
+		scoreUI.update_score(game_goal - current_goal)
118
+		if current_goal >= game_goal:
119
+			on_win()

+ 11
- 6
mini-game/MiniGame.tscn View File

@@ -2,9 +2,9 @@
2 2
 
3 3
 [ext_resource path="res://mini-game/scenes/decor/background.tscn" type="PackedScene" id=1]
4 4
 [ext_resource path="res://mini-game/scenes/decor/foreground.tscn" type="PackedScene" id=2]
5
-[ext_resource path="res://mini-game/scenes/players/player2.tscn" type="PackedScene" id=3]
5
+[ext_resource path="res://mini-game/scenes/players/player.tscn" type="PackedScene" id=3]
6 6
 [ext_resource path="res://mini-game/MiniGame.gd" type="Script" id=4]
7
-[ext_resource path="res://mini-game/scenes/decor/start_timer_UI.tscn" type="PackedScene" id=5]
7
+[ext_resource path="res://mini-game/scenes/decor/startTimerUI.tscn" type="PackedScene" id=5]
8 8
 [ext_resource path="res://mini-game/scenes/spawner/spawner.tscn" type="PackedScene" id=6]
9 9
 [ext_resource path="res://mini-game/scenes/decor/scoreUI.tscn" type="PackedScene" id=7]
10 10
 [ext_resource path="res://mini-game/scenes/decor/instructionsUI.tscn" type="PackedScene" id=8]
@@ -19,13 +19,18 @@ script = ExtResource( 4 )
19 19
 [node name="spawner" parent="." instance=ExtResource( 6 )]
20 20
 position = Vector2( 2015.43, 970.395 )
21 21
 
22
-[node name="player2" parent="." instance=ExtResource( 3 )]
22
+[node name="player" parent="." instance=ExtResource( 3 )]
23 23
 position = Vector2( 183.674, 888.367 )
24
-jump_vitesse = 1100.0
25
-gravite = 45.0
26 24
 
27 25
 [node name="scoreUI" parent="." instance=ExtResource( 7 )]
28 26
 
29
-[node name="start_timer_UI" parent="." instance=ExtResource( 5 )]
27
+[node name="startTimerUI" parent="." instance=ExtResource( 5 )]
30 28
 
31 29
 [node name="instructionsUI" parent="." instance=ExtResource( 8 )]
30
+
31
+[node name="Timer" type="Timer" parent="."]
32
+
33
+[connection signal="die" from="player" to="." method="_on_player_die"]
34
+[connection signal="hit" from="player" to="." method="_on_player_hit"]
35
+[connection signal="score" from="player" to="." method="_on_player_score"]
36
+[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]

+ 5
- 21
mini-game/scenes/bonuses/bonus1.tscn View File

@@ -1,24 +1,8 @@
1
-[gd_scene load_steps=5 format=2]
1
+[gd_scene load_steps=3 format=2]
2 2
 
3
-[ext_resource path="res://mini-game/scripts/bonus1.gd" type="Script" id=1]
3
+[ext_resource path="res://mini-game/scenes/spawner/pickup.tscn" type="PackedScene" id=1]
4 4
 [ext_resource path="res://mini-game/ressources/sprites/bonus/bone.png" type="Texture" id=2]
5
-[ext_resource path="res://mini-game/scenes/effets/pick_bonus.tscn" type="PackedScene" id=3]
6 5
 
7
-[sub_resource type="RectangleShape2D" id=1]
8
-extents = Vector2( 24.0183, 9.31512 )
9
-
10
-[node name="bonus1" type="Node2D"]
11
-script = ExtResource( 1 )
12
-
13
-[node name="Sprite" type="Sprite" parent="."]
14
-scale = Vector2( 0.119644, 0.119644 )
15
-texture = ExtResource( 2 )
16
-
17
-[node name="pick_bonus" parent="." instance=ExtResource( 3 )]
18
-
19
-[node name="CollisionShape2D" type="CollisionShape2D" parent="pick_bonus"]
20
-shape = SubResource( 1 )
21
-
22
-[node name="notifier" type="VisibilityNotifier2D" parent="."]
23
-
24
-[connection signal="body_entered" from="pick_bonus" to="." method="_on_pick_bonus_body_entered"]
6
+[node name="bonus1" instance=ExtResource( 1 )]
7
+sprite_texture = ExtResource( 2 )
8
+type = "bonus"

+ 5
- 21
mini-game/scenes/bonuses/bonus2.tscn View File

@@ -1,24 +1,8 @@
1
-[gd_scene load_steps=5 format=2]
1
+[gd_scene load_steps=3 format=2]
2 2
 
3
-[ext_resource path="res://mini-game/scripts/bonus1.gd" type="Script" id=1]
3
+[ext_resource path="res://mini-game/scenes/spawner/pickup.tscn" type="PackedScene" id=1]
4 4
 [ext_resource path="res://mini-game/ressources/sprites/bonus/bonus_enveloppe.png" type="Texture" id=2]
5
-[ext_resource path="res://mini-game/scenes/effets/pick_bonus.tscn" type="PackedScene" id=3]
6 5
 
7
-[sub_resource type="RectangleShape2D" id=1]
8
-extents = Vector2( 51.3758, 37.234 )
9
-
10
-[node name="bonus2" type="Node2D"]
11
-script = ExtResource( 1 )
12
-
13
-[node name="Sprite" type="Sprite" parent="."]
14
-scale = Vector2( 0.2, 0.2 )
15
-texture = ExtResource( 2 )
16
-
17
-[node name="pick_bonus" parent="." instance=ExtResource( 3 )]
18
-
19
-[node name="CollisionShape2D" type="CollisionShape2D" parent="pick_bonus"]
20
-position = Vector2( -0.625, 0 )
21
-shape = SubResource( 1 )
22
-
23
-[node name="notifier" type="VisibilityNotifier2D" parent="."]
24
-[connection signal="body_entered" from="pick_bonus" to="." method="_on_pick_bonus_body_entered"]
6
+[node name="bonus1" instance=ExtResource( 1 )]
7
+sprite_texture = ExtResource( 2 )
8
+type = "bonus"

+ 5
- 22
mini-game/scenes/bonuses/bonus3.tscn View File

@@ -1,25 +1,8 @@
1
-[gd_scene load_steps=5 format=2]
1
+[gd_scene load_steps=3 format=2]
2 2
 
3
-[ext_resource path="res://mini-game/scripts/bonus1.gd" type="Script" id=1]
3
+[ext_resource path="res://mini-game/scenes/spawner/pickup.tscn" type="PackedScene" id=1]
4 4
 [ext_resource path="res://mini-game/ressources/sprites/bonus/oreille.png" type="Texture" id=2]
5
-[ext_resource path="res://mini-game/scenes/effets/pick_bonus.tscn" type="PackedScene" id=3]
6 5
 
7
-[sub_resource type="RectangleShape2D" id=1]
8
-extents = Vector2( 44.6127, 47.0458 )
9
-
10
-[node name="bonus3" type="Node2D"]
11
-script = ExtResource( 1 )
12
-
13
-[node name="Sprite" type="Sprite" parent="."]
14
-position = Vector2( 0.627587, -14.6332 )
15
-scale = Vector2( 0.101666, 0.101666 )
16
-texture = ExtResource( 2 )
17
-
18
-[node name="pick_bonus" parent="." instance=ExtResource( 3 )]
19
-
20
-[node name="CollisionShape2D" type="CollisionShape2D" parent="pick_bonus"]
21
-position = Vector2( 1.00113, -11.3461 )
22
-shape = SubResource( 1 )
23
-
24
-[node name="notifier" type="VisibilityNotifier2D" parent="."]
25
-[connection signal="body_entered" from="pick_bonus" to="." method="_on_pick_bonus_body_entered"]
6
+[node name="bonus3" instance=ExtResource( 1 )]
7
+sprite_texture = ExtResource( 2 )
8
+type = "bonus"

+ 5
- 22
mini-game/scenes/bonuses/bonus4.tscn View File

@@ -1,25 +1,8 @@
1
-[gd_scene load_steps=5 format=2]
1
+[gd_scene load_steps=3 format=2]
2 2
 
3
-[ext_resource path="res://mini-game/scripts/bonus1.gd" type="Script" id=1]
3
+[ext_resource path="res://mini-game/scenes/spawner/pickup.tscn" type="PackedScene" id=1]
4 4
 [ext_resource path="res://mini-game/ressources/sprites/bonus/telephonebrillant.png" type="Texture" id=2]
5
-[ext_resource path="res://mini-game/scenes/effets/pick_bonus.tscn" type="PackedScene" id=3]
6 5
 
7
-[sub_resource type="RectangleShape2D" id=1]
8
-extents = Vector2( 25.9386, 54.0271 )
9
-
10
-[node name="bonus4" type="Node2D"]
11
-script = ExtResource( 1 )
12
-
13
-[node name="Sprite" type="Sprite" parent="."]
14
-position = Vector2( -0.453356, -18.8551 )
15
-scale = Vector2( 0.0729584, 0.0729585 )
16
-texture = ExtResource( 2 )
17
-
18
-[node name="pick_bonus" parent="." instance=ExtResource( 3 )]
19
-
20
-[node name="CollisionShape2D" type="CollisionShape2D" parent="pick_bonus"]
21
-position = Vector2( -0.594162, -14.2551 )
22
-shape = SubResource( 1 )
23
-
24
-[node name="notifier" type="VisibilityNotifier2D" parent="."]
25
-[connection signal="body_entered" from="pick_bonus" to="." method="_on_pick_bonus_body_entered"]
6
+[node name="bonus4" instance=ExtResource( 1 )]
7
+sprite_texture = ExtResource( 2 )
8
+type = "bonus"

+ 5
- 25
mini-game/scenes/bonuses/bonus5.tscn View File

@@ -1,28 +1,8 @@
1
-[gd_scene load_steps=5 format=2]
1
+[gd_scene load_steps=3 format=2]
2 2
 
3
-[ext_resource path="res://mini-game/scripts/bonus1.gd" type="Script" id=1]
3
+[ext_resource path="res://mini-game/scenes/spawner/pickup.tscn" type="PackedScene" id=1]
4 4
 [ext_resource path="res://mini-game/ressources/sprites/bonus/peinture.png" type="Texture" id=2]
5
-[ext_resource path="res://mini-game/scenes/effets/pick_bonus.tscn" type="PackedScene" id=3]
6 5
 
7
-[sub_resource type="RectangleShape2D" id=1]
8
-extents = Vector2( 30.5774, 94.4143 )
9
-
10
-[node name="bonus5" type="Node2D"]
11
-script = ExtResource( 1 )
12
-__meta__ = {
13
-"_edit_horizontal_guides_": [ -97.9765 ]
14
-}
15
-
16
-[node name="Sprite" type="Sprite" parent="."]
17
-position = Vector2( 0.0226159, -21.252 )
18
-scale = Vector2( 0.101622, 0.101622 )
19
-texture = ExtResource( 2 )
20
-
21
-[node name="pick_bonus" parent="." instance=ExtResource( 3 )]
22
-
23
-[node name="CollisionShape2D" type="CollisionShape2D" parent="pick_bonus"]
24
-position = Vector2( -0.759476, -7.68111 )
25
-shape = SubResource( 1 )
26
-
27
-[node name="notifier" type="VisibilityNotifier2D" parent="."]
28
-[connection signal="body_entered" from="pick_bonus" to="." method="_on_pick_bonus_body_entered"]
6
+[node name="bonus5" instance=ExtResource( 1 )]
7
+sprite_texture = ExtResource( 2 )
8
+type = "bonus"

+ 5
- 42
mini-game/scenes/decor/scoreUI.gd View File

@@ -1,55 +1,18 @@
1 1
 extends Control
2 2
 
3
-onready var label : Label = $MarginContainer/Label
4
-onready var timer = $Timer
3
+onready var label := $MarginContainer/Label
5 4
 
6 5
 var game_mode
7
-var max_time = 30
8
-var current_time = 0
9
-
10
-func _ready():
11
-	Signals.connect("update_score",self,"update_score")
12
-
13 6
 
14 7
 func update_score(score: int):
15 8
 	label.text = String(score)
16 9
 
17 10
 
18
-func start(mode: String):
19
-	match mode:
20
-		"score":
21
-			update_score(0)
22
-			show()
23
-		"time":
24
-			update_score(max_time)
25
-			show()
26
-			current_time = 0
27
-			timer.start()
28
-		_:
29
-			print("game_mode not recognized by scoreUI")
11
+func start(initial_score: int):
12
+	update_score(initial_score)
13
+	show()
30 14
 
31 15
 
32
-func set_max_time(time: int):
33
-	max_time = time
34
-
35
-func init(mode, goal: int):
16
+func init(mode: String):
36 17
 	game_mode = mode
37
-	if (goal != 0):
38
-		max_time = goal
39 18
 	hide()
40
-
41
-
42
-func stop():
43
-	timer.stop()
44
-
45
-
46
-func _on_Timer_timeout() -> void:
47
-	current_time += 1
48
-	var n = max_time - current_time
49
-	if n < 0:
50
-		n = 0
51
-	update_score(n)
52
-	if n == 0:
53
-		Signals.emit_signal("win")
54
-		timer.stop()
55
-		

+ 0
- 4
mini-game/scenes/decor/scoreUI.tscn View File

@@ -39,7 +39,3 @@ align = 1
39 39
 __meta__ = {
40 40
 "_edit_use_anchors_": false
41 41
 }
42
-
43
-[node name="Timer" type="Timer" parent="."]
44
-
45
-[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]

+ 20
- 0
mini-game/scenes/decor/startTimerUI.gd View File

@@ -0,0 +1,20 @@
1
+extends Control
2
+
3
+
4
+onready var label : Label = $MarginContainer/Label
5
+
6
+func _ready():
7
+	hide()
8
+
9
+
10
+func update_timer(score: int):
11
+	if score > 0:
12
+		label.text = String(score)
13
+	else:
14
+		label.text = "GO !"
15
+
16
+
17
+func init():
18
+	update_timer(3)
19
+	show()
20
+

mini-game/scenes/decor/start_timer_UI.tscn → mini-game/scenes/decor/startTimerUI.tscn View File

@@ -1,7 +1,7 @@
1 1
 [gd_scene load_steps=4 format=2]
2 2
 
3 3
 [ext_resource path="res://mini-game/ressources/font/joystix/ot/joystix monospace.otf" type="DynamicFontData" id=1]
4
-[ext_resource path="res://mini-game/scenes/decor/start_timer_UI.gd" type="Script" id=2]
4
+[ext_resource path="res://mini-game/scenes/decor/startTimerUI.gd" type="Script" id=2]
5 5
 
6 6
 [sub_resource type="DynamicFont" id=1]
7 7
 size = 200
@@ -9,7 +9,7 @@ outline_size = 20
9 9
 outline_color = Color( 0, 0, 0, 1 )
10 10
 font_data = ExtResource( 1 )
11 11
 
12
-[node name="start_timer_UI" type="Control"]
12
+[node name="startTimerUI" type="Control"]
13 13
 anchor_right = 1.0
14 14
 anchor_bottom = 1.0
15 15
 margin_right = 0.00012207

+ 0
- 18
mini-game/scenes/decor/start_timer_UI.gd View File

@@ -1,18 +0,0 @@
1
-extends Control
2
-
3
-
4
-onready var label : Label = $MarginContainer/Label
5
-
6
-func _ready():
7
-	Signals.connect("update_timer",self,"update_timer")
8
-	hide()
9
-	
10
-
11
-func update_timer(score: String):
12
-	label.text = score
13
-	
14
-
15
-func init():
16
-	update_timer(String(3))
17
-	show()
18
-

+ 0
- 28
mini-game/scenes/effets/ScrollingBG.tscn View File

@@ -1,28 +0,0 @@
1
-[gd_scene load_steps=4 format=2]
2
-
3
-[ext_resource path="res://mini-game/scripts/ScrollingBG.gd" type="Script" id=1]
4
-
5
-[sub_resource type="Shader" id=1]
6
-code = "shader_type canvas_item;
7
-
8
-uniform float scroll_speed;
9
-
10
-void fragment(){
11
-	vec2 u = UV;
12
-	u.x += scroll_speed*TIME;
13
-	vec4 color = texture(TEXTURE,u);
14
-	COLOR = color;
15
-}
16
-"
17
-
18
-[sub_resource type="ShaderMaterial" id=2]
19
-shader = SubResource( 1 )
20
-shader_param/scroll_speed = 0.2
21
-
22
-[node name="ScrollingBG" type="TextureRect"]
23
-material = SubResource( 2 )
24
-stretch_mode = 2
25
-script = ExtResource( 1 )
26
-__meta__ = {
27
-"_edit_use_anchors_": false
28
-}

+ 0
- 3
mini-game/scenes/effets/collision_obstacle.tscn View File

@@ -1,3 +0,0 @@
1
-[gd_scene format=2]
2
-
3
-[node name="collision_obstacle" type="Area2D"]

+ 0
- 3
mini-game/scenes/effets/pick_bonus.tscn View File

@@ -1,3 +0,0 @@
1
-[gd_scene format=2]
2
-
3
-[node name="pick_bonus" type="Area2D"]

+ 3
- 22
mini-game/scenes/obstacles/obstacle1.tscn View File

@@ -1,24 +1,5 @@
1
-[gd_scene load_steps=5 format=2]
1
+[gd_scene load_steps=2 format=2]
2 2
 
3
-[ext_resource path="res://mini-game/scripts/obstacle1.gd" type="Script" id=1]
4
-[ext_resource path="res://mini-game/ressources/sprites/obstacle/barrel.png" type="Texture" id=2]
5
-[ext_resource path="res://mini-game/scenes/effets/collision_obstacle.tscn" type="PackedScene" id=3]
3
+[ext_resource path="res://mini-game/scenes/spawner/pickup.tscn" type="PackedScene" id=1]
6 4
 
7
-[sub_resource type="RectangleShape2D" id=1]
8
-extents = Vector2( 28.3542, 36.1379 )
9
-
10
-[node name="obstacle1" type="Node2D"]
11
-script = ExtResource( 1 )
12
-
13
-[node name="Sprite" type="Sprite" parent="."]
14
-scale = Vector2( 0.202437, 0.202437 )
15
-texture = ExtResource( 2 )
16
-
17
-[node name="collision_obstacle" parent="." instance=ExtResource( 3 )]
18
-
19
-[node name="CollisionShape2D" type="CollisionShape2D" parent="collision_obstacle"]
20
-shape = SubResource( 1 )
21
-
22
-[node name="notifier" type="VisibilityNotifier2D" parent="."]
23
-
24
-[connection signal="body_entered" from="collision_obstacle" to="." method="_on_collision_obstacle_body_entered"]
5
+[node name="obstacle2" instance=ExtResource( 1 )]

+ 4
- 23
mini-game/scenes/obstacles/obstacle2.tscn View File

@@ -1,26 +1,7 @@
1
-[gd_scene load_steps=5 format=2]
1
+[gd_scene load_steps=3 format=2]
2 2
 
3
-[ext_resource path="res://mini-game/scripts/obstacle1.gd" type="Script" id=1]
3
+[ext_resource path="res://mini-game/scenes/spawner/pickup.tscn" type="PackedScene" id=1]
4 4
 [ext_resource path="res://mini-game/ressources/sprites/obstacle/malus_enveloppe.png" type="Texture" id=2]
5
-[ext_resource path="res://mini-game/scenes/effets/collision_obstacle.tscn" type="PackedScene" id=3]
6 5
 
7
-[sub_resource type="RectangleShape2D" id=1]
8
-extents = Vector2( 46.8347, 33.7529 )
9
-
10
-[node name="obstacle2" type="Node2D"]
11
-script = ExtResource( 1 )
12
-
13
-[node name="Sprite" type="Sprite" parent="."]
14
-position = Vector2( -0.0556164, -0.166861 )
15
-scale = Vector2( 0.2, 0.2 )
16
-texture = ExtResource( 2 )
17
-
18
-[node name="collision_obstacle" parent="." instance=ExtResource( 3 )]
19
-
20
-[node name="CollisionShape2D" type="CollisionShape2D" parent="collision_obstacle"]
21
-shape = SubResource( 1 )
22
-
23
-[node name="notifier" type="VisibilityNotifier2D" parent="."]
24
-position = Vector2( -0.333708, -0.333708 )
25
-scale = Vector2( 4.70418, 3.36934 )
26
-[connection signal="body_entered" from="collision_obstacle" to="." method="_on_collision_obstacle_body_entered"]
6
+[node name="obstacle2" instance=ExtResource( 1 )]
7
+sprite_texture = ExtResource( 2 )

+ 4
- 22
mini-game/scenes/obstacles/obstacle3.tscn View File

@@ -1,25 +1,7 @@
1
-[gd_scene load_steps=5 format=2]
1
+[gd_scene load_steps=3 format=2]
2 2
 
3
-[ext_resource path="res://mini-game/scripts/obstacle1.gd" type="Script" id=1]
3
+[ext_resource path="res://mini-game/scenes/spawner/pickup.tscn" type="PackedScene" id=1]
4 4
 [ext_resource path="res://mini-game/ressources/sprites/obstacle/telephoneconference.png" type="Texture" id=2]
5
-[ext_resource path="res://mini-game/scenes/effets/collision_obstacle.tscn" type="PackedScene" id=3]
6 5
 
7
-[sub_resource type="RectangleShape2D" id=1]
8
-extents = Vector2( 25.3346, 58.4363 )
9
-
10
-[node name="obstacle3" type="Node2D"]
11
-script = ExtResource( 1 )
12
-
13
-[node name="Sprite" type="Sprite" parent="."]
14
-position = Vector2( 1.45743, -10.024 )
15
-scale = Vector2( 0.0703989, 0.0703989 )
16
-texture = ExtResource( 2 )
17
-
18
-[node name="collision_obstacle" parent="." instance=ExtResource( 3 )]
19
-
20
-[node name="CollisionShape2D" type="CollisionShape2D" parent="collision_obstacle"]
21
-position = Vector2( -1.33633, 0 )
22
-shape = SubResource( 1 )
23
-
24
-[node name="notifier" type="VisibilityNotifier2D" parent="."]
25
-[connection signal="body_entered" from="collision_obstacle" to="." method="_on_collision_obstacle_body_entered"]
6
+[node name="obstacle3" instance=ExtResource( 1 )]
7
+sprite_texture = ExtResource( 2 )

+ 4
- 22
mini-game/scenes/obstacles/obstacle4.tscn View File

@@ -1,25 +1,7 @@
1
-[gd_scene load_steps=5 format=2]
1
+[gd_scene load_steps=3 format=2]
2 2
 
3
-[ext_resource path="res://mini-game/scripts/obstacle1.gd" type="Script" id=1]
3
+[ext_resource path="res://mini-game/scenes/spawner/pickup.tscn" type="PackedScene" id=1]
4 4
 [ext_resource path="res://mini-game/ressources/sprites/obstacle/telephoneflamme.png" type="Texture" id=2]
5
-[ext_resource path="res://mini-game/scenes/effets/collision_obstacle.tscn" type="PackedScene" id=3]
6 5
 
7
-[sub_resource type="RectangleShape2D" id=1]
8
-extents = Vector2( 24.4662, 65.2837 )
9
-
10
-[node name="obstacle4" type="Node2D"]
11
-script = ExtResource( 1 )
12
-
13
-[node name="Sprite" type="Sprite" parent="."]
14
-position = Vector2( 0.832382, -16.9321 )
15
-scale = Vector2( 0.0711866, 0.0711866 )
16
-texture = ExtResource( 2 )
17
-
18
-[node name="collision_obstacle" parent="." instance=ExtResource( 3 )]
19
-
20
-[node name="CollisionShape2D" type="CollisionShape2D" parent="collision_obstacle"]
21
-position = Vector2( 1.08099, -1.5749 )
22
-shape = SubResource( 1 )
23
-
24
-[node name="notifier" type="VisibilityNotifier2D" parent="."]
25
-[connection signal="body_entered" from="collision_obstacle" to="." method="_on_collision_obstacle_body_entered"]
6
+[node name="obstacle4" instance=ExtResource( 1 )]
7
+sprite_texture = ExtResource( 2 )

+ 4
- 25
mini-game/scenes/obstacles/obstacle5.tscn View File

@@ -1,28 +1,7 @@
1
-[gd_scene load_steps=5 format=2]
1
+[gd_scene load_steps=3 format=2]
2 2
 
3
-[ext_resource path="res://mini-game/scripts/obstacle1.gd" type="Script" id=1]
3
+[ext_resource path="res://mini-game/scenes/spawner/pickup.tscn" type="PackedScene" id=1]
4 4
 [ext_resource path="res://mini-game/ressources/sprites/obstacle/dessin.png" type="Texture" id=2]
5
-[ext_resource path="res://mini-game/scenes/effets/collision_obstacle.tscn" type="PackedScene" id=3]
6 5
 
7
-[sub_resource type="RectangleShape2D" id=1]
8
-extents = Vector2( 25.9509, 82.5121 )
9
-
10
-[node name="obstacle5" type="Node2D"]
11
-script = ExtResource( 1 )
12
-__meta__ = {
13
-"_edit_horizontal_guides_": [  ]
14
-}
15
-
16
-[node name="Sprite" type="Sprite" parent="."]
17
-position = Vector2( -0.582159, -32.5956 )
18
-scale = Vector2( 0.073, 0.073 )
19
-texture = ExtResource( 2 )
20
-
21
-[node name="collision_obstacle" parent="." instance=ExtResource( 3 )]
22
-
23
-[node name="CollisionShape2D" type="CollisionShape2D" parent="collision_obstacle"]
24
-position = Vector2( -1.05112, 3.99426 )
25
-shape = SubResource( 1 )
26
-
27
-[node name="notifier" type="VisibilityNotifier2D" parent="."]
28
-[connection signal="body_entered" from="collision_obstacle" to="." method="_on_collision_obstacle_body_entered"]
6
+[node name="obstacle5" instance=ExtResource( 1 )]
7
+sprite_texture = ExtResource( 2 )

+ 93
- 0
mini-game/scenes/players/player.gd View File

@@ -0,0 +1,93 @@
1
+extends KinematicBody2D
2
+
3
+var speed = Vector2.ZERO
4
+
5
+export var jump_speed = 1100.0
6
+export var gravity = 45.0
7
+export var max_lives = 1
8
+
9
+enum {
10
+	RUN,
11
+	JUMP,
12
+	IDLE
13
+}
14
+
15
+enum {
16
+	SCORE,
17
+	TIME
18
+}
19
+
20
+var jump_key = "dialogic_next"
21
+
22
+var player_enabled = false
23
+
24
+var state = RUN
25
+var au_sol = true
26
+
27
+var current_lives = max_lives
28
+
29
+onready var animation = $AnimatedSprite
30
+
31
+signal hit()
32
+signal die()
33
+signal score()
34
+
35
+func _ready():
36
+	stop()
37
+
38
+
39
+func _physics_process(delta):
40
+	if player_enabled:
41
+		match state:
42
+			RUN:
43
+				animation.play("man_run")
44
+			JUMP:
45
+				speed = Vector2.ZERO
46
+				speed.y -= jump_speed
47
+				animation.play("man_jump")
48
+				state = IDLE
49
+			IDLE:
50
+				pass
51
+		speed.y += gravity
52
+		move_and_collide(speed*delta)
53
+
54
+
55
+func _input(event):
56
+	if player_enabled and state == RUN and event.is_action_pressed(jump_key):
57
+			state = JUMP
58
+
59
+
60
+func _on_Area2D_body_entered(body):
61
+	if body is StaticBody2D:
62
+		state = RUN
63
+
64
+
65
+func _on_Area2D_body_exited(body):
66
+	if body is StaticBody2D:
67
+		state = JUMP
68
+
69
+
70
+func start():
71
+	show()
72
+	player_enabled = true
73
+
74
+
75
+func stop():
76
+	hide()
77
+	player_enabled = false
78
+
79
+
80
+func hit():
81
+	print("hit")
82
+	current_lives -= 1
83
+	if current_lives > 0:
84
+		emit_signal("hit")
85
+	else:
86
+		current_lives = 0
87
+		emit_signal("die")
88
+
89
+
90
+func bonus():
91
+	print("bonus")
92
+	emit_signal("score")
93
+

mini-game/scenes/players/player2.tscn → mini-game/scenes/players/player.tscn View File

@@ -5,7 +5,7 @@
5 5
 [ext_resource path="res://mini-game/ressources/sprites/player/dino/dino_run6.png" type="Texture" id=3]
6 6
 [ext_resource path="res://mini-game/ressources/sprites/player/dino/dino_run3.png" type="Texture" id=4]
7 7
 [ext_resource path="res://mini-game/ressources/sprites/player/dino/dino_jump2.png" type="Texture" id=5]
8
-[ext_resource path="res://mini-game/scripts/player2.gd" type="Script" id=6]
8
+[ext_resource path="res://mini-game/scenes/players/player.gd" type="Script" id=6]
9 9
 [ext_resource path="res://mini-game/ressources/sprites/player/dino/dino_run0.png" type="Texture" id=7]
10 10
 [ext_resource path="res://mini-game/ressources/sprites/player/dino/dino_run4.png" type="Texture" id=8]
11 11
 [ext_resource path="res://mini-game/ressources/sprites/player/dino/dino_run2.png" type="Texture" id=9]
@@ -51,11 +51,9 @@ extents = Vector2( 4.46927, 10.285 )
51 51
 [sub_resource type="RectangleShape2D" id=3]
52 52
 extents = Vector2( 7.82863, 6.33675 )
53 53
 
54
-[node name="player2" type="KinematicBody2D"]
54
+[node name="player" type="KinematicBody2D"]
55 55
 scale = Vector2( 10, 10 )
56 56
 script = ExtResource( 6 )
57
-jump_vitesse = 1000.0
58
-gravite = 40.0
59 57
 
60 58
 [node name="AnimatedSprite" type="AnimatedSprite" parent="."]
61 59
 position = Vector2( -1.76303, -0.98938 )
@@ -64,7 +62,7 @@ frames = SubResource( 1 )
64 62
 animation = "man_jump"
65 63
 
66 64
 [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
67
-position = Vector2( -0.0396851, -0.480505 )
65
+position = Vector2( -0.0396847, -0.480505 )
68 66
 shape = SubResource( 2 )
69 67
 
70 68
 [node name="Area2D" type="Area2D" parent="."]

+ 0
- 6
mini-game/scenes/players/player1.tscn View File

@@ -1,6 +0,0 @@
1
-[gd_scene load_steps=2 format=2]
2
-
3
-[ext_resource path="res://mini-game/scripts/player1.gd" type="Script" id=1]
4
-
5
-[node name="player1" type="Node2D"]
6
-script = ExtResource( 1 )

+ 42
- 0
mini-game/scenes/spawner/pickup.gd View File

@@ -0,0 +1,42 @@
1
+extends Node2D
2
+
3
+export var sprite_texture : Texture
4
+export var type := "bonus" setget , get_type
5
+export var scroll_speed = 9
6
+
7
+onready var sprite = $Sprite
8
+onready var notifier = $notifier
9
+
10
+
11
+func _ready():
12
+	sprite.texture = sprite_texture
13
+	notifier.connect("screen_exited", self, "_on_screen_exited")
14
+
15
+
16
+func _on_screen_exited():
17
+	queue_free()
18
+
19
+
20
+func _physics_process(delta):
21
+	move()
22
+
23
+
24
+func get_type():
25
+	return type
26
+
27
+
28
+func move():
29
+	self.position.x -= scroll_speed
30
+
31
+
32
+func pickup():
33
+	queue_free()
34
+
35
+
36
+func _on_Area2D_body_entered(body: Node) -> void:
37
+	if body.has_method("bonus") and body.has_method("hit"):
38
+		pickup()
39
+		if type == "bonus":
40
+			body.bonus()
41
+		elif type == "malus":
42
+			body.hit()

+ 24
- 0
mini-game/scenes/spawner/pickup.tscn View File

@@ -0,0 +1,24 @@
1
+[gd_scene load_steps=4 format=2]
2
+
3
+[ext_resource path="res://mini-game/ressources/sprites/obstacle/barrel.png" type="Texture" id=1]
4
+[ext_resource path="res://mini-game/scenes/spawner/pickup.gd" type="Script" id=2]
5
+
6
+[sub_resource type="RectangleShape2D" id=1]
7
+extents = Vector2( 28.3542, 36.1379 )
8
+
9
+[node name="pickup" type="Node2D"]
10
+script = ExtResource( 2 )
11
+sprite_texture = ExtResource( 1 )
12
+type = "malus"
13
+
14
+[node name="Sprite" type="Sprite" parent="."]
15
+scale = Vector2( 0.202437, 0.202437 )
16
+
17
+[node name="Area2D" type="Area2D" parent="."]
18
+
19
+[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
20
+shape = SubResource( 1 )
21
+
22
+[node name="notifier" type="VisibilityNotifier2D" parent="."]
23
+
24
+[connection signal="body_entered" from="Area2D" to="." method="_on_Area2D_body_entered"]

+ 51
- 0
mini-game/scenes/spawner/spawner.gd View File

@@ -0,0 +1,51 @@
1
+extends Node2D
2
+
3
+export (Array,PackedScene) var scenes
4
+
5
+var random_scene = RandomNumberGenerator.new()
6
+var scene_index = 0;
7
+var last_object
8
+var end_of_game = false
9
+var timer_speed = 0.99
10
+var random_threshold = 50
11
+var scenes_offset = 0
12
+
13
+onready var timer := $Timer
14
+onready var items := $items
15
+
16
+
17
+func _on_Timer_timeout():
18
+	random_scene.randomize()
19
+	scene_index = random_scene.randi_range(1,100)
20
+	if(scene_index >= random_threshold):
21
+		scene_index = 1
22
+	else:
23
+		scene_index = 0
24
+	var tmp = scenes[scene_index+scenes_offset*2].instance()
25
+	items.add_child(tmp)
26
+	last_object = tmp
27
+	if(timer.wait_time <= 1):
28
+		timer.wait_time = 1
29
+	else:
30
+		timer.wait_time *= timer_speed
31
+
32
+
33
+func start(difficulty, version):
34
+	match difficulty:
35
+		"easy":
36
+			timer_speed = 0.99
37
+			random_threshold = 50
38
+		"hard":
39
+			timer_speed = 0.95
40
+			random_threshold = 33
41
+		_:
42
+			pass
43
+	scenes_offset = version
44
+	timer.start()
45
+
46
+
47
+func stop():
48
+	timer.stop()
49
+	for obj in $items.get_children():
50
+		remove_child(obj)
51
+		obj.queue_free()

+ 1
- 2
mini-game/scenes/spawner/spawner.tscn View File

@@ -1,6 +1,6 @@
1 1
 [gd_scene load_steps=12 format=2]
2 2
 
3
-[ext_resource path="res://mini-game/scripts/spawner.gd" type="Script" id=1]
3
+[ext_resource path="res://mini-game/scenes/spawner/spawner.gd" type="Script" id=1]
4 4
 [ext_resource path="res://mini-game/scenes/obstacles/obstacle1.tscn" type="PackedScene" id=2]
5 5
 [ext_resource path="res://mini-game/scenes/bonuses/bonus1.tscn" type="PackedScene" id=3]
6 6
 [ext_resource path="res://mini-game/scenes/bonuses/bonus2.tscn" type="PackedScene" id=4]
@@ -18,7 +18,6 @@ scenes = [ ExtResource( 3 ), ExtResource( 2 ), ExtResource( 4 ), ExtResource( 5
18 18
 
19 19
 [node name="Timer" type="Timer" parent="."]
20 20
 wait_time = 2.094
21
-autostart = true
22 21
 
23 22
 [node name="items" type="Node2D" parent="."]
24 23
 

+ 0
- 19
mini-game/scripts/ScrollingBG.gd View File

@@ -1,19 +0,0 @@
1
-extends TextureRect
2
-
3
-
4
-# Declare member variables here. Examples:
5
-# var a = 2
6
-# var b = "text"
7
-
8
-
9
-# Called when the node enters the scene tree for the first time.
10
-
11
-func _ready():
12
-	Signals.connect("die",self,"game_over")
13
-
14
-
15
-# Called every frame. 'delta' is the elapsed time since the previous frame.
16
-#func _process(delta):
17
-#	pass
18
-func game_over():
19
-	material.set_shader_param("scroll_speed",0)

+ 0
- 9
mini-game/scripts/Signals.gd View File

@@ -1,9 +0,0 @@
1
-extends Node2D
2
-
3
-signal die
4
-signal gain
5
-signal update_score
6
-signal update_timer
7
-signal win
8
-
9
-

+ 0
- 20
mini-game/scripts/bonus1.gd View File

@@ -1,20 +0,0 @@
1
-extends "scroll_movement.gd"
2
-
3
-
4
-onready var notifier = $notifier
5
-
6
-func _ready():
7
-	notifier.connect("screen_exited", self, "_on_screen_exited")
8
-
9
-func _on_screen_exited():
10
-	queue_free()
11
-
12
-
13
-func _physics_process(delta):
14
-	move()
15
-
16
-
17
-func _on_pick_bonus_body_entered(body):
18
-	if body.name == "player2" : 
19
-		Signals.emit_signal("gain",1)
20
-		queue_free()

+ 0
- 22
mini-game/scripts/obstacle1.gd View File

@@ -1,22 +0,0 @@
1
-extends "scroll_movement.gd"
2
-
3
-
4
-
5
-onready var notifier = $notifier
6
-
7
-func _ready():
8
-	get_node("notifier").connect("screen_exited", self, "_on_screen_exited")
9
-
10
-func _on_screen_exited():
11
-	print("Obstacle exited the screen")
12
-	queue_free()
13
-
14
-func _physics_process(delta):
15
-	move()
16
-
17
-
18
-func _on_collision_obstacle_body_entered(body):
19
-	if body.name == "player2" : 
20
-		Signals.emit_signal("die")
21
-		queue_free()
22
-

+ 0
- 16
mini-game/scripts/player1.gd View File

@@ -1,16 +0,0 @@
1
-extends Node2D
2
-
3
-
4
-# Declare member variables here. Examples:
5
-# var a = 2
6
-# var b = "text"
7
-onready var animation = $AnimatedSprite
8
-
9
-# Called when the node enters the scene tree for the first time.
10
-func _ready():
11
-	animation.play("run")
12
-
13
-
14
-# Called every frame. 'delta' is the elapsed time since the previous frame.
15
-#func _process(delta):
16
-#	pass

+ 0
- 111
mini-game/scripts/player2.gd View File

@@ -1,111 +0,0 @@
1
-extends KinematicBody2D
2
-
3
-var vitesse = Vector2.ZERO
4
-
5
-var score = 0
6
-var score_goal = 10
7
-
8
-export var jump_vitesse = 1100.0
9
-export var gravite = 45.0
10
-
11
-enum {
12
-	RUN,
13
-	JUMP,
14
-	IDLE
15
-}
16
-
17
-enum {
18
-	SCORE,
19
-	TIME
20
-}
21
-
22
-var jump_key = "dialogic_next"
23
-
24
-var player_enabled = false
25
-var game_mode = "score"
26
-
27
-var state = RUN
28
-var au_sol = true
29
-
30
-# Declare member variables here. Examples:
31
-# var a = 2
32
-# var b = "text"
33
-onready var animation = $AnimatedSprite
34
-
35
-# Called when the node enters the scene tree for the first time.
36
-func _ready():
37
-	stop()
38
-	Signals.connect("gain",self,"increase_score")
39
-	Signals.connect("die",self,"player_die")
40
-
41
-func _physics_process(delta):
42
-	if player_enabled:
43
-		match state:
44
-			RUN:
45
-				animation.play("man_run")
46
-			JUMP:
47
-				vitesse = Vector2.ZERO
48
-				vitesse.y -= jump_vitesse
49
-				animation.play("man_jump")
50
-				state = IDLE
51
-			IDLE:
52
-				pass
53
-		vitesse.y += gravite
54
-		move_and_collide(vitesse*delta)
55
-
56
-
57
-func _input(event):
58
-	if player_enabled and state == RUN and event.is_action_pressed(jump_key):
59
-			state = JUMP
60
-
61
-
62
-func _on_Area2D_body_entered(body):
63
-	if body is StaticBody2D:
64
-		state = RUN
65
-		
66
-
67
-
68
-func _on_Area2D_body_exited(body):
69
-	if body is StaticBody2D:
70
-		state = JUMP
71
-
72
-
73
-func increase_score(scoretoadd):
74
-	match game_mode:
75
-		"score":
76
-			score+=scoretoadd
77
-			Signals.emit_signal("update_score", score)
78
-			if score >= score_goal:
79
-				Signals.emit_signal("win")
80
-		"time":
81
-			pass
82
-		_:
83
-			print("game_mode not recognized by player2 start func")
84
-
85
-
86
-func player_win():
87
-	stop()
88
-
89
-
90
-func player_die():
91
-	stop()
92
-
93
-
94
-func start(mode: String, goal: int):
95
-	show()
96
-	match mode:
97
-		"score":
98
-			if (goal != 0):
99
-				score_goal = goal
100
-			game_mode = "score"
101
-		"time":
102
-			game_mode = "time"
103
-		_:
104
-			print("game_mode not recognized by player2 start func")
105
-	score = 0
106
-	player_enabled = true
107
-
108
-
109
-func stop():
110
-	hide()
111
-	player_enabled = false

+ 0
- 14
mini-game/scripts/scroll_movement.gd View File

@@ -1,14 +0,0 @@
1
-extends Node2D
2
-
3
-#export var scroll_speed = 6.3
4
-export var scroll_speed = 9
5
-
6
-func _ready():
7
-	Signals.connect("die",self,"game_over")
8
-
9
-func move():
10
-	self.position.x -= scroll_speed
11
-
12
-func game_over():
13
-	print("game_over")
14
-	scroll_speed = 0

+ 0
- 64
mini-game/scripts/spawner.gd View File

@@ -1,64 +0,0 @@
1
-extends Node2D
2
-
3
-export (Array,PackedScene) var scenes
4
-
5
-var random_scene = RandomNumberGenerator.new()
6
-var scene_index = 0;
7
-var last_object
8
-var end_of_game = false
9
-var spawner_enabled = false
10
-var timer_speed = 0.99
11
-var random_threshold = 50
12
-var scenes_offset = 0
13
-
14
-onready var timer := $Timer
15
-onready var items := $items
16
-
17
-func _ready():
18
-	Signals.connect("die",self,"game_over")
19
-	Signals.connect("win",self,"game_over")
20
-
21
-
22
-func _on_Timer_timeout():
23
-	if spawner_enabled:
24
-		random_scene.randomize()
25
-		scene_index = random_scene.randi_range(1,100)
26
-		if(scene_index >= random_threshold):
27
-			scene_index = 1
28
-		else:
29
-			scene_index = 0
30
-		var tmp = scenes[scene_index+scenes_offset*2].instance()
31
-		items.add_child(tmp)
32
-		last_object = tmp
33
-		if(timer.wait_time <= 1):
34
-			timer.wait_time = 1
35
-		else:
36
-			timer.wait_time *= timer_speed
37
-		timer.start()
38
-
39
-
40
-func game_over():
41
-	timer.set_paused(true)
42
-	#last_object.queue_free()
43
-
44
-
45
-func start(difficulty, version):
46
-	match difficulty:
47
-		"easy":
48
-			timer_speed = 0.99
49
-			random_threshold = 50
50
-		"hard":
51
-			timer_speed = 0.95
52
-			random_threshold = 33
53
-		_:
54
-			pass
55
-	scenes_offset = version
56
-	spawner_enabled = true
57
-	timer.set_paused(false)
58
-
59
-
60
-func stop():
61
-	spawner_enabled = false
62
-	for obj in $items.get_children():
63
-		remove_child(obj)
64
-		obj.queue_free()

Loading…
Cancel
Save