Skip to content

Commit

Permalink
v0.1.1, now works on almost any aspect ratio
Browse files Browse the repository at this point in the history
  • Loading branch information
browncanstudios committed Sep 18, 2021
1 parent d69e03d commit 8ffb2a0
Show file tree
Hide file tree
Showing 11 changed files with 122 additions and 43 deletions.
1 change: 1 addition & 0 deletions Scenes/Asteroid.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@ frames = SubResource( 2 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
scale = Vector2( 0.3, 0.3 )
shape = SubResource( 3 )

[connection signal="area_entered" from="." to="." method="_on_Asteroid_area_entered"]
[connection signal="animation_finished" from="Exploding" to="." method="_on_Exploding_animation_finished"]
4 changes: 2 additions & 2 deletions Scenes/Bass.gd
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ func _ready():

func _process(delta):
if active:
var mouse_position = get_viewport().get_mouse_position()
rotation = PI + (mouse_position - position).angle() - PI / 2
var global_mouse_position = get_global_mouse_position()
rotation = PI + (global_mouse_position - global_position).angle() - PI / 2

func activate():
modulate.a = 1.0
Expand Down
4 changes: 2 additions & 2 deletions Scenes/Clarinet.gd
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ func _ready():

func _process(delta):
if active:
var mouse_position = get_viewport().get_mouse_position()
rotation = (mouse_position - position).angle() - PI / 2
var global_mouse_position = get_global_mouse_position()
rotation = (global_mouse_position - global_position).angle() - PI / 2

func activate():
modulate.a = 1.0
Expand Down
4 changes: 2 additions & 2 deletions Scenes/Drum.gd
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ func _ready():

func _process(delta):
if active:
var mouse_position = get_viewport().get_mouse_position()
rotation = PI + (mouse_position - position).angle() - PI / 2
var global_mouse_position = get_global_mouse_position()
rotation = PI + (global_mouse_position - global_position).angle() - PI / 2

func activate():
modulate.a = 1.0
Expand Down
4 changes: 2 additions & 2 deletions Scenes/Game.gd
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func _on_AsteroidSpawnTimer_timeout():
var asteroid = load("res://Scenes/Asteroid.tscn").instance()

var angle = rng.randf_range(0, 2 * PI)
var p = target + get_viewport().size.x * 2.0 * Vector2(cos(angle), sin(angle))
var p = target + (2048 + 128) * Vector2(cos(angle), sin(angle))
var v = rng.randf_range(2048 * 0.05, 2048 * 0.1) * (target - p).normalized()

asteroid.init(p, v)
Expand All @@ -118,4 +118,4 @@ func _on_Planet_tree_exited():

func _on_ScoreTimer_timeout():
score += 1
$Score.set_text("score: " + str(score))
$CanvasLayer/TopGUI/HBoxContainer/MarginContainer/Score.set_text("score: " + str(score))
77 changes: 62 additions & 15 deletions Scenes/Game.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=17 format=2]
[gd_scene load_steps=18 format=2]

[ext_resource path="res://Assets/Background/BG_Base.png" type="Texture" id=1]
[ext_resource path="res://Assets/Background/BG_Stars.png" type="Texture" id=2]
Expand All @@ -20,14 +20,24 @@
size = 48
font_data = ExtResource( 15 )

[sub_resource type="DynamicFont" id=2]
size = 48
font_data = ExtResource( 15 )

[node name="Game" type="Node"]
script = ExtResource( 10 )

[node name="Background" type="Sprite" parent="."]
[node name="ParallaxBackground" type="ParallaxBackground" parent="."]

[node name="ParallaxLayer" type="ParallaxLayer" parent="ParallaxBackground"]
position = Vector2( -1024, -1024 )
motion_mirroring = Vector2( 2048, 2048 )

[node name="Background" type="Sprite" parent="ParallaxBackground/ParallaxLayer"]
position = Vector2( 1024, 1024 )
texture = ExtResource( 1 )

[node name="Stars" type="Sprite" parent="."]
[node name="Stars" type="Sprite" parent="ParallaxBackground/ParallaxLayer"]
position = Vector2( 1024, 1024 )
texture = ExtResource( 2 )

Expand Down Expand Up @@ -78,27 +88,64 @@ texture = ExtResource( 14 )
[node name="ScoreTimer" type="Timer" parent="."]
autostart = true

[node name="Version" type="Label" parent="."]
margin_left = 1873.51
margin_top = 1973.43
margin_right = 2026.51
margin_bottom = 2029.43
custom_fonts/font = SubResource( 1 )
text = "v0.1.0"
[node name="Camera2D" type="Camera2D" parent="."]
position = Vector2( 1024, 1024 )
current = true

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

