From 7e52f743433d99d06d20f455d4c75a6b258591db Mon Sep 17 00:00:00 2001 From: Sameer Rahmani Date: Sun, 17 Nov 2019 01:01:13 +0000 Subject: [PATCH] Game resolution has been changed --- .gitignore | 3 ++- project.godot | 13 +++++++++---- scenes/Astroid1.gd | 4 ++++ scenes/Astroid1.tscn | 11 ++++++++--- scenes/Astroid2.gd | 4 ++++ scenes/Astroid2.tscn | 11 ++++++++--- scenes/Astroid3.gd | 4 ++++ scenes/Astroid3.tscn | 11 ++++++++--- scenes/Astroid4.gd | 4 ++++ scenes/Astroid4.tscn | 9 ++++++--- scenes/Main.gd | 1 - scenes/Main.tscn | 11 +++++++---- scenes/VisibilityNotifier2D.gd | 13 +++++++++++++ 13 files changed, 77 insertions(+), 22 deletions(-) create mode 100644 scenes/Astroid1.gd create mode 100644 scenes/Astroid2.gd create mode 100644 scenes/Astroid3.gd create mode 100644 scenes/Astroid4.gd create mode 100644 scenes/VisibilityNotifier2D.gd diff --git a/.gitignore b/.gitignore index 96c3f59..a0b9f32 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ export_presets.cfg # Mono-specific ignores .mono/ data_*/ -*~ \ No newline at end of file +*~ +build/ \ No newline at end of file diff --git a/project.godot b/project.godot index cba0c28..73a7e8d 100644 --- a/project.godot +++ b/project.godot @@ -21,9 +21,9 @@ config/icon="res://icon.png" [display] -window/size/width=480 -window/size/height=800 -window/handheld/orientation="portrait" +window/size/resizable=false +window/size/borderless=true +window/size/fullscreen=true window/stretch/mode="2d" window/stretch/aspect="keep" @@ -31,10 +31,15 @@ window/stretch/aspect="keep" click={ "deadzone": 0.5, -"events": [ Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":1,"pressed":false,"doubleclick":false,"script":null) +"events": [ Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":1,"pressed":false,"doubleclick":false,"script":null) ] } +[physics] + +2d/thread_model=2 + [rendering] +threads/thread_model=2 environment/default_environment="res://default_env.tres" diff --git a/scenes/Astroid1.gd b/scenes/Astroid1.gd new file mode 100644 index 0000000..14c7910 --- /dev/null +++ b/scenes/Astroid1.gd @@ -0,0 +1,4 @@ +extends RigidBody2D + +func _on_VisibilityNotifier2D_screen_exited(): + queue_free() \ No newline at end of file diff --git a/scenes/Astroid1.tscn b/scenes/Astroid1.tscn index 8049a0b..2b382a4 100644 --- a/scenes/Astroid1.tscn +++ b/scenes/Astroid1.tscn @@ -1,15 +1,20 @@ -[gd_scene load_steps=2 format=2] +[gd_scene load_steps=3 format=2] -[ext_resource path="res://images/Asteroid 01.png" type="Texture" id=1] +[ext_resource path="res://scenes/Astroid1.gd" type="Script" id=1] +[ext_resource path="res://images/Asteroid 01.png" type="Texture" id=2] [node name="Astroid1" type="RigidBody2D"] gravity_scale = 0.0 +script = ExtResource( 1 ) __meta__ = { "_edit_group_": true } [node name="Astroid" type="Sprite" parent="."] -texture = ExtResource( 1 ) +texture = ExtResource( 2 ) [node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."] polygon = PoolVector2Array( -16.6984, -30.7987, -2.89647, -34.4792, 10.3534, -35.9514, 16.6103, -35.3993, 22.3151, -29.1424, 32.0684, -22.1495, 35.3809, -13.8683, 37.0371, 2.14194, 35.3809, 6.37454, 29.6761, 12.2634, 29.4921, 19.0723, 22.131, 27.5375, 9.06521, 34.1624, 2.44028, 35.4506, -1.24023, 35.8187, -8.41724, 34.1624, -15.4102, 31.4021, -17.8026, 27.3535, -23.3233, 27.9056, -26.6358, 27.7215, -29.2122, 23.4889, -32.8927, 15.9439, -36.7572, 6.74259, -37.3093, 1.03779, -36.7572, -7.79545, -33.8128, -16.4447, -28.108, -23.8057, -20.5629, -30.2466 ) + +[node name="VisibilityNotifier2D" type="VisibilityNotifier2D" parent="."] +[connection signal="screen_exited" from="VisibilityNotifier2D" to="." method="_on_VisibilityNotifier2D_screen_exited"] diff --git a/scenes/Astroid2.gd b/scenes/Astroid2.gd new file mode 100644 index 0000000..14c7910 --- /dev/null +++ b/scenes/Astroid2.gd @@ -0,0 +1,4 @@ +extends RigidBody2D + +func _on_VisibilityNotifier2D_screen_exited(): + queue_free() \ No newline at end of file diff --git a/scenes/Astroid2.tscn b/scenes/Astroid2.tscn index dce4896..5bce57c 100644 --- a/scenes/Astroid2.tscn +++ b/scenes/Astroid2.tscn @@ -1,19 +1,24 @@ -[gd_scene load_steps=3 format=2] +[gd_scene load_steps=4 format=2] -[ext_resource path="res://images/Asteroid 02.png" type="Texture" id=1] +[ext_resource path="res://scenes/Astroid2.gd" type="Script" id=1] +[ext_resource path="res://images/Asteroid 02.png" type="Texture" id=2] [sub_resource type="CircleShape2D" id=1] radius = 20.4766 [node name="Astroid2" type="RigidBody2D"] gravity_scale = 0.0 +script = ExtResource( 1 ) __meta__ = { "_edit_group_": true } [node name="Astroid" type="Sprite" parent="."] -texture = ExtResource( 1 ) +texture = ExtResource( 2 ) offset = Vector2( 4.41662, -6.80896 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="."] shape = SubResource( 1 ) + +[node name="VisibilityNotifier2D" type="VisibilityNotifier2D" parent="."] +[connection signal="screen_exited" from="VisibilityNotifier2D" to="." method="_on_VisibilityNotifier2D_screen_exited"] diff --git a/scenes/Astroid3.gd b/scenes/Astroid3.gd new file mode 100644 index 0000000..14c7910 --- /dev/null +++ b/scenes/Astroid3.gd @@ -0,0 +1,4 @@ +extends RigidBody2D + +func _on_VisibilityNotifier2D_screen_exited(): + queue_free() \ No newline at end of file diff --git a/scenes/Astroid3.tscn b/scenes/Astroid3.tscn index e851ab6..c7b3d15 100644 --- a/scenes/Astroid3.tscn +++ b/scenes/Astroid3.tscn @@ -1,16 +1,21 @@ -[gd_scene load_steps=2 format=2] +[gd_scene load_steps=3 format=2] -[ext_resource path="res://images/Asteroid 03.png" type="Texture" id=1] +[ext_resource path="res://scenes/Astroid3.gd" type="Script" id=1] +[ext_resource path="res://images/Asteroid 03.png" type="Texture" id=2] [node name="Astroid3" type="RigidBody2D"] gravity_scale = 0.0 +script = ExtResource( 1 ) __meta__ = { "_edit_group_": true } [node name="Astroid" type="Sprite" parent="."] -texture = ExtResource( 1 ) +texture = ExtResource( 2 ) offset = Vector2( 1.65623, -1.65623 ) [node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."] polygon = PoolVector2Array( -18.5387, -29.1424, 6.1208, -33.5591, 15.5061, -34.1111, 20.1068, -31.3508, 34.6448, -5.58714, 32.9886, 0.48571, 25.2595, 25.3292, 14.2179, 29.9298, -11.9137, 35.0826, -18.7227, 33.6104, -21.4831, 31.9541, -33.6288, 8.9509, -34.917, -5.40311, -30.6844, -14.7884, -22.9553, -25.4619 ) + +[node name="VisibilityNotifier2D" type="VisibilityNotifier2D" parent="."] +[connection signal="screen_exited" from="VisibilityNotifier2D" to="." method="_on_VisibilityNotifier2D_screen_exited"] diff --git a/scenes/Astroid4.gd b/scenes/Astroid4.gd new file mode 100644 index 0000000..14c7910 --- /dev/null +++ b/scenes/Astroid4.gd @@ -0,0 +1,4 @@ +extends RigidBody2D + +func _on_VisibilityNotifier2D_screen_exited(): + queue_free() \ No newline at end of file diff --git a/scenes/Astroid4.tscn b/scenes/Astroid4.tscn index ac64d5a..8d1dc32 100644 --- a/scenes/Astroid4.tscn +++ b/scenes/Astroid4.tscn @@ -1,9 +1,11 @@ -[gd_scene load_steps=2 format=2] +[gd_scene load_steps=3 format=2] -[ext_resource path="res://images/Asteroid 04.png" type="Texture" id=1] +[ext_resource path="res://scenes/Astroid4.gd" type="Script" id=1] +[ext_resource path="res://images/Asteroid 04.png" type="Texture" id=2] [node name="Astroid4" type="RigidBody2D"] gravity_scale = 0.0 +script = ExtResource( 1 ) __meta__ = { "_edit_group_": true, "_edit_horizontal_guides_": [ -34.5036, -5.13305, 31.5801 ], @@ -11,10 +13,11 @@ __meta__ = { } [node name="Astroid" type="Sprite" parent="."] -texture = ExtResource( 1 ) +texture = ExtResource( 2 ) offset = Vector2( 1.3986, -0.524475 ) [node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."] polygon = PoolVector2Array( -10, -34.5036, -1.25207, -32.7553, 3.29337, -30.3078, 10.8108, -24.1889, 20.7758, -18.5945, 37.2094, -8.62954, 41.4051, -2.6855, 43.8527, 2.20959, 42.9786, 9.90187, 38.9576, 17.4193, 27.4192, 29.1326, 22.8737, 32.6291, 18.3283, 31.7549, 9.76189, 28.0836, 3.29337, 24.0627, 0.32135, 22.4892, -4.57374, 24.2375, -12.6157, 28.4333, -18.0352, 31.2305, -21.1821, 31.5801, -25.203, 30.5312, -30.7974, 24.2375, -34.6436, 18.1186, -39.3638, 8.6781, -41.9862, -0.587605, -41.4617, -5.83234, -36.3918, -13.5246, -27.4758, -22.9652, -20.6576, -29.2588, -16.9863, -33.105, -13.315, -35.0281 ) [node name="VisibilityNotifier2D" type="VisibilityNotifier2D" parent="."] +[connection signal="screen_exited" from="VisibilityNotifier2D" to="." method="_on_VisibilityNotifier2D_screen_exited"] diff --git a/scenes/Main.gd b/scenes/Main.gd index 0b2875e..e1bddeb 100644 --- a/scenes/Main.gd +++ b/scenes/Main.gd @@ -31,7 +31,6 @@ func _on_AstroidTimer_timeout(): $ScreenEadge/Follow.set_offset(randi()) # Create an astroid instance and add it to the scene. var astroid = astroids[randi() % 4].instance() - add_child(astroid) #$HUD.connect("start_game", astroid, "_on_start_game") diff --git a/scenes/Main.tscn b/scenes/Main.tscn index 8cc9ef6..8220846 100644 --- a/scenes/Main.tscn +++ b/scenes/Main.tscn @@ -10,7 +10,7 @@ [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, 800, 0, 0, 0, 0, 0, 800, 0, 0, 0, 0, 0, 0 ) +"points": PoolVector2Array( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1030, 0, 0, 0, 0, 0, 1030, 600, 0, 0, 0, 0, 0, 600, 0, 0, 0, 0, 0, 0 ) } [node name="Main" type="Node"] @@ -25,10 +25,13 @@ Astroid4 = ExtResource( 5 ) [node name="ParallaxLayer" type="ParallaxLayer" parent="background"] [node name="TextureRect" type="TextureRect" parent="background/ParallaxLayer"] -margin_left = -100.0 -margin_right = 600.0 -margin_bottom = 800.0 +margin_left = -40.0 +margin_top = -80.0 +margin_right = 1090.0 +margin_bottom = 790.0 texture = ExtResource( 6 ) +expand = true +stretch_mode = 2 [node name="Player" parent="." instance=ExtResource( 7 )] position = Vector2( 160, 70 ) diff --git a/scenes/VisibilityNotifier2D.gd b/scenes/VisibilityNotifier2D.gd new file mode 100644 index 0000000..559eea3 --- /dev/null +++ b/scenes/VisibilityNotifier2D.gd @@ -0,0 +1,13 @@ +extends VisibilityNotifier2D + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass # Replace with function body. + +# Called every frame. 'delta' is the elapsed time since the previous frame. +#func _process(delta): +# pass