Skip to content

Commit

Permalink
V1
Browse files Browse the repository at this point in the history
  • Loading branch information
Aidan Venter committed May 28, 2020
2 parents 2433df2 + e70244d commit 546303f
Show file tree
Hide file tree
Showing 14 changed files with 334 additions and 27 deletions.
1 change: 1 addition & 0 deletions src/Actor/Enemies/Armstrong/Armstrong.gd
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func handle_death():
if SM.state != SM.States.DEAD:
SM.state = SM.States.DEAD
Globals.GAME.num_enemies -= 1
Globals.GAME.BATTERY_UI.change_charge()
player_direction = Globals.PLAYER.SPRITE.scale.x

velocity.x = DEATH_VECTOR.x * player_direction
Expand Down
2 changes: 0 additions & 2 deletions src/Actor/Enemies/Armstrong/Armstrong.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,13 @@ hframes = 4
shape = SubResource( 1 )

[node name="DetectorLeft" type="RayCast2D" parent="."]
visible = false
position = Vector2( -7, 0 )
enabled = true
cast_to = Vector2( 0, 12 )
collision_mask = 48
collide_with_areas = true

[node name="DetectorRight" type="RayCast2D" parent="."]
visible = false
position = Vector2( 7, 0 )
enabled = true
cast_to = Vector2( 0, 12 )
Expand Down
59 changes: 53 additions & 6 deletions src/Interface/BatteryUI.gd
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
extends Control

var battery_3_cell = load("res://assets/art/ui/battery 3 cell/battery 3 cell1.png")
var battery_1_cell = load("res://assets/art/ui/battery 1 cell/battery 1 cell1.png")
var battery_3_cell1 = load("res://assets/art/ui/battery 3 cell/battery 3 cell1.png")
var battery_3_cell2 = load("res://assets/art/ui/battery 3 cell/battery 3 cell2.png")
var battery_3_cell3 = load("res://assets/art/ui/battery 3 cell/battery 3 cell3.png")
var battery_3_cell4 = load("res://assets/art/ui/battery 3 cell/battery 3 cell4.png")
var battery_1_cell1 = load("res://assets/art/ui/battery 1 cell/battery 1 cell1.png")
var battery_1_cell2 = load("res://assets/art/ui/battery 1 cell/battery 1 cell2.png")

var charge = 0
var max_charge = 0
var charge
var max_charge
var num_1_cells = 0
var num_3_cells = 0

Expand All @@ -13,16 +17,59 @@ func reset():
for i in get_children():
i.set_texture(null)

charge = 0
max_charge = Globals.GAME.num_enemies

num_3_cells = max_charge / 3
num_1_cells = max_charge - num_3_cells * 3

var current_battery = 1
for _i in range(num_3_cells):
get_node("Battery" + str(current_battery)).set_texture(battery_3_cell)
get_node("Battery" + str(current_battery)).set_texture(battery_3_cell1)
current_battery += 1

for _i in range(num_1_cells):
get_node("Battery" + str(current_battery)).set_texture(battery_1_cell)
get_node("Battery" + str(current_battery)).set_texture(battery_1_cell1)
current_battery += 1


func change_charge():
var current_battery = 1
var node
var node_texture

# Go through all the 3 cell batteries
for i in num_3_cells:
# Get node of current battery
node = get_node("Battery" + str(current_battery))
node_texture = node.get_texture()
# Not 3/3
if node_texture != battery_3_cell4:
# 0/3
if node_texture == battery_3_cell1:
# Set to 1/3
node.set_texture(battery_3_cell2)
# 1/3
elif node_texture == battery_3_cell2:
# Set to 2/3
node.set_texture(battery_3_cell3)
# 2/3
elif node_texture == battery_3_cell3:
# Set to 3/3
node.set_texture(battery_3_cell4)
return
# Move to next battery
current_battery += 1

# Go through all the 1 cell batteries
for i in num_1_cells:
# Get node of current battery
node = get_node("Battery" + str(current_battery))
node_texture = node.get_texture()
# Not 1/1
if node_texture != battery_1_cell2:
# Set to 1/1
node.set_texture(battery_1_cell2)
return
# Move to next battery
current_battery += 1
5 changes: 5 additions & 0 deletions src/Interface/UI.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
extends Control