[node name="TopGUI" type="MarginContainer" parent="CanvasLayer"]
anchor_right = 1.0
margin_left = 20.0
margin_top = 20.0
margin_right = -20.0
margin_bottom = 20.0
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Score" type="Label" parent="."]
margin_left = 34.024
margin_top = 15.5115
margin_right = 187.024
margin_bottom = 71.5115
[node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer/TopGUI"]
margin_right = 2008.0
margin_bottom = 56.0

[node name="MarginContainer" type="MarginContainer" parent="CanvasLayer/TopGUI/HBoxContainer"]
margin_right = 207.0
margin_bottom = 56.0

[node name="Score" type="Label" parent="CanvasLayer/TopGUI/HBoxContainer/MarginContainer"]
margin_right = 207.0
margin_bottom = 56.0
custom_fonts/font = SubResource( 1 )
text = "score: 0"

[node name="BottomGUI" type="MarginContainer" parent="CanvasLayer"]
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 20.0
margin_top = -76.0
margin_right = -20.0
margin_bottom = -20.0
__meta__ = {
"_edit_use_anchors_": false
}

[node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer/BottomGUI"]
margin_right = 2008.0
margin_bottom = 56.0
alignment = 2

[node name="MarginContainer" type="MarginContainer" parent="CanvasLayer/BottomGUI/HBoxContainer"]
margin_left = 1868.0
margin_right = 2008.0
margin_bottom = 56.0

[node name="Version" type="Label" parent="CanvasLayer/BottomGUI/HBoxContainer/MarginContainer"]
margin_right = 140.0
margin_bottom = 56.0
custom_fonts/font = SubResource( 2 )
text = "v0.1.1"

[connection signal="input_event" from="Clarinet" to="." method="_on_Clarinet_input_event"]
[connection signal="input_event" from="Trombone" to="." method="_on_Trombone_input_event"]
[connection signal="tree_exited" from="Planet" to="." method="_on_Planet_tree_exited"]
Expand Down
4 changes: 2 additions & 2 deletions Scenes/Saxophone.gd
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ func _ready():

func _process(delta):
if active:
var mouse_position = get_viewport().get_mouse_position()
rotation = PI + (mouse_position - position).angle() - PI / 2
var global_mouse_position = get_global_mouse_position()
rotation = PI + (global_mouse_position - global_position).angle() - PI / 2

func activate():
modulate.a = 1.0
Expand Down
53 changes: 43 additions & 10 deletions Scenes/Title.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=16 format=2]
[gd_scene load_steps=17 format=2]

[ext_resource path="res://Assets/Background/BG_Base.png" type="Texture" id=1]
[ext_resource path="res://Assets/Background/BG_Stars.png" type="Texture" id=2]
Expand All @@ -19,14 +19,24 @@
size = 48
font_data = ExtResource( 14 )

[sub_resource type="DynamicFont" id=2]
size = 48
font_data = ExtResource( 14 )

[node name="Title" type="Node"]
script = ExtResource( 4 )

[node name="Background" type="Sprite" parent="."]
[node name="ParallaxBackground" type="ParallaxBackground" parent="."]

[node name="ParallaxLayer" type="ParallaxLayer" parent="ParallaxBackground"]
position = Vector2( -1024, -1024 )
motion_mirroring = Vector2( 2048, 2048 )

[node name="Background" type="Sprite" parent="ParallaxBackground/ParallaxLayer"]
position = Vector2( 1024, 1024 )
texture = ExtResource( 1 )

[node name="Stars" type="Sprite" parent="."]
[node name="Stars" type="Sprite" parent="ParallaxBackground/ParallaxLayer"]
position = Vector2( 1024, 1024 )
texture = ExtResource( 2 )

Expand Down Expand Up @@ -81,17 +91,40 @@ __meta__ = {
"_edit_use_anchors_": false
}

[node name="Version" type="Label" parent="."]
margin_left = 1873.51
margin_top = 1973.43
margin_right = 2026.51
margin_bottom = 2029.43
custom_fonts/font = SubResource( 1 )
text = "v0.1.0"
[node name="Camera2D" type="Camera2D" parent="."]
position = Vector2( 1024, 1024 )
current = true

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

[node name="TitleGUI" type="MarginContainer" parent="CanvasLayer"]
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 20.0
margin_top = -76.0
margin_right = -20.0
margin_bottom = -20.0
__meta__ = {
"_edit_use_anchors_": false
}

[node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer/TitleGUI"]
margin_right = 2008.0
margin_bottom = 56.0
alignment = 2

[node name="MarginContainer" type="MarginContainer" parent="CanvasLayer/TitleGUI/HBoxContainer"]
margin_left = 1868.0
margin_right = 2008.0
margin_bottom = 56.0

[node name="Version" type="Label" parent="CanvasLayer/TitleGUI/HBoxContainer/MarginContainer"]
margin_right = 140.0
margin_bottom = 56.0
custom_fonts/font = SubResource( 2 )
text = "v0.1.1"

[connection signal="input_event" from="Clarinet" to="." method="_on_Clarinet_input_event"]
[connection signal="input_event" from="Trombone" to="." method="_on_Trombone_input_event"]
[connection signal="input_event" from="Saxophone" to="." method="_on_Saxophone_input_event"]
Expand Down
4 changes: 2 additions & 2 deletions Scenes/Trombone.gd
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ func _ready():

func _process(delta):
if active:
var mouse_position = get_viewport().get_mouse_position()
rotation = (mouse_position - position).angle() - PI / 2
var global_mouse_position = get_global_mouse_position()
rotation = (global_mouse_position - global_position).angle() - PI / 2

func activate():
modulate.a = 1.0
Expand Down
4 changes: 2 additions & 2 deletions Scenes/Violin.gd
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ func _ready():

func _process(delta):
if active:
var mouse_position = get_viewport().get_mouse_position()
rotation = PI + (mouse_position - position).angle() - PI / 2
var global_mouse_position = get_global_mouse_position()
rotation = PI + (global_mouse_position - global_position).angle() - PI / 2

func activate():
modulate.a = 1.0
Expand Down
6 changes: 2 additions & 4 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,22 @@ config_version=4

_global_script_classes=[ ]
_global_script_class_icons={

}

[application]

config/name="Starry Shtetl Defender"
config/name="StarryShtetlDefender"
run/main_scene="res://Scenes/Title.tscn"
config/icon="res://icon.png"

[display]

window/size/width=2048
window/size/height=2048
window/size/resizable=false
window/size/test_width=720
window/size/test_height=720
window/stretch/mode="2d"
window/stretch/aspect="keep_width"
window/stretch/aspect="expand"

[rendering]

Expand Down

0 comments on commit 8ffb2a0

Please sign in to comment.