Skip to content

Commit

Permalink
Add HUD to gameplay, fix position, fix logo not appearing
Browse files Browse the repository at this point in the history
  • Loading branch information
davcri committed Oct 10, 2019
1 parent 4c449d3 commit 441d3c7
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Assets/hud/spr_life_icon.png.import
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
Expand All @@ -30,5 +30,5 @@ process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
detect_3d=false
svg/scale=1.0
34 changes: 34 additions & 0 deletions Assets/logos/logo.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/logo.png-cd8e2e2b073e3b0f1f060cf506d55bf6.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Assets/logos/logo.png"
dest_files=[ "res://.import/logo.png-cd8e2e2b073e3b0f1f060cf506d55bf6.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
6 changes: 5 additions & 1 deletion Scenes/Gameplay/Level1/Level1.tscn
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[gd_scene load_steps=8 format=2]
[gd_scene load_steps=9 format=2]

[ext_resource path="res://Scenes/Gameplay/Level.gd" type="Script" id=1]
[ext_resource path="res://Scenes/Spaceship/Spaceship.tscn" type="PackedScene" id=2]
[ext_resource path="res://Assets/warped city files/environment/background/skyline-a.png" type="Texture" id=3]
[ext_resource path="res://Scenes/Score/ScoreHandler.tscn" type="PackedScene" id=4]
[ext_resource path="res://Scenes/Enemies/EnemySpawner.tscn" type="PackedScene" id=5]
[ext_resource path="res://Assets/gameplay_music.ogg" type="AudioStream" id=6]
[ext_resource path="res://Scenes/Spaceship/HUD.tscn" type="PackedScene" id=7]

[sub_resource type="Animation" id=1]
resource_name = "move"
Expand Down Expand Up @@ -104,3 +105,6 @@ position = Vector2( 1090.63, 89.2953 )
stream = ExtResource( 6 )
autoplay = true

[node name="HUD" parent="." instance=ExtResource( 7 )]
iconOffset = 50.0

7 changes: 5 additions & 2 deletions Scenes/Main.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ __meta__ = {
}

[node name="ScrollingBackground" parent="." instance=ExtResource( 2 )]
updateScreen = false
reset = false
testAnimation = false
distance = 800

[node name="ScrollingFarBuildings" parent="." instance=ExtResource( 3 )]
Expand All @@ -79,7 +82,6 @@ visibleHeightPercentage = 0.65
script = ExtResource( 5 )

[node name="Logo" parent="UILayer" instance=ExtResource( 6 )]
rect_pivot_offset = Vector2( -397.69, 525.277 )

[node name="MainButtons" parent="UILayer" instance=ExtResource( 7 )]
anchor_top = 0.5
Expand All @@ -103,10 +105,11 @@ anims/spaceshipArrives = SubResource( 1 )
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 10 )
autoplay = true

[connection signal="transition_updated" from="ScrollingBackground" to="ScrollingBuildings" method="_on_ScrollingBackground_transition_updated"]
[connection signal="transition_updated" from="ScrollingBackground" to="ScrollingFarBuildings" method="_on_ScrollingBackground_transition_updated"]
[connection signal="transition_updated" from="ScrollingBackground" to="." method="_on_ScrollingBackground_transition_updated"]
[connection signal="transition_updated" from="ScrollingBackground" to="UILayer/MainButtons" method="_on_ScrollingBackground_transition_updated"]
[connection signal="transition_updated" from="ScrollingBackground" to="ScrollingFarBuildings" method="_on_ScrollingBackground_transition_updated"]
[connection signal="optionsButtonClicked" from="UILayer/MainButtons" to="UILayer" method="_on_MainButtons_optionsButtonClicked"]
[connection signal="startGameClicked" from="UILayer/MainButtons" to="." method="_on_MainButtons_startGameClicked"]
[connection signal="animation_finished" from="Spaceship/AnimationPlayer" to="." method="_on_AnimationPlayer_animation_finished"]
5 changes: 3 additions & 2 deletions Scenes/MainMenu/Logo/Logo.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ margin_right = 678.0
margin_bottom = 760.0

[node name="TextureRect" type="TextureRect" parent="."]
modulate = Color( 1, 1, 1, 0.0333333 )
modulate = Color( 1, 1, 1, 2.23849e-11 )
material = SubResource( 1 )
anchor_left = 0.5
anchor_top = 1.0
Expand All @@ -50,7 +50,7 @@ margin_top = -270.0
margin_right = 330.0
grow_horizontal = 2
grow_vertical = 2
rect_scale = Vector2( 0.0322581, 0.0322581 )
rect_scale = Vector2( 0, 0 )
rect_pivot_offset = Vector2( 324.969, 132.617 )
rect_clip_content = true
texture = ExtResource( 1 )
Expand All @@ -59,3 +59,4 @@ expand = true
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
autoplay = "Logo"
anims/Logo = SubResource( 2 )

6 changes: 3 additions & 3 deletions Scenes/Spaceship/HUD.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ extends Node2D
signal game_over

# X and Y coordinates for the first life icon
const iconPosX = 250
const iconPosY = 250
const iconPosX = 100
const iconPosY = 50
# The offset, to place the other life icons.
# This number should be set to the width of the icon + a number of pixels to use as a gap between icons
export (float) var iconOffset = 200
export (float) var iconOffset = 80

# This HUD will draw 4 lives on screen, and then
# give the player one more life that doesn't get a graphic
Expand Down
3 changes: 1 addition & 2 deletions Scenes/Spaceship/HUD.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
script = ExtResource( 1 )

[node name="Health_Icon" type="Sprite" parent="."]
position = Vector2( 75.8228, 115.162 )
scale = Vector2( 4, 4 )
scale = Vector2( 2, 2 )
texture = ExtResource( 2 )

0 comments on commit 441d3c7

Please sign in to comment.