func restart():
Globals.GAME.reset()
20 changes: 19 additions & 1 deletion src/Interface/UI.tscn
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
[gd_scene load_steps=2 format=2]
[gd_scene load_steps=5 format=2]

[ext_resource path="res://src/Fonts/m3x6.tres" type="DynamicFont" id=1]
[ext_resource path="res://src/Interface/UI.gd" type="Script" id=2]
[ext_resource path="res://assets/font/m3x6.ttf" type="DynamicFontData" id=3]

[sub_resource type="DynamicFont" id=1]
size = 32
use_mipmaps = true
font_data = ExtResource( 3 )

[node name="UI" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
Expand All @@ -31,3 +39,13 @@ custom_fonts/font = ExtResource( 1 )
text = "GAME OVER"
align = 1
valign = 1

[node name="Button" type="Button" parent="."]
visible = false
margin_left = 152.0
margin_top = 128.0
margin_right = 232.0
margin_bottom = 160.0
custom_fonts/font = SubResource( 1 )
text = "Restart?"
[connection signal="pressed" from="Button" to="." method="restart"]
84 changes: 81 additions & 3 deletions src/Level/Level1.tscn
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=7 format=2]

[ext_resource path="res://src/Tiles/Tiles.tres" type="TileSet" id=1]
[ext_resource path="res://src/Actor/Player/Player.tscn" type="PackedScene" id=2]
[ext_resource path="res://src/Tiles/Launcher.tscn" type="PackedScene" id=3]
[ext_resource path="res://src/Actor/Enemies/Armstrong/Armstrong.tscn" type="PackedScene" id=4]
[ext_resource path="res://assets/font/m3x6.ttf" type="DynamicFontData" id=5]

[sub_resource type="DynamicFont" id=2]
size = 32
use_mipmaps = true
font_data = ExtResource( 5 )

[node name="Level1" type="Node2D"]

Expand All @@ -21,6 +27,78 @@ position = Vector2( 88, 200 )
[node name="Player" parent="." instance=ExtResource( 2 )]
position = Vector2( 8, 120 )

[node name="Armstrong" parent="." instance=ExtResource( 4 )]
position = Vector2( 232, 184 )
[node name="Enemies" type="Node" parent="."]

[node name="Armstrong" parent="Enemies" instance=ExtResource( 4 )]
position = Vector2( 128, 184 )
DESIRED_STATE = 2

[node name="CanvasLayer" type="CanvasLayer" parent="."]

[node name="Tutorial" type="Control" parent="CanvasLayer"]
margin_right = 384.0
margin_bottom = 112.0
__meta__ = {
"_edit_use_anchors_": false
}

[node name="A" type="Label" parent="CanvasLayer/Tutorial"]
margin_left = 64.0
margin_top = 16.0
margin_right = 80.0
margin_bottom = 42.0
custom_fonts/font = SubResource( 2 )
text = "A"
align = 1
valign = 1

[node name="D" type="Label" parent="CanvasLayer/Tutorial"]
margin_left = 80.0
margin_top = 16.0
margin_right = 96.0
margin_bottom = 42.0
custom_fonts/font = SubResource( 2 )
text = "D"
align = 1
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}

[node name="LeftClick" type="Label" parent="CanvasLayer/Tutorial"]
margin_left = 256.0
margin_right = 352.0
margin_bottom = 26.0
custom_fonts/font = SubResource( 2 )
text = "LEFT CLICK"
align = 1
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}

[node name="RightClick" type="Label" parent="CanvasLayer/Tutorial"]
margin_left = 256.0
margin_top = 24.0
margin_right = 352.0
margin_bottom = 50.0
custom_fonts/font = SubResource( 2 )
text = "RIGHT CLICK"
align = 1
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}

[node name="RightClick2" type="Label" parent="CanvasLayer/Tutorial"]
margin_left = 168.0
margin_top = 64.0
margin_right = 216.0
margin_bottom = 90.0
custom_fonts/font = SubResource( 2 )
text = "SPACE"
align = 1
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}
8 changes: 5 additions & 3 deletions src/Level/Level2.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ position = Vector2( 360, 216 )
[node name="Player" parent="." instance=ExtResource( 2 )]
position = Vector2( 8, 200 )

