-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d74531a
Showing
44 changed files
with
1,367 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[gd_resource type="ButtonGroup" format=2] | ||
|
||
[resource] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
extends CanvasLayer | ||
|
||
signal start_game | ||
|
||
func show_message(text): | ||
$MessageLabel.text = text | ||
$MessageLabel.show() | ||
$MessageTimer.start() | ||
|
||
func _ready(): | ||
$StartButton.connect("pressed", self, "_on_StartButton_pressed") | ||
$SettingsButton.connect("pressed", self, "_on_SettingsButton_pressed") | ||
$BackButton.connect("pressed", self, "_on_BackButton_pressed") | ||
$MessageTimer.connect("timeout", self, "_on_MessageTimer_timeout") | ||
|
||
func show_game_over(): | ||
show_message("Game Over") | ||
yield($MessageTimer, "timeout") | ||
$ScoreLabel.hide() | ||
$MessageLabel.text = "Dodge the\nCreeps!" | ||
$MessageLabel.show() | ||
yield(get_tree().create_timer(1), "timeout") | ||
$StartButton.show() | ||
$SettingsButton.show() | ||
|
||
func update_score(score): | ||
$ScoreLabel.text = str(score) | ||
|
||
func _on_StartButton_pressed(): | ||
$StartButton.hide() | ||
$SettingsButton.hide() | ||
$ScoreLabel.show() | ||
emit_signal("start_game") | ||
|
||
func _on_SettingsButton_pressed(): | ||
$SettingsButton.hide() | ||
$MessageLabel.hide() | ||
$StartButton.hide() | ||
$EasyButton.show() | ||
$MedButton.show() | ||
$HardButton.show() | ||
$BackButton.show() | ||
|
||
func _on_BackButton_pressed(): | ||
$EasyButton.hide() | ||
$MedButton.hide() | ||
$HardButton.hide() | ||
$BackButton.hide() | ||
$SettingsButton.show() | ||
$MessageLabel.show() | ||
$StartButton.show() | ||
|
||
func _on_MessageTimer_timeout(): | ||
$MessageLabel.hide() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
[gd_scene load_steps=9 format=2] | ||
|
||
[ext_resource path="res://HUD.gd" type="Script" id=1] | ||
[ext_resource path="res://MainFont.tres" type="DynamicFont" id=2] | ||
[ext_resource path="res://fonts/Xolonium-Regular.ttf" type="DynamicFontData" id=3] | ||
[ext_resource path="res://DifficultyButtonGroup.tres" type="ButtonGroup" id=4] | ||
[ext_resource path="res://SettingsFont.tres" type="DynamicFont" id=5] | ||
|
||
[sub_resource type="DynamicFont" id=3] | ||
size = 32 | ||
font_data = ExtResource( 3 ) | ||
|
||
[sub_resource type="InputEventAction" id=1] | ||
action = "ui_select" | ||
|
||
[sub_resource type="ShortCut" id=2] | ||
shortcut = SubResource( 1 ) | ||
|
||
[node name="HUD" type="CanvasLayer"] | ||
script = ExtResource( 1 ) | ||
|
||
[node name="MessageLabel" type="Label" parent="."] | ||
anchor_top = 0.5 | ||
anchor_right = 1.0 | ||
anchor_bottom = 0.5 | ||
margin_top = -79.5 | ||
margin_bottom = 79.5 | ||
custom_fonts/font = ExtResource( 2 ) | ||
text = "Dodge The Creeps!" | ||
align = 1 | ||
valign = 1 | ||
autowrap = true | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="ScoreLabel" type="Label" parent="."] | ||
visible = false | ||
anchor_right = 1.0 | ||
margin_bottom = 78.0 | ||
custom_fonts/font = ExtResource( 2 ) | ||
text = "0" | ||
align = 1 | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="SettingsButton" type="Button" parent="."] | ||
anchor_right = 1.0 | ||
margin_bottom = 45.0 | ||
custom_fonts/font = SubResource( 3 ) | ||
text = "Settings" | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="StartButton" type="Button" parent="."] | ||
anchor_left = 0.5 | ||
anchor_top = 0.9 | ||
anchor_right = 0.5 | ||
anchor_bottom = 0.9 | ||
margin_left = -90.0 | ||
margin_top = -100.0 | ||
margin_right = 90.0 | ||
custom_fonts/font = ExtResource( 2 ) | ||
shortcut = SubResource( 2 ) | ||
text = "Start" | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="MessageTimer" type="Timer" parent="."] | ||
wait_time = 1.5 | ||
one_shot = true | ||
|
||
[node name="EasyButton" type="Button" parent="."] | ||
visible = false | ||
anchor_top = 0.25 | ||
anchor_right = 0.333 | ||
anchor_bottom = 0.25 | ||
margin_bottom = 45.0 | ||
custom_fonts/font = ExtResource( 5 ) | ||
toggle_mode = true | ||
group = ExtResource( 4 ) | ||
text = "Easy" | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="MedButton" type="Button" parent="."] | ||
visible = false | ||
anchor_left = 0.333 | ||
anchor_top = 0.25 | ||
anchor_right = 0.667 | ||
anchor_bottom = 0.25 | ||
margin_left = 0.160004 | ||
margin_right = -0.160004 | ||
margin_bottom = 64.0 | ||
custom_fonts/font = ExtResource( 5 ) | ||
toggle_mode = true | ||
pressed = true | ||
group = ExtResource( 4 ) | ||
text = "Med" | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="HardButton" type="Button" parent="."] | ||
visible = false | ||
anchor_left = 0.667 | ||
anchor_top = 0.25 | ||
anchor_right = 1.0 | ||
anchor_bottom = 0.25 | ||
margin_bottom = 45.0 | ||
custom_fonts/font = ExtResource( 5 ) | ||
toggle_mode = true | ||
group = ExtResource( 4 ) | ||
text = "Hard" | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="BackButton" type="Button" parent="."] | ||
visible = false | ||
anchor_top = 0.5 | ||
anchor_right = 1.0 | ||
anchor_bottom = 0.5 | ||
margin_bottom = 84.0 | ||
custom_fonts/font = ExtResource( 2 ) | ||
text = "Back" | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
extends Node | ||
|
||
export (PackedScene) var Mob | ||
var score | ||
var difficulty | ||
|
||
func _ready(): | ||
randomize() | ||
$Player.connect("hit", self, "game_over") | ||
$StartTimer.connect("timeout", self, "_on_StartTimer_timeout") | ||
$ScoreTimer.connect("timeout", self, "_on_ScoreTimer_timeout") | ||
$MobTimer.connect("timeout", self, "_on_MobTimer_timeout") | ||
$HUD.connect("start_game", self, "new_game") | ||
|
||
func game_over(): | ||
$ScoreTimer.stop() | ||
$MobTimer.stop() | ||
$HUD.show_game_over() | ||
$Music.stop() | ||
$DeathSound.play() | ||
|
||
func new_game(): | ||
score = 0 | ||
if $HUD/EasyButton.pressed: | ||
$MobTimer.wait_time = .75 | ||
if $HUD/MedButton.pressed: | ||
$MobTimer.wait_time = .5 | ||
if $HUD/HardButton.pressed: | ||
$MobTimer.wait_time = .4 | ||
$Player.start($StartPosition.position) | ||
$StartTimer.start() | ||
$HUD.update_score(score) | ||
$HUD.show_message("Get Ready") | ||
$Music.play() | ||
|
||
func _on_StartTimer_timeout(): | ||
$MobTimer.start() | ||
$ScoreTimer.start() | ||
|
||
func _on_ScoreTimer_timeout(): | ||
score += 1 | ||
$HUD.update_score(score) | ||
|
||
func _on_MobTimer_timeout(): | ||
$MobPath/MobSpawnLocation.offset = randi() | ||
var mob = Mob.instance() | ||
$HUD.connect("start_game", mob, "_on_start_game") | ||
add_child(mob) | ||
var direction = $MobPath/MobSpawnLocation.rotation + PI / 2 | ||
mob.position = $MobPath/MobSpawnLocation.position | ||
direction += rand_range(-PI / 4, PI / 4) | ||
mob.rotation = direction | ||
mob.linear_velocity = Vector2(rand_range(mob.min_speed, mob.max_speed), 0) | ||
mob.linear_velocity = mob.linear_velocity.rotated(direction) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
[gd_scene load_steps=8 format=2] | ||
|
||
[ext_resource path="res://Player.tscn" type="PackedScene" id=1] | ||
[ext_resource path="res://Mob.tscn" type="PackedScene" id=2] | ||
[ext_resource path="res://Main.gd" type="Script" id=3] | ||
[ext_resource path="res://HUD.tscn" type="PackedScene" id=4] | ||
[ext_resource path="res://art/gameover.wav" type="AudioStream" id=5] | ||
[ext_resource path="res://art/House In a Forest Loop.ogg" type="AudioStream" id=6] | ||
|
||
[sub_resource type="Curve2D" id=1] | ||
_data = { | ||
"points": PoolVector2Array( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 480, 0, 0, 0, 0, 0, 480, 720, 0, 0, 0, 0, 0, 720, 0, 0, 0, 0, 0, 0 ) | ||
} | ||
|
||
[node name="Main" type="Node"] | ||
script = ExtResource( 3 ) | ||
Mob = ExtResource( 2 ) | ||
|
||
[node name="ColorRect" type="ColorRect" parent="."] | ||
margin_right = 480.0 | ||
margin_bottom = 720.0 | ||
color = Color( 0.847059, 0.0901961, 0.0901961, 1 ) | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="Player" parent="." instance=ExtResource( 1 )] | ||
|
||
[node name="MobTimer" type="Timer" parent="."] | ||
wait_time = 0.5 | ||
|
||
[node name="ScoreTimer" type="Timer" parent="."] | ||
|
||
[node name="StartTimer" type="Timer" parent="."] | ||
wait_time = 1.5 | ||
one_shot = true | ||
|
||
[node name="StartPosition" type="Position2D" parent="."] | ||
position = Vector2( 240, 450 ) | ||
|
||
[node name="MobPath" type="Path2D" parent="."] | ||
curve = SubResource( 1 ) | ||
|
||
[node name="MobSpawnLocation" type="PathFollow2D" parent="MobPath"] | ||
|
||
[node name="HUD" parent="." instance=ExtResource( 4 )] | ||
|
||
[node name="Music" type="AudioStreamPlayer" parent="."] | ||
stream = ExtResource( 6 ) | ||
|
||
[node name="DeathSound" type="AudioStreamPlayer" parent="."] | ||
stream = ExtResource( 5 ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[gd_resource type="DynamicFont" load_steps=2 format=2] | ||
|
||
[ext_resource path="res://fonts/Xolonium-Regular.ttf" type="DynamicFontData" id=1] | ||
|
||
[resource] | ||
size = 64 | ||
font_data = ExtResource( 1 ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
extends RigidBody2D | ||
|
||
export var min_speed = 150 # Minimum speed range. | ||
export var max_speed = 250 # Maximum speed range. | ||
var mob_types = ["walk", "swim", "fly"] | ||
|
||
# Declare member variables here. Examples: | ||
# var a = 2 | ||
# var b = "text" | ||
|
||
func _on_start_game(): | ||
queue_free() | ||
|
||
# Called when the node enters the scene tree for the first time. | ||
func _ready(): | ||
$AnimatedSprite.animation = mob_types[randi() % mob_types.size()] | ||
$Visibility.connect("screen_exited", self, "_on_Visibility_screen_exited") | ||
|
||
func _on_Visibility_screen_exited(): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
[gd_scene load_steps=10 format=2] | ||
|
||
[ext_resource path="res://art/enemyFlyingAlt_1.png" type="Texture" id=1] | ||
[ext_resource path="res://Mob.gd" type="Script" id=2] | ||
[ext_resource path="res://art/enemySwimming_2.png" type="Texture" id=3] | ||
[ext_resource path="res://art/enemyFlyingAlt_2.png" type="Texture" id=4] | ||
[ext_resource path="res://art/enemyWalking_2.png" type="Texture" id=5] | ||
[ext_resource path="res://art/enemyWalking_1.png" type="Texture" id=6] | ||
[ext_resource path="res://art/enemySwimming_1.png" type="Texture" id=7] | ||
|
||
[sub_resource type="SpriteFrames" id=1] | ||
animations = [ { | ||
"frames": [ ExtResource( 6 ), ExtResource( 5 ) ], | ||
"loop": true, | ||
"name": "walk", | ||
"speed": 4.0 | ||
}, { | ||
"frames": [ ExtResource( 7 ), ExtResource( 3 ) ], | ||
"loop": true, | ||
"name": "swim", | ||
"speed": 4.0 | ||
}, { | ||
"frames": [ ExtResource( 1 ), ExtResource( 4 ) ], | ||
"loop": true, | ||
"name": "fly", | ||
"speed": 3.0 | ||
} ] | ||
|
||
[sub_resource type="CapsuleShape2D" id=2] | ||
radius = 35.9303 | ||
height = 23.4116 | ||
|
||
[node name="Mob" type="RigidBody2D"] | ||
collision_mask = 0 | ||
gravity_scale = 0.0 | ||
script = ExtResource( 2 ) | ||
__meta__ = { | ||
"_edit_group_": true | ||
} | ||
|
||
[node name="AnimatedSprite" type="AnimatedSprite" parent="."] | ||
scale = Vector2( 0.75, 0.75 ) | ||
frames = SubResource( 1 ) | ||
animation = "walk" | ||
playing = true | ||
|
||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] | ||
rotation = 1.5708 | ||
shape = SubResource( 2 ) | ||
|
||
[node name="Visibility" type="VisibilityNotifier2D" parent="."] |
Oops, something went wrong.