commit 270f0937c9bc2884010b4779b436784a0e7bdd19 Author: En Yi Date: Sat Dec 1 19:48:56 2018 +0000 First commit diff --git a/.import/bg.png-ca4dd02b5a08671d1e8200d74b5e8347.md5 b/.import/bg.png-ca4dd02b5a08671d1e8200d74b5e8347.md5 new file mode 100644 index 0000000..8887cb3 --- /dev/null +++ b/.import/bg.png-ca4dd02b5a08671d1e8200d74b5e8347.md5 @@ -0,0 +1,3 @@ +source_md5="82439f9fd751193fa54d9b83f85dfa21" +dest_md5="c9a31715f51488f22b1ff7f51df868e5" + diff --git a/.import/bg.png-ca4dd02b5a08671d1e8200d74b5e8347.stex b/.import/bg.png-ca4dd02b5a08671d1e8200d74b5e8347.stex new file mode 100644 index 0000000..a9a846b Binary files /dev/null and b/.import/bg.png-ca4dd02b5a08671d1e8200d74b5e8347.stex differ diff --git a/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.md5 b/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.md5 new file mode 100644 index 0000000..f3656be --- /dev/null +++ b/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.md5 @@ -0,0 +1,3 @@ +source_md5="ae7e641067601e2184afcade49abd283" +dest_md5="84511021bbc8c9d37c7f0f4d181de883" + diff --git a/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex b/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex new file mode 100644 index 0000000..1f08a3c Binary files /dev/null and b/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex differ diff --git a/.import/laser.png-582b25a39cfa4d8d29e6ed18abfee315.md5 b/.import/laser.png-582b25a39cfa4d8d29e6ed18abfee315.md5 new file mode 100644 index 0000000..0692be4 --- /dev/null +++ b/.import/laser.png-582b25a39cfa4d8d29e6ed18abfee315.md5 @@ -0,0 +1,3 @@ +source_md5="fda16e9f63f3d09aa3df2e7696b27105" +dest_md5="6fde89b1d76a2e95e2094fe9bda548ae" + diff --git a/.import/laser.png-582b25a39cfa4d8d29e6ed18abfee315.stex b/.import/laser.png-582b25a39cfa4d8d29e6ed18abfee315.stex new file mode 100644 index 0000000..0561f79 Binary files /dev/null and b/.import/laser.png-582b25a39cfa4d8d29e6ed18abfee315.stex differ diff --git a/.import/laser1.png-3a8f1aecd0d5e32509ea0f4610006890.md5 b/.import/laser1.png-3a8f1aecd0d5e32509ea0f4610006890.md5 new file mode 100644 index 0000000..14dd0c1 --- /dev/null +++ b/.import/laser1.png-3a8f1aecd0d5e32509ea0f4610006890.md5 @@ -0,0 +1,3 @@ +source_md5="87098a63f4b17a9feda98826cb65ed93" +dest_md5="f1f54fbbda0c2ebc7d33cbacdacc80ac" + diff --git a/.import/laser1.png-3a8f1aecd0d5e32509ea0f4610006890.stex b/.import/laser1.png-3a8f1aecd0d5e32509ea0f4610006890.stex new file mode 100644 index 0000000..c031848 Binary files /dev/null and b/.import/laser1.png-3a8f1aecd0d5e32509ea0f4610006890.stex differ diff --git a/.import/laser2.png-8f5876c42429477442ec60a0e596b1f2.md5 b/.import/laser2.png-8f5876c42429477442ec60a0e596b1f2.md5 new file mode 100644 index 0000000..6fc52b0 --- /dev/null +++ b/.import/laser2.png-8f5876c42429477442ec60a0e596b1f2.md5 @@ -0,0 +1,3 @@ +source_md5="bb9a9831d1b60983eadc87505a0c2f48" +dest_md5="4d5ef1796cd69e756fa2d9caded8428f" + diff --git a/.import/laser2.png-8f5876c42429477442ec60a0e596b1f2.stex b/.import/laser2.png-8f5876c42429477442ec60a0e596b1f2.stex new file mode 100644 index 0000000..7593a05 Binary files /dev/null and b/.import/laser2.png-8f5876c42429477442ec60a0e596b1f2.stex differ diff --git a/.import/laser3.png-3359a16ea507bb3ba84cb3e5ece414a9.md5 b/.import/laser3.png-3359a16ea507bb3ba84cb3e5ece414a9.md5 new file mode 100644 index 0000000..6133d8b --- /dev/null +++ b/.import/laser3.png-3359a16ea507bb3ba84cb3e5ece414a9.md5 @@ -0,0 +1,3 @@ +source_md5="2f2243bcfa0de4b3550d17030751fa9c" +dest_md5="c673ba5088d3fb2bc49c864c9e58a5e4" + diff --git a/.import/laser3.png-3359a16ea507bb3ba84cb3e5ece414a9.stex b/.import/laser3.png-3359a16ea507bb3ba84cb3e5ece414a9.stex new file mode 100644 index 0000000..78a7f94 Binary files /dev/null and b/.import/laser3.png-3359a16ea507bb3ba84cb3e5ece414a9.stex differ diff --git a/.import/laser4.png-7fa45cf079a8fe2ceb0981f3c6a8e18d.md5 b/.import/laser4.png-7fa45cf079a8fe2ceb0981f3c6a8e18d.md5 new file mode 100644 index 0000000..eeb284c --- /dev/null +++ b/.import/laser4.png-7fa45cf079a8fe2ceb0981f3c6a8e18d.md5 @@ -0,0 +1,3 @@ +source_md5="96c2b28c84021c892126951ce18483df" +dest_md5="b2c7f718153f3ed6da4bea73517af5e6" + diff --git a/.import/laser4.png-7fa45cf079a8fe2ceb0981f3c6a8e18d.stex b/.import/laser4.png-7fa45cf079a8fe2ceb0981f3c6a8e18d.stex new file mode 100644 index 0000000..709382d Binary files /dev/null and b/.import/laser4.png-7fa45cf079a8fe2ceb0981f3c6a8e18d.stex differ diff --git a/.import/laser5.png-aaa903cdba8340cc675317fe0fdf7290.md5 b/.import/laser5.png-aaa903cdba8340cc675317fe0fdf7290.md5 new file mode 100644 index 0000000..54f7f27 --- /dev/null +++ b/.import/laser5.png-aaa903cdba8340cc675317fe0fdf7290.md5 @@ -0,0 +1,3 @@ +source_md5="8be25ba1fa0d3385dc0571563b527043" +dest_md5="d11b7c93623937f3db66f0f99a263bc2" + diff --git a/.import/laser5.png-aaa903cdba8340cc675317fe0fdf7290.stex b/.import/laser5.png-aaa903cdba8340cc675317fe0fdf7290.stex new file mode 100644 index 0000000..56d01ac Binary files /dev/null and b/.import/laser5.png-aaa903cdba8340cc675317fe0fdf7290.stex differ diff --git a/.import/laser6.png-7439aaa3c6999a31603529fcf0b7d749.md5 b/.import/laser6.png-7439aaa3c6999a31603529fcf0b7d749.md5 new file mode 100644 index 0000000..4596720 --- /dev/null +++ b/.import/laser6.png-7439aaa3c6999a31603529fcf0b7d749.md5 @@ -0,0 +1,3 @@ +source_md5="c8c1983715d381e735766068d5df6c73" +dest_md5="a7975260d92548d913bfd81f888bcd14" + diff --git a/.import/laser6.png-7439aaa3c6999a31603529fcf0b7d749.stex b/.import/laser6.png-7439aaa3c6999a31603529fcf0b7d749.stex new file mode 100644 index 0000000..a9136d5 Binary files /dev/null and b/.import/laser6.png-7439aaa3c6999a31603529fcf0b7d749.stex differ diff --git a/.import/laser7.png-55229c351bc2ce65850e1ee21f5350c2.md5 b/.import/laser7.png-55229c351bc2ce65850e1ee21f5350c2.md5 new file mode 100644 index 0000000..f1a0937 --- /dev/null +++ b/.import/laser7.png-55229c351bc2ce65850e1ee21f5350c2.md5 @@ -0,0 +1,3 @@ +source_md5="0da2693ced135cf8e17757df2ad75f09" +dest_md5="7779e017075127957ded0dd479e5403f" + diff --git a/.import/laser7.png-55229c351bc2ce65850e1ee21f5350c2.stex b/.import/laser7.png-55229c351bc2ce65850e1ee21f5350c2.stex new file mode 100644 index 0000000..f7ab943 Binary files /dev/null and b/.import/laser7.png-55229c351bc2ce65850e1ee21f5350c2.stex differ diff --git a/.import/laser_beam.png-63a193f03d65cacb4399cfdc997d378c.md5 b/.import/laser_beam.png-63a193f03d65cacb4399cfdc997d378c.md5 new file mode 100644 index 0000000..2bb6e8a --- /dev/null +++ b/.import/laser_beam.png-63a193f03d65cacb4399cfdc997d378c.md5 @@ -0,0 +1,3 @@ +source_md5="b2729a13e325a02552d0045ae3bc9e01" +dest_md5="6d8ef38a7151679347037153862bc262" + diff --git a/.import/laser_beam.png-63a193f03d65cacb4399cfdc997d378c.stex b/.import/laser_beam.png-63a193f03d65cacb4399cfdc997d378c.stex new file mode 100644 index 0000000..a206c0c Binary files /dev/null and b/.import/laser_beam.png-63a193f03d65cacb4399cfdc997d378c.stex differ diff --git a/.import/laser_e1.png-d3424a47d5d7f2c713055d0eec09a4d9.md5 b/.import/laser_e1.png-d3424a47d5d7f2c713055d0eec09a4d9.md5 new file mode 100644 index 0000000..6cf2d58 --- /dev/null +++ b/.import/laser_e1.png-d3424a47d5d7f2c713055d0eec09a4d9.md5 @@ -0,0 +1,3 @@ +source_md5="a18edb27531254dd330b0f21163b03c0" +dest_md5="afd5e1808a34a98b5bac85c7bb36ed68" + diff --git a/.import/laser_e1.png-d3424a47d5d7f2c713055d0eec09a4d9.stex b/.import/laser_e1.png-d3424a47d5d7f2c713055d0eec09a4d9.stex new file mode 100644 index 0000000..1836b59 Binary files /dev/null and b/.import/laser_e1.png-d3424a47d5d7f2c713055d0eec09a4d9.stex differ diff --git a/.import/laser_e2.png-2f087550b3c5b4c6645c31c52673191b.md5 b/.import/laser_e2.png-2f087550b3c5b4c6645c31c52673191b.md5 new file mode 100644 index 0000000..49983a7 --- /dev/null +++ b/.import/laser_e2.png-2f087550b3c5b4c6645c31c52673191b.md5 @@ -0,0 +1,3 @@ +source_md5="0a1eceef308420715b547d731e525284" +dest_md5="479df72162df426138e4e79f9aeed15d" + diff --git a/.import/laser_e2.png-2f087550b3c5b4c6645c31c52673191b.stex b/.import/laser_e2.png-2f087550b3c5b4c6645c31c52673191b.stex new file mode 100644 index 0000000..ef8bd63 Binary files /dev/null and b/.import/laser_e2.png-2f087550b3c5b4c6645c31c52673191b.stex differ diff --git a/.import/laser_e3.png-50133e74933ab1785ed04c37e330cbd2.md5 b/.import/laser_e3.png-50133e74933ab1785ed04c37e330cbd2.md5 new file mode 100644 index 0000000..1e7599c --- /dev/null +++ b/.import/laser_e3.png-50133e74933ab1785ed04c37e330cbd2.md5 @@ -0,0 +1,3 @@ +source_md5="d7745f0d189d31b8303af589d7dbca63" +dest_md5="675feb96bc09f11ed4dc01be274b5c62" + diff --git a/.import/laser_e3.png-50133e74933ab1785ed04c37e330cbd2.stex b/.import/laser_e3.png-50133e74933ab1785ed04c37e330cbd2.stex new file mode 100644 index 0000000..7fb0f2e Binary files /dev/null and b/.import/laser_e3.png-50133e74933ab1785ed04c37e330cbd2.stex differ diff --git a/.import/laser_e4.png-3a28c9004ed157751cfc2d65ec0d4968.md5 b/.import/laser_e4.png-3a28c9004ed157751cfc2d65ec0d4968.md5 new file mode 100644 index 0000000..682a21d --- /dev/null +++ b/.import/laser_e4.png-3a28c9004ed157751cfc2d65ec0d4968.md5 @@ -0,0 +1,3 @@ +source_md5="62fa3fc2a4875bc2f454bdbc2348ba1b" +dest_md5="be1f002a608491e4a11288625a87be3e" + diff --git a/.import/laser_e4.png-3a28c9004ed157751cfc2d65ec0d4968.stex b/.import/laser_e4.png-3a28c9004ed157751cfc2d65ec0d4968.stex new file mode 100644 index 0000000..f90deb5 Binary files /dev/null and b/.import/laser_e4.png-3a28c9004ed157751cfc2d65ec0d4968.stex differ diff --git a/.import/laser_enemy.png-a2b286638460418bb5b274fbb29453a0.md5 b/.import/laser_enemy.png-a2b286638460418bb5b274fbb29453a0.md5 new file mode 100644 index 0000000..0692be4 --- /dev/null +++ b/.import/laser_enemy.png-a2b286638460418bb5b274fbb29453a0.md5 @@ -0,0 +1,3 @@ +source_md5="fda16e9f63f3d09aa3df2e7696b27105" +dest_md5="6fde89b1d76a2e95e2094fe9bda548ae" + diff --git a/.import/laser_enemy.png-a2b286638460418bb5b274fbb29453a0.stex b/.import/laser_enemy.png-a2b286638460418bb5b274fbb29453a0.stex new file mode 100644 index 0000000..0561f79 Binary files /dev/null and b/.import/laser_enemy.png-a2b286638460418bb5b274fbb29453a0.stex differ diff --git a/.import/main_menu.png-762fdd61d58100d0de812d558e587c2b.md5 b/.import/main_menu.png-762fdd61d58100d0de812d558e587c2b.md5 new file mode 100644 index 0000000..56ef572 --- /dev/null +++ b/.import/main_menu.png-762fdd61d58100d0de812d558e587c2b.md5 @@ -0,0 +1,3 @@ +source_md5="fd25f546158ed46cbdf158aa233d874b" +dest_md5="4b3ab242655463e70c1a4e507fdb9136" + diff --git a/.import/main_menu.png-762fdd61d58100d0de812d558e587c2b.stex b/.import/main_menu.png-762fdd61d58100d0de812d558e587c2b.stex new file mode 100644 index 0000000..e0bc100 Binary files /dev/null and b/.import/main_menu.png-762fdd61d58100d0de812d558e587c2b.stex differ diff --git a/.import/player.png-99d195b4b10a03b7e1088962b50c29f4.md5 b/.import/player.png-99d195b4b10a03b7e1088962b50c29f4.md5 new file mode 100644 index 0000000..3d8f8b3 --- /dev/null +++ b/.import/player.png-99d195b4b10a03b7e1088962b50c29f4.md5 @@ -0,0 +1,3 @@ +source_md5="2c7987608061685a6ec3d18bb9b315a7" +dest_md5="d61f498727c4f7e3cbc9d4e6ede31e9e" + diff --git a/.import/player.png-99d195b4b10a03b7e1088962b50c29f4.stex b/.import/player.png-99d195b4b10a03b7e1088962b50c29f4.stex new file mode 100644 index 0000000..f9e4634 Binary files /dev/null and b/.import/player.png-99d195b4b10a03b7e1088962b50c29f4.stex differ diff --git a/.import/wall.png-a390048f5e12dd0b271d636d681186c9.md5 b/.import/wall.png-a390048f5e12dd0b271d636d681186c9.md5 new file mode 100644 index 0000000..dae52f4 --- /dev/null +++ b/.import/wall.png-a390048f5e12dd0b271d636d681186c9.md5 @@ -0,0 +1,3 @@ +source_md5="78e3f75133d7f48dd3cb73b7ae7d04a0" +dest_md5="0e06e0e217f2b38e993404709fd17afa" + diff --git a/.import/wall.png-a390048f5e12dd0b271d636d681186c9.stex b/.import/wall.png-a390048f5e12dd0b271d636d681186c9.stex new file mode 100644 index 0000000..1f240de Binary files /dev/null and b/.import/wall.png-a390048f5e12dd0b271d636d681186c9.stex differ diff --git a/Data-Control.ttf b/Data-Control.ttf new file mode 100644 index 0000000..9194efc Binary files /dev/null and b/Data-Control.ttf differ diff --git a/Enemy_spawner.gd b/Enemy_spawner.gd new file mode 100644 index 0000000..6105b20 --- /dev/null +++ b/Enemy_spawner.gd @@ -0,0 +1,15 @@ +extends Node2D + +# class member variables go here, for example: +# var a = 2 +# var b = "textvar" + +func _ready(): + # Called when the node is added to the scene for the first time. + # Initialization here + pass + +#func _process(delta): +# # Called every frame. Delta is time since last frame. +# # Update game logic here. +# pass diff --git a/Enemy_spawner.tscn b/Enemy_spawner.tscn new file mode 100644 index 0000000..bf9cd8e --- /dev/null +++ b/Enemy_spawner.tscn @@ -0,0 +1,5 @@ +[gd_scene format=2] + +[node name="Enemy_spawner" type="Node2D"] + + diff --git a/Global.gd b/Global.gd new file mode 100644 index 0000000..338af6a --- /dev/null +++ b/Global.gd @@ -0,0 +1,14 @@ +extends Node + +const GRID_SIZE = 16 + +var loading_game = false + +var high_score = 0 + +var diff_level = 1 + +var level_duration = 15 + +var return_to_menu = false +var playable = true \ No newline at end of file diff --git a/Laser.gd b/Laser.gd new file mode 100644 index 0000000..4f57469 --- /dev/null +++ b/Laser.gd @@ -0,0 +1,23 @@ +extends AnimatedSprite + +# class member variables go here, for example: +# var a = 2 +# var b = "textvar" +signal shoot(obj) + +func _ready(): + # Called when the node is added to the scene for the first time. + # Initialization here + pass + +func place_obj(p1,p2,t): + $Tween.interpolate_property(self, "position:x", + p1, p2, t, Tween.TRANS_LINEAR, Tween.EASE_IN) + $Tween.start() + +func _on_Timer_timeout(): + set_frame(frame +1) + +func _on_Laser_frame_changed(): + if frame == 4: + emit_signal("shoot",self) diff --git a/Laser_enemy.tscn b/Laser_enemy.tscn new file mode 100644 index 0000000..e67be56 --- /dev/null +++ b/Laser_enemy.tscn @@ -0,0 +1,55 @@ +[gd_scene load_steps=7 format=2] + +[ext_resource path="res://art/laser_frames/laser_e1.png" type="Texture" id=1] +[ext_resource path="res://art/laser_frames/laser_e2.png" type="Texture" id=2] +[ext_resource path="res://art/laser_frames/laser_e3.png" type="Texture" id=3] +[ext_resource path="res://art/laser_frames/laser_e4.png" type="Texture" id=4] +[ext_resource path="res://Laser.gd" type="Script" id=5] + +[sub_resource type="SpriteFrames" id=1] + +animations = [ { +"frames": [ ExtResource( 1 ), ExtResource( 2 ), ExtResource( 3 ), ExtResource( 4 ), ExtResource( 4 ) ], +"loop": true, +"name": "default", +"speed": 10.0 +} ] + +[node name="Laser" type="AnimatedSprite"] + +frames = SubResource( 1 ) +animation = "default" +script = ExtResource( 5 ) + +[node name="Timer" type="Timer" parent="." index="0"] + +process_mode = 1 +wait_time = 0.25 +one_shot = false +autostart = true + +[node name="Line2D" type="Line2D" parent="." index="1"] + +position = Vector2( 15, 0 ) +points = PoolVector2Array( -1000, 0, -32, 0 ) +width = 2.0 +default_color = Color( 1, 1, 1, 1 ) +texture_mode = -1082452802 +sharp_limit = 2.0 +round_precision = 8 +_sections_unfolded = [ "Border", "Fill", "Transform" ] + +[node name="Tween" type="Tween" parent="." index="2"] + +repeat = false +playback_process_mode = 1 +playback_speed = 1.0 +playback/active = false +playback/repeat = false +playback/speed = 1.0 + +[connection signal="frame_changed" from="." to="." method="_on_Laser_frame_changed"] + +[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"] + + diff --git a/Laser_obj.gd b/Laser_obj.gd new file mode 100644 index 0000000..657910e --- /dev/null +++ b/Laser_obj.gd @@ -0,0 +1,32 @@ +extends Area2D + +# class member variables go here, for example: +# var a = 2 +# var b = "textvar" +onready var tween_node = $Tween +var active = true +var active_frames = 6; +signal kill_zone(body) + +func _ready(): + # Called when the node is added to the scene for the first time. + # Initialization here + $activetimer.set_wait_time(active_frames/60) + +func _on_Tween_tween_completed(object, key): + get_tree().queue_delete(self) + + +func _on_Laser_obj_body_entered(body): + if active: + print(body) + emit_signal("kill_zone", body) + + +func _on_activetimer_timeout(): + active = false + tween_node.interpolate_property(self, "scale:y", + 1, 0, 0.3, Tween.TRANS_LINEAR, Tween.EASE_IN) + tween_node.interpolate_property(self, "modulate", + Color(1, 1, 1, 1), Color(1, 1, 1, 0), 0.3, Tween.TRANS_LINEAR, Tween.EASE_IN) + tween_node.start() diff --git a/Laser_obj.tscn b/Laser_obj.tscn new file mode 100644 index 0000000..a99bb68 --- /dev/null +++ b/Laser_obj.tscn @@ -0,0 +1,57 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://Laser_obj.gd" type="Script" id=1] +[ext_resource path="res://art/laser_beam.png" type="Texture" id=2] + +[sub_resource type="RectangleShape2D" id=1] + +custom_solver_bias = 0.0 +extents = Vector2( 312, 6.43319 ) + +[node name="Laser_obj" type="Area2D"] + +input_pickable = true +gravity_vec = Vector2( 0, 1 ) +gravity = 98.0 +linear_damp = 0.1 +angular_damp = 1.0 +audio_bus_override = false +audio_bus_name = "Master" +script = ExtResource( 1 ) + +[node name="Sprite" type="Sprite" parent="." index="0"] + +position = Vector2( 296, 1.19209e-06 ) +scale = Vector2( 78, 1.6 ) +texture = ExtResource( 2 ) +_sections_unfolded = [ "Offset", "Transform" ] + +[node name="Tween" type="Tween" parent="." index="1"] + +repeat = false +playback_process_mode = 1 +playback_speed = 1.0 +playback/active = false +playback/repeat = false +playback/speed = 1.0 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="2"] + +position = Vector2( 296, 0 ) +shape = SubResource( 1 ) +_sections_unfolded = [ "Transform" ] + +[node name="activetimer" type="Timer" parent="." index="3"] + +process_mode = 1 +wait_time = 0.1 +one_shot = true +autostart = true + +[connection signal="body_entered" from="." to="." method="_on_Laser_obj_body_entered"] + +[connection signal="tween_completed" from="Tween" to="." method="_on_Tween_tween_completed"] + +[connection signal="timeout" from="activetimer" to="." method="_on_activetimer_timeout"] + + diff --git a/Wall.gd b/Wall.gd new file mode 100644 index 0000000..f0e727b --- /dev/null +++ b/Wall.gd @@ -0,0 +1,6 @@ +extends Node2D + +# class member variables go here, for example: +# var a = 2 +# var b = "textvar" +signal out_of_bound(wall); diff --git a/Wall.tscn b/Wall.tscn new file mode 100644 index 0000000..426bbb6 --- /dev/null +++ b/Wall.tscn @@ -0,0 +1,61 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://wall.gd" type="Script" id=1] +[ext_resource path="res://art/wall.png" type="Texture" id=2] + +[sub_resource type="RectangleShape2D" id=1] + +custom_solver_bias = 0.0 +extents = Vector2( 29.8667, 16 ) + +[node name="Wall" type="StaticBody2D"] + +input_pickable = false +collision_layer = 1 +collision_mask = 1 +constant_linear_velocity = Vector2( 0, 0 ) +constant_angular_velocity = 0.0 +friction = 1.0 +bounce = 0.0 +script = ExtResource( 1 ) +_sections_unfolded = [ "Transform", "Z Index" ] + +[node name="Sprite" type="Sprite" parent="." index="0"] + +texture = ExtResource( 2 ) +centered = false +_sections_unfolded = [ "Offset" ] +__meta__ = { +"_edit_lock_": true +} + +[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="1"] + +position = Vector2( 32, 16 ) +shape = SubResource( 1 ) +_sections_unfolded = [ "Transform", "Z Index" ] +__meta__ = { +"_edit_lock_": true +} + +[node name="Tween" type="Tween" parent="." index="2"] + +repeat = false +playback_process_mode = 1 +playback_speed = 1.0 +playback/active = false +playback/repeat = false +playback/speed = 1.0 + +[node name="Timer" type="Timer" parent="." index="3"] + +process_mode = 1 +wait_time = 1.0 +one_shot = true +autostart = false + +[connection signal="tween_completed" from="Tween" to="." method="_on_Tween_tween_completed"] + +[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"] + + diff --git a/Wall_Spawner.gd b/Wall_Spawner.gd new file mode 100644 index 0000000..19b8796 --- /dev/null +++ b/Wall_Spawner.gd @@ -0,0 +1,85 @@ +extends Node2D + +# class member variables go here, for example: +# var a = 2 +# var b = "textvar" +signal wall_spawned(gap_pos,gap_size,shift_pos); +signal laser_spawned(pos) + +var prev_pos = 0 +var prev_gap_size = 0 +var active = true + +func _ready(): + # Called when the node is added to the scene for the first time. + # Initialization here + $spawntimer.set_wait_time(1) + $spawntimer.connect("timeout",self, "spawn_wall") + $spawntimer.start() + $lasertimer.set_wait_time(1) + $lasertimer.connect("timeout",self, "spawn_laser") + $lasertimer.start() + + +func toggle_spawner(wall,laser): + if wall: + $spawntimer.start() + else: + $spawntimer.stop() + if laser: + $lasertimer.start() + else: + $lasertimer.stop() + + +func activate_spawner(): + $spawntimer.start() + +func spawn_wall(): + var gap_size = math.randint(0,5) + var shifting = false + if gap_size >1: + shifting = math.randint(1,gap_size)>1 + + var gap_grid_pos + if not prev_pos: + gap_grid_pos = math.randint(5,20) + else: + #gap_grid_pos = prev_pos + pow(-1,math.randint(0,1)) * math.randint(5,15) + if randf() > int(prev_pos/24): + gap_grid_pos = prev_pos + math.randint(7,12) + else: + gap_grid_pos = prev_pos - math.randint(7,15) + gap_grid_pos = math.bound_val(gap_grid_pos,3,24) + + var shift_pos + if shifting: + #print('shift set') + + if randf() > int(gap_grid_pos/24): + shift_pos = gap_grid_pos + math.randint(5,8) + else: + shift_pos = gap_grid_pos - math.randint(5,8) + + shift_pos = math.bound_val(shift_pos,5,24) + else: + shift_pos = gap_grid_pos + + prev_pos = shift_pos + prev_gap_size = gap_size + emit_signal("wall_spawned",Vector2(position.x, gap_grid_pos),gap_size,shift_pos) + #emit_signal("wall_spawned",Vector2(position.x, gap_grid_pos),gap_size,shift_pos) + +func spawn_laser(): + var n_lasers; + if $spawntimer.is_stopped(): + n_lasers = min(math.randint(1,4) + Global.diff_level - 3,8) + else: + n_lasers = math.randint(1,3) + + for i in range(n_lasers): + var grid_pos = math.randint(2,29) + if prev_gap_size<1 and grid_pos == prev_pos: + grid_pos += pow(-1,math.randint(0,1)) + emit_signal("laser_spawned",grid_pos) + \ No newline at end of file diff --git a/Wall_Spawner.tscn b/Wall_Spawner.tscn new file mode 100644 index 0000000..96b3b5e --- /dev/null +++ b/Wall_Spawner.tscn @@ -0,0 +1,28 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://Wall_Spawner.gd" type="Script" id=1] +[ext_resource path="res://icon.png" type="Texture" id=2] + +[node name="Wall_Spawner" type="Node2D"] + +script = ExtResource( 1 ) + +[node name="Sprite" type="Sprite" parent="." index="0"] + +texture = ExtResource( 2 ) + +[node name="spawntimer" type="Timer" parent="." index="1"] + +process_mode = 1 +wait_time = 1.0 +one_shot = false +autostart = false + +[node name="lasertimer" type="Timer" parent="." index="2"] + +process_mode = 1 +wait_time = 1.0 +one_shot = false +autostart = false + + diff --git a/art/beam_frames/laser1.png b/art/beam_frames/laser1.png new file mode 100644 index 0000000..f4baccc Binary files /dev/null and b/art/beam_frames/laser1.png differ diff --git a/art/beam_frames/laser1.png.import b/art/beam_frames/laser1.png.import new file mode 100644 index 0000000..20c86d2 --- /dev/null +++ b/art/beam_frames/laser1.png.import @@ -0,0 +1,29 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/laser1.png-3a8f1aecd0d5e32509ea0f4610006890.stex" + +[deps] + +source_file="res://art/beam_frames/laser1.png" +dest_files=[ "res://.import/laser1.png-3a8f1aecd0d5e32509ea0f4610006890.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/art/beam_frames/laser1.png~ b/art/beam_frames/laser1.png~ new file mode 100644 index 0000000..473f8db Binary files /dev/null and b/art/beam_frames/laser1.png~ differ diff --git a/art/beam_frames/laser2.png b/art/beam_frames/laser2.png new file mode 100644 index 0000000..eebd143 Binary files /dev/null and b/art/beam_frames/laser2.png differ diff --git a/art/beam_frames/laser2.png.import b/art/beam_frames/laser2.png.import new file mode 100644 index 0000000..79c6e16 --- /dev/null +++ b/art/beam_frames/laser2.png.import @@ -0,0 +1,29 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/laser2.png-8f5876c42429477442ec60a0e596b1f2.stex" + +[deps] + +source_file="res://art/beam_frames/laser2.png" +dest_files=[ "res://.import/laser2.png-8f5876c42429477442ec60a0e596b1f2.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/art/beam_frames/laser3.png b/art/beam_frames/laser3.png new file mode 100644 index 0000000..1595dc0 Binary files /dev/null and b/art/beam_frames/laser3.png differ diff --git a/art/beam_frames/laser3.png.import b/art/beam_frames/laser3.png.import new file mode 100644 index 0000000..28243d8 --- /dev/null +++ b/art/beam_frames/laser3.png.import @@ -0,0 +1,29 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/laser3.png-3359a16ea507bb3ba84cb3e5ece414a9.stex" + +[deps] + +source_file="res://art/beam_frames/laser3.png" +dest_files=[ "res://.import/laser3.png-3359a16ea507bb3ba84cb3e5ece414a9.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/art/beam_frames/laser4.png b/art/beam_frames/laser4.png new file mode 100644 index 0000000..b86a3bd Binary files /dev/null and b/art/beam_frames/laser4.png differ diff --git a/art/beam_frames/laser4.png.import b/art/beam_frames/laser4.png.import new file mode 100644 index 0000000..0ecb777 --- /dev/null +++ b/art/beam_frames/laser4.png.import @@ -0,0 +1,29 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/laser4.png-7fa45cf079a8fe2ceb0981f3c6a8e18d.stex" + +[deps] + +source_file="res://art/beam_frames/laser4.png" +dest_files=[ "res://.import/laser4.png-7fa45cf079a8fe2ceb0981f3c6a8e18d.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/art/beam_frames/laser5.png b/art/beam_frames/laser5.png new file mode 100644 index 0000000..1480756 Binary files /dev/null and b/art/beam_frames/laser5.png differ diff --git a/art/beam_frames/laser5.png.import b/art/beam_frames/laser5.png.import new file mode 100644 index 0000000..a1abc7b --- /dev/null +++ b/art/beam_frames/laser5.png.import @@ -0,0 +1,29 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/laser5.png-aaa903cdba8340cc675317fe0fdf7290.stex" + +[deps] + +source_file="res://art/beam_frames/laser5.png" +dest_files=[ "res://.import/laser5.png-aaa903cdba8340cc675317fe0fdf7290.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/art/beam_frames/laser5.png~ b/art/beam_frames/laser5.png~ new file mode 100644 index 0000000..01c35af Binary files /dev/null and b/art/beam_frames/laser5.png~ differ diff --git a/art/beam_frames/laser6.png b/art/beam_frames/laser6.png new file mode 100644 index 0000000..6b4c71f Binary files /dev/null and b/art/beam_frames/laser6.png differ diff --git a/art/beam_frames/laser6.png.import b/art/beam_frames/laser6.png.import new file mode 100644 index 0000000..c645d0e --- /dev/null +++ b/art/beam_frames/laser6.png.import @@ -0,0 +1,29 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/laser6.png-7439aaa3c6999a31603529fcf0b7d749.stex" + +[deps] + +source_file="res://art/beam_frames/laser6.png" +dest_files=[ "res://.import/laser6.png-7439aaa3c6999a31603529fcf0b7d749.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/art/beam_frames/laser7.png b/art/beam_frames/laser7.png new file mode 100644 index 0000000..671a0cc Binary files /dev/null and b/art/beam_frames/laser7.png differ diff --git a/art/beam_frames/laser7.png.import b/art/beam_frames/laser7.png.import new file mode 100644 index 0000000..ebb9472 --- /dev/null +++ b/art/beam_frames/laser7.png.import @@ -0,0 +1,29 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/laser7.png-55229c351bc2ce65850e1ee21f5350c2.stex" + +[deps] + +source_file="res://art/beam_frames/laser7.png" +dest_files=[ "res://.import/laser7.png-55229c351bc2ce65850e1ee21f5350c2.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/art/beam_frames/laser_beam_1.kra b/art/beam_frames/laser_beam_1.kra new file mode 100644 index 0000000..3d0cb14 Binary files /dev/null and b/art/beam_frames/laser_beam_1.kra differ diff --git a/art/bg.kra b/art/bg.kra new file mode 100644 index 0000000..de82aae Binary files /dev/null and b/art/bg.kra differ diff --git a/art/bg.kra~ b/art/bg.kra~ new file mode 100644 index 0000000..ff15113 Binary files /dev/null and b/art/bg.kra~ differ diff --git a/art/bg.png b/art/bg.png new file mode 100644 index 0000000..73ffc47 Binary files /dev/null and b/art/bg.png differ diff --git a/art/bg.png.import b/art/bg.png.import new file mode 100644 index 0000000..6d6af89 --- /dev/null +++ b/art/bg.png.import @@ -0,0 +1,29 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/bg.png-ca4dd02b5a08671d1e8200d74b5e8347.stex" + +[deps] + +source_file="res://art/bg.png" +dest_files=[ "res://.import/bg.png-ca4dd02b5a08671d1e8200d74b5e8347.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/art/bg.png~ b/art/bg.png~ new file mode 100644 index 0000000..911cd66 Binary files /dev/null and b/art/bg.png~ differ diff --git a/art/laser.kra b/art/laser.kra new file mode 100644 index 0000000..93e89be Binary files /dev/null and b/art/laser.kra differ diff --git a/art/laser.kra~ b/art/laser.kra~ new file mode 100644 index 0000000..b8cfe28 Binary files /dev/null and b/art/laser.kra~ differ diff --git a/art/laser_beam.png b/art/laser_beam.png new file mode 100644 index 0000000..71a3744 Binary files /dev/null and b/art/laser_beam.png differ diff --git a/art/laser_beam.png.import b/art/laser_beam.png.import new file mode 100644 index 0000000..c495ff8 --- /dev/null +++ b/art/laser_beam.png.import @@ -0,0 +1,29 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/laser_beam.png-63a193f03d65cacb4399cfdc997d378c.stex" + +[deps] + +source_file="res://art/laser_beam.png" +dest_files=[ "res://.import/laser_beam.png-63a193f03d65cacb4399cfdc997d378c.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/art/laser_beam.png~ b/art/laser_beam.png~ new file mode 100644 index 0000000..41a9351 Binary files /dev/null and b/art/laser_beam.png~ differ diff --git a/art/laser_beam_snim.kra b/art/laser_beam_snim.kra new file mode 100644 index 0000000..2695a83 Binary files /dev/null and b/art/laser_beam_snim.kra differ diff --git a/art/laser_beam_snim.kra~ b/art/laser_beam_snim.kra~ new file mode 100644 index 0000000..8dee1bf Binary files /dev/null and b/art/laser_beam_snim.kra~ differ diff --git a/art/laser_enemy.png b/art/laser_enemy.png new file mode 100644 index 0000000..372a327 Binary files /dev/null and b/art/laser_enemy.png differ diff --git a/art/laser_enemy.png.import b/art/laser_enemy.png.import new file mode 100644 index 0000000..81e3623 --- /dev/null +++ b/art/laser_enemy.png.import @@ -0,0 +1,29 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/laser_enemy.png-a2b286638460418bb5b274fbb29453a0.stex" + +[deps] + +source_file="res://art/laser_enemy.png" +dest_files=[ "res://.import/laser_enemy.png-a2b286638460418bb5b274fbb29453a0.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=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 +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/art/laser_frames/laser_e1.kra b/art/laser_frames/laser_e1.kra new file mode 100644 index 0000000..d4ccefb Binary files /dev/null and b/art/laser_frames/laser_e1.kra differ diff --git a/art/laser_frames/laser_e1.png b/art/laser_frames/laser_e1.png new file mode 100644 index 0000000..897507e Binary files /dev/null and b/art/laser_frames/laser_e1.png differ diff --git a/art/laser_frames/laser_e1.png.import b/art/laser_frames/laser_e1.png.import new file mode 100644 index 0000000..354bf00 --- /dev/null +++ b/art/laser_frames/laser_e1.png.import @@ -0,0 +1,29 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/laser_e1.png-d3424a47d5d7f2c713055d0eec09a4d9.stex" + +[deps] + +source_file="res://art/laser_frames/laser_e1.png" +dest_files=[ "res://.import/laser_e1.png-d3424a47d5d7f2c713055d0eec09a4d9.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/art/laser_frames/laser_e2.png b/art/laser_frames/laser_e2.png new file mode 100644 index 0000000..c7afdf8 Binary files /dev/null and b/art/laser_frames/laser_e2.png differ diff --git a/art/laser_frames/laser_e2.png.import b/art/laser_frames/laser_e2.png.import new file mode 100644 index 0000000..43f4db0 --- /dev/null +++ b/art/laser_frames/laser_e2.png.import @@ -0,0 +1,29 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/laser_e2.png-2f087550b3c5b4c6645c31c52673191b.stex" + +[deps] + +source_file="res://art/laser_frames/laser_e2.png" +dest_files=[ "res://.import/laser_e2.png-2f087550b3c5b4c6645c31c52673191b.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/art/laser_frames/laser_e3.png b/art/laser_frames/laser_e3.png new file mode 100644 index 0000000..c0d15ce Binary files /dev/null and b/art/laser_frames/laser_e3.png differ diff --git a/art/laser_frames/laser_e3.png.import b/art/laser_frames/laser_e3.png.import new file mode 100644 index 0000000..6e97ec9 --- /dev/null +++ b/art/laser_frames/laser_e3.png.import @@ -0,0 +1,29 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/laser_e3.png-50133e74933ab1785ed04c37e330cbd2.stex" + +[deps] + +source_file="res://art/laser_frames/laser_e3.png" +dest_files=[ "res://.import/laser_e3.png-50133e74933ab1785ed04c37e330cbd2.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/art/laser_frames/laser_e4.png b/art/laser_frames/laser_e4.png new file mode 100644 index 0000000..42a0dc1 Binary files /dev/null and b/art/laser_frames/laser_e4.png differ diff --git a/art/laser_frames/laser_e4.png.import b/art/laser_frames/laser_e4.png.import new file mode 100644 index 0000000..2073eaa --- /dev/null +++ b/art/laser_frames/laser_e4.png.import @@ -0,0 +1,29 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/laser_e4.png-3a28c9004ed157751cfc2d65ec0d4968.stex" + +[deps] + +source_file="res://art/laser_frames/laser_e4.png" +dest_files=[ "res://.import/laser_e4.png-3a28c9004ed157751cfc2d65ec0d4968.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/art/laserbeam.kra b/art/laserbeam.kra new file mode 100644 index 0000000..4f7465b Binary files /dev/null and b/art/laserbeam.kra differ diff --git a/art/laserbeam.kra~ b/art/laserbeam.kra~ new file mode 100644 index 0000000..44bf102 Binary files /dev/null and b/art/laserbeam.kra~ differ diff --git a/art/main_menu.kra b/art/main_menu.kra new file mode 100644 index 0000000..910dac4 Binary files /dev/null and b/art/main_menu.kra differ diff --git a/art/main_menu.png b/art/main_menu.png new file mode 100644 index 0000000..5e895ca Binary files /dev/null and b/art/main_menu.png differ diff --git a/art/main_menu.png.import b/art/main_menu.png.import new file mode 100644 index 0000000..49c7366 --- /dev/null +++ b/art/main_menu.png.import @@ -0,0 +1,29 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/main_menu.png-762fdd61d58100d0de812d558e587c2b.stex" + +[deps] + +source_file="res://art/main_menu.png" +dest_files=[ "res://.import/main_menu.png-762fdd61d58100d0de812d558e587c2b.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/art/player.kra b/art/player.kra new file mode 100644 index 0000000..6db56bd Binary files /dev/null and b/art/player.kra differ diff --git a/art/player.kra~ b/art/player.kra~ new file mode 100644 index 0000000..6e62968 Binary files /dev/null and b/art/player.kra~ differ diff --git a/art/player.png b/art/player.png new file mode 100644 index 0000000..3e1d12f Binary files /dev/null and b/art/player.png differ diff --git a/art/player.png.import b/art/player.png.import new file mode 100644 index 0000000..03e6674 --- /dev/null +++ b/art/player.png.import @@ -0,0 +1,29 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/player.png-99d195b4b10a03b7e1088962b50c29f4.stex" + +[deps] + +source_file="res://art/player.png" +dest_files=[ "res://.import/player.png-99d195b4b10a03b7e1088962b50c29f4.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=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 +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/art/player.png~ b/art/player.png~ new file mode 100644 index 0000000..707b374 Binary files /dev/null and b/art/player.png~ differ diff --git a/art/wall.kra b/art/wall.kra new file mode 100644 index 0000000..f629187 Binary files /dev/null and b/art/wall.kra differ diff --git a/art/wall.kra~ b/art/wall.kra~ new file mode 100644 index 0000000..bdcbfd1 Binary files /dev/null and b/art/wall.kra~ differ diff --git a/art/wall.png b/art/wall.png new file mode 100644 index 0000000..2ff0e84 Binary files /dev/null and b/art/wall.png differ diff --git a/art/wall.png.import b/art/wall.png.import new file mode 100644 index 0000000..385eb9c --- /dev/null +++ b/art/wall.png.import @@ -0,0 +1,29 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/wall.png-a390048f5e12dd0b271d636d681186c9.stex" + +[deps] + +source_file="res://art/wall.png" +dest_files=[ "res://.import/wall.png-a390048f5e12dd0b271d636d681186c9.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/art/wall.png~ b/art/wall.png~ new file mode 100644 index 0000000..9cf0ada Binary files /dev/null and b/art/wall.png~ differ diff --git a/blank.gd b/blank.gd new file mode 100644 index 0000000..619f19b --- /dev/null +++ b/blank.gd @@ -0,0 +1,18 @@ +extends Sprite + +# class member variables go here, for example: +# var a = 2 +# var b = "textvar" + +func _ready(): + if Global.return_to_menu: + $Tween.interpolate_property(self, "modulate", + Color(1, 1, 1, 1), Color(1, 1, 1, 0), 0.5, Tween.TRANS_LINEAR, Tween.EASE_IN) + $Tween.start() + Global.return_to_menu = false + else: + modulate = Color(1, 1, 1, 0) +#func _process(delta): +# # Called every frame. Delta is time since last frame. +# # Update game logic here. +# pass diff --git a/build/build.zip b/build/build.zip new file mode 100644 index 0000000..c511cb9 Binary files /dev/null and b/build/build.zip differ diff --git a/build/flat.exe b/build/flat.exe new file mode 100644 index 0000000..e39973a Binary files /dev/null and b/build/flat.exe differ diff --git a/build/flat.pck b/build/flat.pck new file mode 100644 index 0000000..d5ed412 Binary files /dev/null and b/build/flat.pck differ diff --git a/build/flat.x86_64 b/build/flat.x86_64 new file mode 100755 index 0000000..0c1c5d3 Binary files /dev/null and b/build/flat.x86_64 differ diff --git a/build/flat.zip b/build/flat.zip new file mode 100644 index 0000000..d480513 Binary files /dev/null and b/build/flat.zip differ diff --git a/cam.gd b/cam.gd new file mode 100644 index 0000000..40327eb --- /dev/null +++ b/cam.gd @@ -0,0 +1,16 @@ +extends Camera2D + +# class member variables go here, for example: +# var a = 2 +# var b = "textvar" + +func _ready(): + # Called when the node is added to the scene for the first time. + # Initialization here + pass + +func _physics_process(delta): +# # Called every frame. Delta is time since last frame. +# # Update game logic here. + set_offset(get_offset()/2) + pass diff --git a/default_env.tres b/default_env.tres new file mode 100644 index 0000000..ad86b72 --- /dev/null +++ b/default_env.tres @@ -0,0 +1,101 @@ +[gd_resource type="Environment" load_steps=2 format=2] + +[sub_resource type="ProceduralSky" id=1] + +radiance_size = 4 +sky_top_color = Color( 0.0470588, 0.454902, 0.976471, 1 ) +sky_horizon_color = Color( 0.556863, 0.823529, 0.909804, 1 ) +sky_curve = 0.25 +sky_energy = 1.0 +ground_bottom_color = Color( 0.101961, 0.145098, 0.188235, 1 ) +ground_horizon_color = Color( 0.482353, 0.788235, 0.952941, 1 ) +ground_curve = 0.01 +ground_energy = 1.0 +sun_color = Color( 1, 1, 1, 1 ) +sun_latitude = 35.0 +sun_longitude = 0.0 +sun_angle_min = 1.0 +sun_angle_max = 100.0 +sun_curve = 0.05 +sun_energy = 16.0 +texture_size = 2 + +[resource] + +background_mode = 2 +background_sky = SubResource( 1 ) +background_sky_custom_fov = 0.0 +background_color = Color( 0, 0, 0, 1 ) +background_energy = 1.0 +background_canvas_max_layer = 0 +ambient_light_color = Color( 0, 0, 0, 1 ) +ambient_light_energy = 1.0 +ambient_light_sky_contribution = 1.0 +fog_enabled = false +fog_color = Color( 0.5, 0.6, 0.7, 1 ) +fog_sun_color = Color( 1, 0.9, 0.7, 1 ) +fog_sun_amount = 0.0 +fog_depth_enabled = true +fog_depth_begin = 10.0 +fog_depth_curve = 1.0 +fog_transmit_enabled = false +fog_transmit_curve = 1.0 +fog_height_enabled = false +fog_height_min = 0.0 +fog_height_max = 100.0 +fog_height_curve = 1.0 +tonemap_mode = 0 +tonemap_exposure = 1.0 +tonemap_white = 1.0 +auto_exposure_enabled = false +auto_exposure_scale = 0.4 +auto_exposure_min_luma = 0.05 +auto_exposure_max_luma = 8.0 +auto_exposure_speed = 0.5 +ss_reflections_enabled = false +ss_reflections_max_steps = 64 +ss_reflections_fade_in = 0.15 +ss_reflections_fade_out = 2.0 +ss_reflections_depth_tolerance = 0.2 +ss_reflections_roughness = true +ssao_enabled = false +ssao_radius = 1.0 +ssao_intensity = 1.0 +ssao_radius2 = 0.0 +ssao_intensity2 = 1.0 +ssao_bias = 0.01 +ssao_light_affect = 0.0 +ssao_color = Color( 0, 0, 0, 1 ) +ssao_quality = 0 +ssao_blur = 3 +ssao_edge_sharpness = 4.0 +dof_blur_far_enabled = false +dof_blur_far_distance = 10.0 +dof_blur_far_transition = 5.0 +dof_blur_far_amount = 0.1 +dof_blur_far_quality = 1 +dof_blur_near_enabled = false +dof_blur_near_distance = 2.0 +dof_blur_near_transition = 1.0 +dof_blur_near_amount = 0.1 +dof_blur_near_quality = 1 +glow_enabled = false +glow_levels/1 = false +glow_levels/2 = false +glow_levels/3 = true +glow_levels/4 = false +glow_levels/5 = true +glow_levels/6 = false +glow_levels/7 = false +glow_intensity = 0.8 +glow_strength = 1.0 +glow_bloom = 0.0 +glow_blend_mode = 2 +glow_hdr_threshold = 1.0 +glow_hdr_scale = 2.0 +glow_bicubic_upscale = false +adjustment_enabled = false +adjustment_brightness = 1.0 +adjustment_contrast = 1.0 +adjustment_saturation = 1.0 + diff --git a/export_presets.cfg b/export_presets.cfg new file mode 100644 index 0000000..be97cd8 --- /dev/null +++ b/export_presets.cfg @@ -0,0 +1,76 @@ +[preset.0] + +name="Linux/X11" +platform="Linux/X11" +runnable=true +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +patch_list=PoolStringArray( ) + +[preset.0.options] + +texture_format/s3tc=true +texture_format/etc=false +texture_format/etc2=false +binary_format/64_bits=true +custom_template/release="" +custom_template/debug="" + +[preset.1] + +name="Windows Desktop" +platform="Windows Desktop" +runnable=true +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +patch_list=PoolStringArray( ) + +[preset.1.options] + +texture_format/s3tc=true +texture_format/etc=false +texture_format/etc2=false +binary_format/64_bits=true +custom_template/release="" +custom_template/debug="" +application/icon="" +application/file_version="" +application/product_version="" +application/company_name="" +application/product_name="" +application/file_description="" +application/copyright="" +application/trademarks="" + +[preset.2] + +name="Mac OSX" +platform="Mac OSX" +runnable=true +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +patch_list=PoolStringArray( ) + +[preset.2.options] + +custom_package/debug="" +custom_package/release="" +application/name="" +application/info="Made with Godot Engine" +application/icon="" +application/identifier="org.godotengine.macgame" +application/signature="godotmacgame" +application/short_version="1.0" +application/version="1.0" +application/copyright="" +application/bits_mode=0 +display/high_res=false +texture_format/s3tc=true +texture_format/etc=false +texture_format/etc2=false diff --git a/flat_adv.zip b/flat_adv.zip new file mode 100644 index 0000000..0314e51 Binary files /dev/null and b/flat_adv.zip differ diff --git a/gamescene.gd b/gamescene.gd new file mode 100644 index 0000000..ce4c642 --- /dev/null +++ b/gamescene.gd @@ -0,0 +1,107 @@ +extends Node2D + +onready var wall_res = preload("res://Wall.tscn") +onready var laser_e_res = preload("res://Laser_enemy.tscn") +onready var laser_res = preload("res://Laser_obj.tscn") + +onready var screenSize = get_viewport().get_visible_rect().size +# class member variables go here, for example: +# var a = 2 +# var b = "textvar" +var wall_move = false +var shift_time = 0.5 + +func _ready(): + # Called when the node is added to the scene for the first time. + # Initialization here + print(screenSize) + $Wall_Spawner.toggle_spawner(true,false) + #$Wall_Spawner.deactivate_spawner() + pass + +func _process(delta): + if wall_move: + screenshake(16,0.2) + pass + + +func _on_Wall_Spawner_wall_spawned(gap_pos, gap_size, shift_pos): + var topwall = wall_res.instance() + get_node(".").add_child(topwall) + topwall.connect("out_of_bound", self, "despawn_wall") + var bottomwall = wall_res.instance() + get_node(".").add_child(bottomwall) + bottomwall.connect("moving", self, "toggle_screenshake") + bottomwall.connect("out_of_bound", self, "despawn_wall") + + topwall.position = Vector2(gap_pos.x,(gap_pos.y -29-gap_size)*Global.GRID_SIZE) + topwall.set_scale(Vector2(1, 15)) + bottomwall.position = Vector2(gap_pos.x, screenSize.y - (27-gap_pos.y-gap_size)*Global.GRID_SIZE)# + bottomwall.set_scale(Vector2(1, 15)) + + + if shift_pos-gap_pos.y != 0: + topwall.set_shift(shift_time,(shift_pos-gap_pos.y)*Global.GRID_SIZE) + bottomwall.set_shift(shift_time,(shift_pos-gap_pos.y)*Global.GRID_SIZE) + #screenSize.y/Global.GRID_SIZE + +func despawn_wall(wall): + get_node(".").remove_child(wall) + get_tree().queue_delete(wall) + +func shoot_laser(laser_en): + var l = laser_res.instance() + get_node(".").add_child(l) + l.position = Vector2(0,laser_en.position.y) + l.connect("kill_zone",self,"check_laser_target") + despawn_wall(laser_en) + screenshake(32,0.4) + #l.tween_node.connect("tween_completed",self, "despawn_wall",l) +func check_laser_target(body): + #for b in body: + if body == $Player: + + OS.delay_msec(10) + $Player/AnimatedSprite.play() + $Player.dead = true + +func _on_Player_gameover(): + Global.diff_level = 1 + if $Player.score>Global.high_score: + Global.high_score = $Player.score + Global.return_to_menu = true + Global.playable = false + get_tree().change_scene("res://mainmenu.tscn") + + +func _on_Wall_Spawner_laser_spawned(pos): + var l_enemy = laser_e_res.instance() + get_node(".").add_child(l_enemy) + l_enemy.connect("shoot",self,"shoot_laser") + + l_enemy.position = Vector2(screenSize.x-32, pos*Global.GRID_SIZE) + + l_enemy.place_obj(screenSize.x,screenSize.x-32,0.2) + +func toggle_screenshake(state): + wall_move = state + +func screenshake(off,mag): + $cam.set_offset(Vector2( \ + rand_range(-off,off) * mag, \ + rand_range(-off,off) * mag )) + +func _on_leveltimer_timeout(): + Global.diff_level = min(Global.diff_level+1,10) + if Global.diff_level == 2: + $Wall_Spawner.toggle_spawner(false,true) + elif Global.diff_level == 3: + $Wall_Spawner.toggle_spawner(true,true) + else: + if math.randint(0,1): + $Wall_Spawner.toggle_spawner(true,math.randint(0,1)) + else: + $Wall_Spawner.toggle_spawner(false,true) + $Wall_Spawner/spawntimer.set_wait_time(max(1.5-0.15*Global.diff_level,0.7)) + shift_time = max(1-0.1*Global.diff_level,0.3) + diff --git a/gamescene.tscn b/gamescene.tscn new file mode 100644 index 0000000..d24cc88 --- /dev/null +++ b/gamescene.tscn @@ -0,0 +1,110 @@ +[gd_scene load_steps=8 format=2] + +[ext_resource path="res://gamescene.gd" type="Script" id=1] +[ext_resource path="res://art/bg.png" type="Texture" id=2] +[ext_resource path="res://cam.gd" type="Script" id=3] +[ext_resource path="res://player.tscn" type="PackedScene" id=4] +[ext_resource path="res://Wall_Spawner.tscn" type="PackedScene" id=5] +[ext_resource path="res://art/wall.png" type="Texture" id=6] + +[sub_resource type="RectangleShape2D" id=1] + +custom_solver_bias = 0.0 +extents = Vector2( 32, 15.6897 ) + +[node name="Gamescene" type="Node2D" index="0"] + +script = ExtResource( 1 ) + +[node name="bg" type="Sprite" parent="." index="0"] + +position = Vector2( 320, 240 ) +texture = ExtResource( 2 ) +__meta__ = { +"_edit_lock_": true +} + +[node name="cam" type="Camera2D" parent="." index="1"] + +position = Vector2( 296, 240 ) +anchor_mode = 1 +rotating = false +current = true +zoom = Vector2( 1, 1 ) +limit_left = -10000000 +limit_top = -10000000 +limit_right = 10000000 +limit_bottom = 10000000 +limit_smoothed = false +drag_margin_h_enabled = true +drag_margin_v_enabled = true +smoothing_enabled = false +smoothing_speed = 5.0 +offset_v = 0.0 +offset_h = 0.0 +drag_margin_left = 0.2 +drag_margin_top = 0.2 +drag_margin_right = 0.2 +drag_margin_bottom = 0.2 +editor_draw_screen = true +editor_draw_limits = false +editor_draw_drag_margin = false +script = ExtResource( 3 ) + +[node name="Player" parent="." index="2" instance=ExtResource( 4 )] + +position = Vector2( 199.446, 96.3989 ) + +[node name="Wall_Spawner" parent="." index="3" instance=ExtResource( 5 )] + +position = Vector2( 671.423, 111.06 ) + +[node name="fieldwall" type="StaticBody2D" parent="." index="4"] + +editor/display_folded = true +position = Vector2( 320, -16 ) +scale = Vector2( 10.125, 1 ) +input_pickable = false +collision_layer = 1 +collision_mask = 1 +constant_linear_velocity = Vector2( 0, 0 ) +constant_angular_velocity = 0.0 +friction = 1.0 +bounce = 0.0 +__meta__ = { +"_edit_lock_": true +} + +[node name="Sprite" type="Sprite" parent="fieldwall" index="0"] + +texture = ExtResource( 6 ) +_sections_unfolded = [ "Animation", "Transform" ] +__meta__ = { +"_edit_lock_": true +} + +[node name="CollisionShape2D" type="CollisionShape2D" parent="fieldwall" index="1"] + +position = Vector2( 0, -1.67308 ) +scale = Vector2( 1, 0.945607 ) +shape = SubResource( 1 ) +__meta__ = { +"_edit_lock_": true +} + +[node name="leveltimer" type="Timer" parent="." index="5"] + +process_mode = 1 +wait_time = 15.0 +one_shot = false +autostart = true + +[connection signal="gameover" from="Player" to="." method="_on_Player_gameover"] + +[connection signal="laser_spawned" from="Wall_Spawner" to="." method="_on_Wall_Spawner_laser_spawned"] + +[connection signal="wall_spawned" from="Wall_Spawner" to="." method="_on_Wall_Spawner_wall_spawned"] + +[connection signal="timeout" from="leveltimer" to="." method="_on_leveltimer_timeout"] + + diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..a0b64ee Binary files /dev/null and b/icon.png differ diff --git a/icon.png.import b/icon.png.import new file mode 100644 index 0000000..0041ef8 --- /dev/null +++ b/icon.png.import @@ -0,0 +1,29 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" + +[deps] + +source_file="res://icon.png" +dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=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 +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/mainmenu.gd b/mainmenu.gd new file mode 100644 index 0000000..23e5e61 --- /dev/null +++ b/mainmenu.gd @@ -0,0 +1,28 @@ +extends Node2D + +# class member variables go here, for example: +# var a = 2 +# var b = "textvar" +var rot = 0; +func _ready(): + randomize() + # Called when the node is added to the scene for the first time. + # Initialization here + $Spiny/highscore.set_text(str(Global.high_score)) + pass + +func _physics_process(delta): +# # Called every frame. Delta is time since last frame. +# # Update game logic here. + rot += delta + if rot > 2*PI: + rot -= 2*PI + + if Global.playable and Input.is_action_pressed("ui_accept"): + get_tree().change_scene("res://gamescene.tscn") + + $Spiny.set_rotation(rot) + + +func _on_Tween_tween_completed(object, key): + Global.playable = true diff --git a/mainmenu.tscn b/mainmenu.tscn new file mode 100644 index 0000000..a0028f1 --- /dev/null +++ b/mainmenu.tscn @@ -0,0 +1,138 @@ +[gd_scene load_steps=7 format=2] + +[ext_resource path="res://mainmenu.gd" type="Script" id=1] +[ext_resource path="res://art/main_menu.png" type="Texture" id=2] +[ext_resource path="res://art/player.png" type="Texture" id=3] +[ext_resource path="res://Data-Control.ttf" type="DynamicFontData" id=4] +[ext_resource path="res://blank.gd" type="Script" id=5] + +[sub_resource type="DynamicFont" id=1] + +size = 10 +use_mipmaps = false +use_filter = false +font_data = ExtResource( 4 ) +_sections_unfolded = [ "Font", "Settings" ] + +[node name="mainmenu" type="Node2D"] + +script = ExtResource( 1 ) + +[node name="Sprite" type="Sprite" parent="." index="0"] + +position = Vector2( 304, 240 ) +texture = ExtResource( 2 ) +__meta__ = { +"_edit_lock_": true +} + +[node name="Spiny" type="Sprite" parent="." index="1"] + +position = Vector2( 304, 208 ) +scale = Vector2( 3.5, 3.5 ) +texture = ExtResource( 3 ) +_sections_unfolded = [ "Animation", "Offset", "Region" ] +__meta__ = { +"_edit_lock_": true +} + +[node name="highscore" type="Label" parent="Spiny" index="0"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_left = -9.0 +margin_top = -9.0 +margin_right = 9.0 +margin_bottom = 9.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +mouse_filter = 2 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 5 +size_flags_vertical = 4 +custom_fonts/font = SubResource( 1 ) +custom_colors/font_color = Color( 0, 0, 0, 1 ) +text = "0" +align = 1 +valign = 1 +percent_visible = 1.0 +lines_skipped = 0 +max_lines_visible = -1 +_sections_unfolded = [ "Size Flags", "Theme", "custom_colors", "custom_fonts" ] +__meta__ = { +"_edit_lock_": true +} + +[node name="Label" type="Label" parent="." index="2"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_left = 240.0 +margin_top = 288.0 +margin_right = 373.0 +margin_bottom = 302.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +mouse_filter = 2 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 4 +text = "Press Space to Begin" +percent_visible = 1.0 +lines_skipped = 0 +max_lines_visible = -1 +__meta__ = { +"_edit_lock_": true +} + +[node name="blank" type="Sprite" parent="." index="3"] + +position = Vector2( -16, 0 ) +scale = Vector2( 40, 30 ) +texture = ExtResource( 3 ) +centered = false +flip_v = true +script = ExtResource( 5 ) +_sections_unfolded = [ "Offset", "Transform" ] + +[node name="Tween" type="Tween" parent="blank" index="0"] + +repeat = false +playback_process_mode = 1 +playback_speed = 1.0 +playback/active = false +playback/repeat = false +playback/speed = 1.0 + +[node name="Label2" type="Label" parent="." index="4"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_left = 32.0 +margin_top = 416.0 +margin_right = 370.0 +margin_bottom = 498.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +mouse_filter = 2 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 4 +text = "Inspired by: Flappy Bird +Created In: Godot 3 Engine (https://godotengine.org/) +Art: Done In Krita (https://krita.org/en/) +Produced by: En Yi (eyt21@cam.ac.uk) +" +percent_visible = 1.0 +lines_skipped = 0 +max_lines_visible = -1 + +[connection signal="tween_completed" from="blank/Tween" to="." method="_on_Tween_tween_completed"] + + diff --git a/math.gd b/math.gd new file mode 100644 index 0000000..e058be0 --- /dev/null +++ b/math.gd @@ -0,0 +1,44 @@ +extends Node +static func bound_val(val, lower, upper): + return min(max(val,lower),upper) + +static func logistic_func(x, x0=0, k=1): + return 1/(1+pow(1.6,-k*(x - x0))) + +static func randint(lower, upper): + return randi() % (upper - lower + 1) + lower + +static func within_bounds(val, lower, upper, inclusive = true): + if inclusive: + return val<=upper and val>=lower + else: + return vallower + +static func roll_die(n_times=1, n_sides=6): + assert n_times > 0 + assert n_sides >= 1 + var total = 0 + for i in range(n_times): + total += randint(1, n_sides) + return total + +static func random_choice_index(chances): + var sum_chances = 0 + for val in chances: + sum_chances += val + var random_chance = randint(1, sum_chances) + + var running_sum = 0 + var choice = 0 + for w in chances: + running_sum += w + + if random_chance <= running_sum: + return choice + choice += 1 + +static func random_choice_from_dict(choice_dict): + var choices = choice_dict.keys() + var chances = choice_dict.values() + + return choices[random_choice_index(chances)] diff --git a/player.gd b/player.gd new file mode 100644 index 0000000..1c6617b --- /dev/null +++ b/player.gd @@ -0,0 +1,66 @@ +extends KinematicBody2D + +# class member variables go here, for example: +# var a = 2 +# var b = "textvar" +var GRAV = Vector2(0,25); +var JUMP_SPEED = Vector2(0,425); +var vel = Vector2(0,0); +var max_drop = 10; +var dead = false +var leeway = 32 +var score = 0 +var short_hop = false +onready var default_pos = position.x + +signal gameover() + +func _ready(): + # Called when the node is added to the scene for the first time. + # Initialization here + #print(default_pos) + pass + +func _physics_process(delta): +# # Called every frame. Delta is time since last frame. +# # Update game logic here. + if not dead: + vel += GRAV + #move_and_collide(vel) + #var col = move_and_collide(vel) + if Input.is_action_just_pressed("ui_accept"): + #if vel.y>0: + vel = -JUMP_SPEED + short_hop = true + $Jumptimer.start() + if Input.is_action_just_released("ui_accept"): + if short_hop: + vel /= 4 + short_hop = false + $Jumptimer.stop() + #print(vel) + + vel = move_and_slide(vel) + + position.x = lerp(position.x,default_pos,0.005) + + #var col = move_and_collide(vel) + #print(col) + + if position.x< -$Sprite.get_texture().get_size().x-leeway/4 or \ + position.y> get_viewport().get_visible_rect().size.y + $Sprite.get_texture().get_size().y+ leeway: + emit_signal("gameover") + + +func _on_AnimatedSprite_animation_finished(): + emit_signal("gameover") + + +func _on_Timer_timeout(): + if not dead: + score += 1 + $scorelabel.set_text(str(score)) + + +func _on_Jumptimer_timeout(): + short_hop = false diff --git a/player.tscn b/player.tscn new file mode 100644 index 0000000..3747bcd --- /dev/null +++ b/player.tscn @@ -0,0 +1,105 @@ +[gd_scene load_steps=14 format=2] + +[ext_resource path="res://player.gd" type="Script" id=1] +[ext_resource path="res://art/player.png" type="Texture" id=2] +[ext_resource path="res://art/beam_frames/laser1.png" type="Texture" id=3] +[ext_resource path="res://art/beam_frames/laser2.png" type="Texture" id=4] +[ext_resource path="res://art/beam_frames/laser3.png" type="Texture" id=5] +[ext_resource path="res://art/beam_frames/laser4.png" type="Texture" id=6] +[ext_resource path="res://art/beam_frames/laser5.png" type="Texture" id=7] +[ext_resource path="res://art/beam_frames/laser6.png" type="Texture" id=8] +[ext_resource path="res://art/beam_frames/laser7.png" type="Texture" id=9] +[ext_resource path="res://Data-Control.ttf" type="DynamicFontData" id=10] + +[sub_resource type="RectangleShape2D" id=1] + +custom_solver_bias = 0.0 +extents = Vector2( 8, 8 ) + +[sub_resource type="SpriteFrames" id=2] + +animations = [ { +"frames": [ ExtResource( 3 ), ExtResource( 4 ), ExtResource( 5 ), ExtResource( 6 ), ExtResource( 7 ), ExtResource( 8 ), ExtResource( 9 ) ], +"loop": false, +"name": "dead", +"speed": 30.0 +} ] + +[sub_resource type="DynamicFont" id=3] + +size = 14 +use_mipmaps = false +use_filter = false +font_data = ExtResource( 10 ) +_sections_unfolded = [ "Settings" ] + +[node name="Player" type="KinematicBody2D"] + +input_pickable = false +collision_layer = 1 +collision_mask = 1 +collision/safe_margin = 0.08 +script = ExtResource( 1 ) + +[node name="Sprite" type="Sprite" parent="." index="0"] + +visible = false +texture = ExtResource( 2 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="1"] + +shape = SubResource( 1 ) +_sections_unfolded = [ "Transform" ] + +[node name="AnimatedSprite" type="AnimatedSprite" parent="." index="2"] + +frames = SubResource( 2 ) +animation = "dead" + +[node name="Timer" type="Timer" parent="." index="3"] + +process_mode = 1 +wait_time = 0.7 +one_shot = false +autostart = true + +[node name="Jumptimer" type="Timer" parent="." index="4"] + +process_mode = 1 +wait_time = 0.2 +one_shot = true +autostart = false + +[node name="scorelabel" type="Label" parent="." index="5"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_left = -8.0 +margin_top = -8.0 +margin_right = 9.0 +margin_bottom = 8.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +mouse_filter = 2 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 4 +custom_fonts/font = SubResource( 3 ) +custom_colors/font_color = Color( 0, 0, 0, 1 ) +text = "0" +align = 1 +valign = 1 +percent_visible = 1.0 +lines_skipped = 0 +max_lines_visible = -1 +_sections_unfolded = [ "custom_colors", "custom_fonts" ] + +[connection signal="animation_finished" from="AnimatedSprite" to="." method="_on_AnimatedSprite_animation_finished"] + +[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"] + +[connection signal="timeout" from="Jumptimer" to="." method="_on_Jumptimer_timeout"] + + diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..c027f13 --- /dev/null +++ b/project.godot @@ -0,0 +1,53 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + +config_version=3 + +[application] + +config/name="synth" +run/main_scene="res://mainmenu.tscn" +config/icon="res://icon.png" + +[autoload] + +math="*res://math.gd" +Global="*res://Global.gd" + +[display] + +window/size/width=600 +window/size/height=480 +window/size/resizable=false + +[importer_defaults] + +texture={ +"compress/hdr_mode": 0, +"compress/lossy_quality": 0.7, +"compress/mode": 0, +"compress/normal_map": 0, +"detect_3d": false, +"flags/anisotropic": false, +"flags/filter": false, +"flags/mipmaps": false, +"flags/repeat": 0, +"flags/srgb": 2, +"process/HDR_as_SRGB": false, +"process/fix_alpha_border": true, +"process/premult_alpha": false, +"size_limit": 0, +"stream": false, +"svg/scale": 1.0 +} + +[rendering] + +quality/2d/use_pixel_snap=true +environment/default_clear_color=Color( 0.4375, 0.435791, 0.435791, 1 ) +environment/default_environment="res://default_env.tres" diff --git a/wall.gd b/wall.gd new file mode 100644 index 0000000..9900d3c --- /dev/null +++ b/wall.gd @@ -0,0 +1,41 @@ +extends StaticBody2D + +# class member variables go here, for example: +# var a = 2 +# var b = "textvar" +var shift = 0 +#var moving = false +var hspeed = Vector2(-4,0) +onready var tween_node = $Tween +onready var h = $Sprite.get_texture().get_size().y +signal out_of_bound(wall) +signal moving(state); + +func _ready(): + hspeed.x -= min(Global.diff_level*0.5,4) + +func _physics_process(delta): +# # Called every frame. Delta is time since last frame. +# # Update game logic here. +# pass + position += hspeed + #move_and_slide(hspeed) + if position.x< - $Sprite.get_texture().get_size().x: + emit_signal("out_of_bound",self) + +func set_shift(duration, shift): + $Timer.set_wait_time(duration) + self.shift = shift + $Timer.start() + +func _on_Timer_timeout(): + #position.y += shift + emit_signal("moving",true) + tween_node.interpolate_property(self, "position:y", + position.y, position.y + shift, 0.2, Tween.TRANS_LINEAR, Tween.EASE_IN) + tween_node.start() + + +func _on_Tween_tween_completed(object, key): + emit_signal("moving",false) +