[node name="Armstrong" parent="." instance=ExtResource( 3 )]
position = Vector2( 360, 120 )
[node name="Enemies" type="Node" parent="."]

[node name="Armstrong2" parent="." instance=ExtResource( 3 )]
[node name="Armstrong" parent="Enemies" instance=ExtResource( 3 )]
position = Vector2( 152, 200 )
DESIRED_STATE = 2

[node name="Armstrong2" parent="Enemies" instance=ExtResource( 3 )]
position = Vector2( 352, 120 )
18 changes: 17 additions & 1 deletion src/Level/Level3.tscn
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
[gd_scene load_steps=4 format=2]
[gd_scene load_steps=5 format=2]

[ext_resource path="res://src/Tiles/Tiles.tres" type="TileSet" id=1]
[ext_resource path="res://src/Actor/Player/Player.tscn" type="PackedScene" id=2]
[ext_resource path="res://src/Tiles/Launcher.tscn" type="PackedScene" id=3]
[ext_resource path="res://src/Actor/Enemies/Armstrong/Armstrong.tscn" type="PackedScene" id=4]

[node name="Level3" type="Node2D"]

[node name="TileMap" type="TileMap" parent="."]
tile_set = ExtResource( 1 )
cell_size = Vector2( 16, 16 )
collision_layer = 16
collision_mask = 0
format = 1
tile_data = PoolIntArray( 3, 0, 0, 4, 0, 1, 5, 0, 1, 6, 0, 1, 7, 0, 1, 8, 0, 1, 9, 0, 1, 10, 0, 1, 11, 0, 1, 12, 0, 1, 13, 0, 1, 14, 0, 1, 15, 0, 1, 16, 0, 1, 17, 0, 1, 18, 0, 1, 19, 0, 1, 20, 0, 1, 21, 0, 1, 22, 0, 1, 23, 0, 1, 65539, 0, 3, 131075, 0, 3, 131084, 0, 65536, 131085, 0, 65537, 131086, 0, 65537, 131087, 0, 65537, 131088, 0, 65537, 131089, 0, 65537, 131090, 0, 65537, 131091, 0, 65537, 131092, 0, 65537, 131093, 0, 65537, 131094, 0, 65537, 131095, 0, 65537, 196611, 0, 3, 262147, 0, 3, 327683, 0, 0, 327684, 0, 65537, 327685, 0, 65539, 327688, 0, 3, 393224, 0, 3, 458760, 0, 3, 458761, 0, 65537, 458762, 0, 65537, 458763, 0, 65537, 458764, 0, 65537, 458765, 0, 65537, 458766, 0, 65537, 458767, 0, 65537, 458768, 0, 65537, 458769, 0, 65537, 458770, 0, 65539, 458773, 0, 65536, 458774, 0, 65537, 458775, 0, 65537, 524295, 0, 65536, 524296, 0, 3, 589831, 0, 0, 589832, 0, 2, 655360, 0, 65537, 655361, 0, 65537, 655362, 0, 65537, 655363, 0, 65537, 655364, 0, 65537, 655365, 0, 65537, 655366, 0, 65537, 655367, 0, 1, 655368, 0, 2, 655369, 0, 65537, 655370, 0, 65537, 655371, 0, 65537, 655375, 0, 65536, 655376, 0, 65539, 720896, 0, 1, 720911, 0, 0, 720912, 0, 2, 720917, 0, 65536, 720918, 0, 65537, 720919, 0, 65537, 786432, 0, 1, 786447, 0, 0, 786448, 0, 2, 786453, 0, 0, 786454, 0, 1, 786455, 0, 1, 851968, 0, 1, 851969, 0, 65537, 851971, 0, 65537, 851972, 0, 65537, 851973, 0, 65537, 851974, 0, 65537, 851975, 0, 65537, 851976, 0, 65537, 851977, 0, 65537, 851978, 0, 65537, 851979, 0, 65537, 851980, 0, 65537, 851981, 0, 65537, 851982, 0, 65537, 851983, 0, 1, 851984, 0, 1, 851985, 0, 65537, 851986, 0, 65537, 851987, 0, 65537, 851988, 0, 65537, 851989, 0, 1, 851990, 0, 1, 851991, 0, 1 )

