First PoC version has been done

This commit is contained in:
Sameer Rahmani 2019-11-10 12:32:37 +00:00
parent afb7985ef4
commit 297ca5fec8
3 changed files with 25 additions and 4 deletions

11
Main.gd
View File

@ -8,13 +8,16 @@ func _ready():
func game_over():
$ScoreTimer.stop()
$MobTimer.stop()
$HUD.show_game_over()
$Music.stop()
$DeathSound.play()
$ScoreTimer.stop()
$MobTimer.stop()
$HUD.show_game_over()
func new_game():
score = 0
$Music.play()
$HUD.update_score(score)
$HUD.show_message("Get Ready")
$Player.start($StartPosition.position)
@ -27,6 +30,8 @@ func _on_MobTimer_timeout():
# Create a Mob instance and add it to the scene.
var mob = Mob.instance()
add_child(mob)
$HUD.connect("start_game", mob, "_on_start_game")
# Set the mob's direction perpendicular to the path direction.
var direction = $MobPath/MobSpawnLocation.rotation + PI / 2
# Set the mob's position to a random location.

View File

@ -1,9 +1,11 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=8 format=2]
[ext_resource path="res://Main.gd" type="Script" id=1]
[ext_resource path="res://Mob.tscn" type="PackedScene" id=2]
[ext_resource path="res://Player.tscn" type="PackedScene" id=3]
[ext_resource path="res://HUD.tscn" type="PackedScene" id=4]
[ext_resource path="res://art/House In a Forest Loop.ogg" type="AudioStream" id=5]
[ext_resource path="res://art/gameover.wav" type="AudioStream" id=6]
[sub_resource type="Curve2D" id=1]
_data = {
@ -14,6 +16,11 @@ _data = {
script = ExtResource( 1 )
Mob = ExtResource( 2 )
[node name="ColorRect" type="ColorRect" parent="."]
margin_right = 480.0
margin_bottom = 720.0
color = Color( 0.121569, 0.25098, 0.45098, 1 )
[node name="Player" parent="." instance=ExtResource( 3 )]
speed = 400
@ -37,6 +44,12 @@ position = Vector2( 480, 0 )
rotation = 1.5708
[node name="HUD" parent="." instance=ExtResource( 4 )]
[node name="Music" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 5 )
[node name="DeathSound" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 6 )
[connection signal="hit" from="Player" to="." method="game_over"]
[connection signal="timeout" from="MobTimer" to="." method="_on_MobTimer_timeout"]
[connection signal="timeout" from="StartTimer" to="." method="_on_StartTimer_timeout"]

3
Mob.gd
View File

@ -13,3 +13,6 @@ func _ready():
func _on_Visibility_screen_exited():
queue_free()
func _on_start_game():
queue_free()