Expand All @@ -17,3 +20,16 @@ position = Vector2( 40, 216 )

[node name="Player" parent="." instance=ExtResource( 2 )]
position = Vector2( 376, 24 )

[node name="Enemies" type="Node" parent="."]

[node name="Armstrong" parent="Enemies" instance=ExtResource( 4 )]
position = Vector2( 80, 72 )

[node name="Armstrong2" parent="Enemies" instance=ExtResource( 4 )]
position = Vector2( 8, 152 )
DESIRED_STATE = 2

[node name="Armstrong3" parent="Enemies" instance=ExtResource( 4 )]
position = Vector2( 360, 104 )
DESIRED_STATE = 2
38 changes: 38 additions & 0 deletions src/Level/Level4.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[gd_scene load_steps=5 format=2]

[ext_resource path="res://src/Tiles/Tiles.tres" type="TileSet" id=1]
[ext_resource path="res://src/Tiles/Launcher.tscn" type="PackedScene" id=2]
[ext_resource path="res://src/Actor/Enemies/Armstrong/Armstrong.tscn" type="PackedScene" id=3]
[ext_resource path="res://src/Actor/Player/Player.tscn" type="PackedScene" id=4]

[node name="Level4" type="Node2D"]

[node name="TileMap" type="TileMap" parent="."]
tile_set = ExtResource( 1 )
cell_size = Vector2( 16, 16 )
collision_layer = 16
collision_mask = 0
format = 1
tile_data = PoolIntArray( 0, 0, 1, 1, 0, 1, 2, 0, 1, 3, 0, 1, 4, 0, 1, 5, 0, 1, 6, 0, 1, 7, 0, 1, 8, 0, 1, 9, 0, 1, 10, 0, 1, 11, 0, 1, 12, 0, 1, 13, 0, 1, 14, 0, 1, 15, 0, 1, 16, 0, 1, 17, 0, 1, 18, 0, 1, 19, 0, 1, 20, 0, 1, 21, 0, 1, 22, 0, 1, 23, 0, 1, 131082, 0, 65536, 131084, 0, 65537, 131085, 0, 65539, 327688, 0, 65536, 327689, 0, 65537, 327690, 0, 65537, 327691, 0, 65537, 327692, 0, 65537, 327693, 0, 65537, 327694, 0, 65537, 327695, 0, 65539, 458752, 0, 65537, 458753, 0, 65539, 458774, 0, 65536, 458775, 0, 65537, 524294, 0, 65536, 524295, 0, 65537, 524296, 0, 65537, 524297, 0, 65537, 524298, 0, 65537, 524299, 0, 65537, 524300, 0, 65537, 524301, 0, 65537, 524302, 0, 65537, 524303, 0, 65537, 524304, 0, 65537, 524305, 0, 65539, 720896, 0, 65537, 720897, 0, 65537, 720898, 0, 65537, 720899, 0, 65539, 720916, 0, 65536, 720917, 0, 65537, 720918, 0, 65537, 720919, 0, 65537, 786433, 0, 3, 786454, 0, 3, 851969, 0, 0, 851970, 0, 65537, 851971, 0, 65537, 851972, 0, 65537, 851973, 0, 65537, 851974, 0, 65537, 851975, 0, 65537, 851976, 0, 65537, 851977, 0, 65537, 851978, 0, 65537, 851979, 0, 65537, 851980, 0, 65537, 851981, 0, 65537, 851982, 0, 65537, 851983, 0, 65537, 851984, 0, 65537, 851985, 0, 65537, 851986, 0, 65537, 851987, 0, 65537, 851988, 0, 65537, 851989, 0, 65537, 851990, 0, 2 )

[node name="Launcher" parent="." instance=ExtResource( 2 )]
position = Vector2( 184, 40 )

[node name="Player" parent="." instance=ExtResource( 4 )]
position = Vector2( 216, 24 )

[node name="Enemies" type="Node" parent="."]

[node name="Armstrong" parent="Enemies" instance=ExtResource( 3 )]
position = Vector2( 24, 104 )

[node name="Armstrong2" parent="Enemies" instance=ExtResource( 3 )]
position = Vector2( 360, 104 )

[node name="Armstrong3" parent="Enemies" instance=ExtResource( 3 )]
position = Vector2( 24, 168 )
DESIRED_STATE = 2

[node name="Armstrong4" parent="Enemies" instance=ExtResource( 3 )]
position = Vector2( 360, 168 )
DESIRED_STATE = 2
42 changes: 42 additions & 0 deletions src/Level/Level5.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[gd_scene load_steps=5 format=2]

[ext_resource path="res://src/Tiles/Tiles.tres" type="TileSet" id=1]
[ext_resource path="res://src/Tiles/Launcher.tscn" type="PackedScene" id=2]
[ext_resource path="res://src/Actor/Enemies/Armstrong/Armstrong.tscn" type="PackedScene" id=3]
[ext_resource path="res://src/Actor/Player/Player.tscn" type="PackedScene" id=4]

[node name="Level5" type="Node2D"]

[node name="TileMap" type="TileMap" parent="."]
tile_set = ExtResource( 1 )
cell_size = Vector2( 16, 16 )
collision_layer = 16
collision_mask = 0
format = 1
tile_data = PoolIntArray( 131072, 0, 65537, 131073, 0, 65537, 131074, 0, 65537, 131075, 0, 65537, 131076, 0, 65537, 131077, 0, 65537, 131078, 0, 65537, 131079, 0, 65539, 131083, 0, 65536, 131084, 0, 65537, 131085, 0, 65537, 131086, 0, 65537, 131087, 0, 65537, 131088, 0, 65537, 131089, 0, 65537, 131090, 0, 65537, 131091, 0, 65537, 131092, 0, 65537, 131093, 0, 65539, 196628, 0, 3, 262164, 0, 3, 262167, 0, 65536, 327700, 0, 3, 393236, 0, 0, 393237, 0, 65539, 458752, 0, 65537, 458753, 0, 65537, 458754, 0, 65539, 524311, 0, 65536, 589833, 0, 3, 589838, 0, 3, 655364, 0, 65536, 655365, 0, 65537, 655366, 0, 65537, 655367, 0, 65537, 655368, 0, 65537, 655369, 0, 3, 655374, 0, 3, 655377, 0, 65536, 655378, 0, 65537, 655379, 0, 65537, 655380, 0, 65539, 720905, 0, 3, 720910, 0, 3, 786438, 0, 65537, 786441, 0, 0, 786442, 0, 65537, 786443, 0, 65537, 786444, 0, 65537, 786446, 0, 1, 786447, 0, 65537, 786448, 0, 65537, 786449, 0, 65537, 786450, 0, 65537, 786451, 0, 65537, 786452, 0, 65537, 786453, 0, 65537, 786454, 0, 65537, 786455, 0, 65537, 851968, 0, 65537, 851969, 0, 65537, 851970, 0, 65537, 851971, 0, 65537, 851972, 0, 65537, 851973, 0, 65537, 851974, 0, 1, 851975, 0, 65537, 851976, 0, 65537, 851977, 0, 1, 851978, 0, 1, 851979, 0, 1, 851980, 0, 1, 851981, 0, 1, 851982, 0, 1, 851983, 0, 1, 851984, 0, 1, 851985, 0, 1, 851986, 0, 1, 851987, 0, 1, 851988, 0, 1, 851989, 0, 1, 851990, 0, 1, 851991, 0, 1 )

[node name="Launcher" parent="." instance=ExtResource( 2 )]
position = Vector2( 216, 200 )

[node name="Player" parent="." instance=ExtResource( 4 )]
position = Vector2( 168, 184 )

[node name="Enemies" type="Node" parent="."]

[node name="Armstrong" parent="Enemies" instance=ExtResource( 3 )]
position = Vector2( 128, 200 )

[node name="Armstrong2" parent="Enemies" instance=ExtResource( 3 )]
position = Vector2( 56, 24 )
DESIRED_STATE = 2

[node name="Armstrong3" parent="Enemies" instance=ExtResource( 3 )]
position = Vector2( 24, 104 )

[node name="Armstrong4" parent="Enemies" instance=ExtResource( 3 )]
position = Vector2( 304, 184 )
DESIRED_STATE = 2

[node name="Armstrong5" parent="Enemies" instance=ExtResource( 3 )]
position = Vector2( 248, 24 )
DESIRED_STATE = 2

0 comments on commit 546303f

Please sign in to comment.