diff --git a/FlappyBird/.idea/.idea.FlappyBird/.idea/.gitignore b/FlappyBird/.idea/.idea.FlappyBird/.idea/.gitignore new file mode 100644 index 0000000..62af149 --- /dev/null +++ b/FlappyBird/.idea/.idea.FlappyBird/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/projectSettingsUpdater.xml +/.idea.FlappyBird.iml +/contentModel.xml +/modules.xml +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/FlappyBird/.idea/.idea.FlappyBird/.idea/encodings.xml b/FlappyBird/.idea/.idea.FlappyBird/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/FlappyBird/.idea/.idea.FlappyBird/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/FlappyBird/.idea/.idea.FlappyBird/.idea/indexLayout.xml b/FlappyBird/.idea/.idea.FlappyBird/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/FlappyBird/.idea/.idea.FlappyBird/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/FlappyBird/FlappyBird.csproj b/FlappyBird/FlappyBird.csproj new file mode 100644 index 0000000..db88a8d --- /dev/null +++ b/FlappyBird/FlappyBird.csproj @@ -0,0 +1,5 @@ + + + net472 + + \ No newline at end of file diff --git a/FlappyBird/FlappyBird.sln b/FlappyBird/FlappyBird.sln new file mode 100644 index 0000000..cbcda2f --- /dev/null +++ b/FlappyBird/FlappyBird.sln @@ -0,0 +1,19 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlappyBird", "FlappyBird.csproj", "{AEDC3644-E31C-4017-8BAC-79F4900AFB3F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + ExportDebug|Any CPU = ExportDebug|Any CPU + ExportRelease|Any CPU = ExportRelease|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AEDC3644-E31C-4017-8BAC-79F4900AFB3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AEDC3644-E31C-4017-8BAC-79F4900AFB3F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AEDC3644-E31C-4017-8BAC-79F4900AFB3F}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU + {AEDC3644-E31C-4017-8BAC-79F4900AFB3F}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU + {AEDC3644-E31C-4017-8BAC-79F4900AFB3F}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU + {AEDC3644-E31C-4017-8BAC-79F4900AFB3F}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU + EndGlobalSection +EndGlobal diff --git a/FlappyBird/Ground.tscn b/FlappyBird/Ground.tscn new file mode 100644 index 0000000..ecb7faf --- /dev/null +++ b/FlappyBird/Ground.tscn @@ -0,0 +1,57 @@ +[gd_scene load_steps=5 format=2] + +[ext_resource path="res://assets/textures/ground.png" type="Texture" id=1] +[ext_resource path="res://scripts/Ground.cs" type="Script" id=2] + +[sub_resource type="RectangleShape2D" id=1] +extents = Vector2( 304, 83.2957 ) + +[sub_resource type="Animation" id=2] +resource_name = "GroundMove" +length = 0.5 +loop = true +tracks/0/type = "value" +tracks/0/path = NodePath("Sprite:position") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 0.5 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ Vector2( 252, 772 ), Vector2( 180, 772 ) ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("Sprite2:position") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0, 0.5 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ Vector2( 756, 772 ), Vector2( 684, 772 ) ] +} + +[node name="Ground" type="Area2D"] +script = ExtResource( 2 ) + +[node name="Sprite" type="Sprite" parent="."] +position = Vector2( 180, 772 ) +texture = ExtResource( 1 ) + +[node name="Sprite2" type="Sprite" parent="."] +position = Vector2( 684, 772 ) +texture = ExtResource( 1 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2( 248, 768 ) +shape = SubResource( 1 ) + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +autoplay = "GroundMove" +anims/GroundMove = SubResource( 2 ) + +[connection signal="body_entered" from="." to="." method="_on_Ground_player_entered"] diff --git a/FlappyBird/Menu.tscn b/FlappyBird/Menu.tscn new file mode 100644 index 0000000..5125f41 --- /dev/null +++ b/FlappyBird/Menu.tscn @@ -0,0 +1,56 @@ +[gd_scene load_steps=8 format=2] + +[ext_resource path="res://Player.tscn" type="PackedScene" id=1] +[ext_resource path="res://Ground.tscn" type="PackedScene" id=2] +[ext_resource path="res://assets/textures/background.png" type="Texture" id=3] +[ext_resource path="res://assets/fonts/flappyfont.TTF" type="DynamicFontData" id=4] +[ext_resource path="res://scripts/Menu.cs" type="Script" id=5] +[ext_resource path="res://assets/textures/message.png" type="Texture" id=6] + +[sub_resource type="DynamicFont" id=1] +size = 77 +font_data = ExtResource( 4 ) + +[node name="Menu" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +script = ExtResource( 5 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Background" type="Sprite" parent="."] +texture = ExtResource( 3 ) +centered = false + +[node name="Ground" parent="." instance=ExtResource( 2 )] +position = Vector2( 0, 8 ) + +[node name="Overlay" type="CanvasLayer" parent="."] + +[node name="Score" type="Label" parent="Overlay"] +anchor_left = 0.5 +anchor_right = 0.5 +margin_left = -240.0 +margin_right = 240.0 +margin_bottom = 160.0 +custom_fonts/font = SubResource( 1 ) +custom_colors/font_color_shadow = Color( 0, 0, 0, 1 ) +custom_constants/shadow_offset_x = 2 +custom_constants/shadow_offset_y = 2 +custom_constants/shadow_as_outline = 2 +text = "0" +align = 1 +valign = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Player" parent="." instance=ExtResource( 1 )] +position = Vector2( 72, 427 ) +gravity_scale = 0.0 +script = null + +[node name="Sprite" type="Sprite" parent="."] +position = Vector2( 240, 352 ) +texture = ExtResource( 6 ) diff --git a/FlappyBird/Obstacle.tscn b/FlappyBird/Obstacle.tscn new file mode 100644 index 0000000..03a3e47 --- /dev/null +++ b/FlappyBird/Obstacle.tscn @@ -0,0 +1,41 @@ +[gd_scene load_steps=5 format=2] + +[ext_resource path="res://assets/textures/pipe.png" type="Texture" id=1] +[ext_resource path="res://scripts/Obstacle.cs" type="Script" id=2] + +[sub_resource type="RectangleShape2D" id=1] +extents = Vector2( 39.216, 239.928 ) + +[sub_resource type="RectangleShape2D" id=2] +extents = Vector2( 40, 80 ) + +[node name="Obstacle" type="Area2D"] +position = Vector2( 528, 0 ) +script = ExtResource( 2 ) + +[node name="Pipe" type="Area2D" parent="."] +position = Vector2( 0, 736 ) + +[node name="Sprite" type="Sprite" parent="Pipe"] +texture = ExtResource( 1 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Pipe"] +shape = SubResource( 1 ) + +[node name="Pipe2" type="Area2D" parent="."] +position = Vector2( 0, 96 ) +rotation = 3.14159 + +[node name="Sprite" type="Sprite" parent="Pipe2"] +texture = ExtResource( 1 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Pipe2"] +shape = SubResource( 1 ) + +[node name="Score" type="CollisionShape2D" parent="."] +position = Vector2( 0, 416 ) +shape = SubResource( 2 ) + +[connection signal="body_exited" from="." to="." method="_on_Obstacle_player_exited"] +[connection signal="body_entered" from="Pipe" to="." method="_on_Pipe_player_entered"] +[connection signal="body_entered" from="Pipe2" to="." method="_on_Pipe_player_entered"] diff --git a/FlappyBird/Player.tscn b/FlappyBird/Player.tscn new file mode 100644 index 0000000..37216b4 --- /dev/null +++ b/FlappyBird/Player.tscn @@ -0,0 +1,43 @@ +[gd_scene load_steps=5 format=2] + +[ext_resource path="res://assets/textures/bird.png" type="Texture" id=1] +[ext_resource path="res://scripts/Player.cs" type="Script" id=2] + +[sub_resource type="CapsuleShape2D" id=1] +radius = 17.7871 +height = 18.8992 + +[sub_resource type="Animation" id=2] +resource_name = "Flap" +length = 0.3 +loop = true +tracks/0/type = "value" +tracks/0/path = NodePath("Sprite:frame") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 0.1, 0.2 ), +"transitions": PoolRealArray( 1, 1, 1 ), +"update": 1, +"values": [ 0, 1, 2 ] +} + +[node name="Player" type="RigidBody2D"] +gravity_scale = 5.0 +script = ExtResource( 2 ) + +[node name="Sprite" type="Sprite" parent="."] +texture = ExtResource( 1 ) +hframes = 3 +frame = 1 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2( -1.23744, 0 ) +rotation = 1.5708 +shape = SubResource( 1 ) + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +autoplay = "Flap" +anims/Flap = SubResource( 2 ) diff --git a/FlappyBird/World.tscn b/FlappyBird/World.tscn new file mode 100644 index 0000000..5340e4c --- /dev/null +++ b/FlappyBird/World.tscn @@ -0,0 +1,56 @@ +[gd_scene load_steps=8 format=2] + +[ext_resource path="res://Player.tscn" type="PackedScene" id=1] +[ext_resource path="res://assets/textures/background.png" type="Texture" id=2] +[ext_resource path="res://Ground.tscn" type="PackedScene" id=3] +[ext_resource path="res://assets/textures/gameover.png" type="Texture" id=4] +[ext_resource path="res://assets/fonts/flappyfont.TTF" type="DynamicFontData" id=5] +[ext_resource path="res://scripts/World.cs" type="Script" id=6] + +[sub_resource type="DynamicFont" id=1] +size = 77 +font_data = ExtResource( 5 ) + +[node name="World" type="Node2D"] +script = ExtResource( 6 ) + +[node name="Background" type="Sprite" parent="."] +texture = ExtResource( 2 ) +centered = false + +[node name="Ground" parent="." instance=ExtResource( 3 )] +position = Vector2( 0, 8 ) + +[node name="Overlay" type="CanvasLayer" parent="."] + +[node name="Score" type="Label" parent="Overlay"] +anchor_left = 0.5 +anchor_right = 0.5 +margin_left = -240.0 +margin_right = 240.0 +margin_bottom = 160.0 +custom_fonts/font = SubResource( 1 ) +custom_colors/font_color_shadow = Color( 0, 0, 0, 1 ) +custom_constants/shadow_offset_x = 2 +custom_constants/shadow_offset_y = 2 +custom_constants/shadow_as_outline = 2 +text = "0" +align = 1 +valign = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Timer" type="Timer" parent="."] +wait_time = 1.65 +autostart = true + +[node name="Player" parent="." instance=ExtResource( 1 )] +position = Vector2( 72, 427 ) + +[node name="GameOver" type="Sprite" parent="."] +visible = false +position = Vector2( 232, 384 ) +texture = ExtResource( 4 ) + +[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"] diff --git a/FlappyBird/assets/audio/die.wav b/FlappyBird/assets/audio/die.wav new file mode 100644 index 0000000..9b79fbd Binary files /dev/null and b/FlappyBird/assets/audio/die.wav differ diff --git a/FlappyBird/assets/audio/die.wav.import b/FlappyBird/assets/audio/die.wav.import new file mode 100644 index 0000000..21a19ce --- /dev/null +++ b/FlappyBird/assets/audio/die.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/die.wav-087ffdeea77da2d281dd49bf11cf0272.sample" + +[deps] + +source_file="res://assets/audio/die.wav" +dest_files=[ "res://.import/die.wav-087ffdeea77da2d281dd49bf11cf0272.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/FlappyBird/assets/audio/hit.wav b/FlappyBird/assets/audio/hit.wav new file mode 100644 index 0000000..9d9b77c Binary files /dev/null and b/FlappyBird/assets/audio/hit.wav differ diff --git a/FlappyBird/assets/audio/hit.wav.import b/FlappyBird/assets/audio/hit.wav.import new file mode 100644 index 0000000..045a4fa --- /dev/null +++ b/FlappyBird/assets/audio/hit.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/hit.wav-96dc477cdf4a42f381370dba6e3f75ce.sample" + +[deps] + +source_file="res://assets/audio/hit.wav" +dest_files=[ "res://.import/hit.wav-96dc477cdf4a42f381370dba6e3f75ce.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/FlappyBird/assets/audio/point.wav b/FlappyBird/assets/audio/point.wav new file mode 100644 index 0000000..9cf19fe Binary files /dev/null and b/FlappyBird/assets/audio/point.wav differ diff --git a/FlappyBird/assets/audio/point.wav.import b/FlappyBird/assets/audio/point.wav.import new file mode 100644 index 0000000..e180123 --- /dev/null +++ b/FlappyBird/assets/audio/point.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/point.wav-d840f64e07b7f377e5e25715de9c8870.sample" + +[deps] + +source_file="res://assets/audio/point.wav" +dest_files=[ "res://.import/point.wav-d840f64e07b7f377e5e25715de9c8870.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/FlappyBird/assets/audio/swoosh.wav b/FlappyBird/assets/audio/swoosh.wav new file mode 100644 index 0000000..bcae63e Binary files /dev/null and b/FlappyBird/assets/audio/swoosh.wav differ diff --git a/FlappyBird/assets/audio/swoosh.wav.import b/FlappyBird/assets/audio/swoosh.wav.import new file mode 100644 index 0000000..3bdd4a7 --- /dev/null +++ b/FlappyBird/assets/audio/swoosh.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/swoosh.wav-f1965cef42c3cf734b24307307f51fd3.sample" + +[deps] + +source_file="res://assets/audio/swoosh.wav" +dest_files=[ "res://.import/swoosh.wav-f1965cef42c3cf734b24307307f51fd3.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/FlappyBird/assets/audio/wing.wav b/FlappyBird/assets/audio/wing.wav new file mode 100644 index 0000000..9ae2c67 Binary files /dev/null and b/FlappyBird/assets/audio/wing.wav differ diff --git a/FlappyBird/assets/audio/wing.wav.import b/FlappyBird/assets/audio/wing.wav.import new file mode 100644 index 0000000..1ec3568 --- /dev/null +++ b/FlappyBird/assets/audio/wing.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/wing.wav-14f21070462e312549de62a6e5a3deb4.sample" + +[deps] + +source_file="res://assets/audio/wing.wav" +dest_files=[ "res://.import/wing.wav-14f21070462e312549de62a6e5a3deb4.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/FlappyBird/assets/fonts/flappyfont.TTF b/FlappyBird/assets/fonts/flappyfont.TTF new file mode 100644 index 0000000..6338c19 Binary files /dev/null and b/FlappyBird/assets/fonts/flappyfont.TTF differ diff --git a/FlappyBird/assets/textures/background.png b/FlappyBird/assets/textures/background.png new file mode 100644 index 0000000..5b44e7e Binary files /dev/null and b/FlappyBird/assets/textures/background.png differ diff --git a/FlappyBird/assets/textures/background.png.import b/FlappyBird/assets/textures/background.png.import new file mode 100644 index 0000000..b1fd12a --- /dev/null +++ b/FlappyBird/assets/textures/background.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/background.png-db55ec47224fbca7de3496d6823058f9.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/textures/background.png" +dest_files=[ "res://.import/background.png-db55ec47224fbca7de3496d6823058f9.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=false +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=false +svg/scale=1.0 diff --git a/FlappyBird/assets/textures/bird.png b/FlappyBird/assets/textures/bird.png new file mode 100644 index 0000000..2c2d189 Binary files /dev/null and b/FlappyBird/assets/textures/bird.png differ diff --git a/FlappyBird/assets/textures/bird.png.import b/FlappyBird/assets/textures/bird.png.import new file mode 100644 index 0000000..ac6f689 --- /dev/null +++ b/FlappyBird/assets/textures/bird.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/bird.png-c92121613a657ce6291de8e14467a3aa.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/textures/bird.png" +dest_files=[ "res://.import/bird.png-c92121613a657ce6291de8e14467a3aa.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=false +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=false +svg/scale=1.0 diff --git a/FlappyBird/assets/textures/gameover.png b/FlappyBird/assets/textures/gameover.png new file mode 100644 index 0000000..b3866a5 Binary files /dev/null and b/FlappyBird/assets/textures/gameover.png differ diff --git a/FlappyBird/assets/textures/gameover.png.import b/FlappyBird/assets/textures/gameover.png.import new file mode 100644 index 0000000..7220318 --- /dev/null +++ b/FlappyBird/assets/textures/gameover.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/gameover.png-946e8fcf915159ca3d67a237cc9185d9.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/textures/gameover.png" +dest_files=[ "res://.import/gameover.png-946e8fcf915159ca3d67a237cc9185d9.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=false +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=false +svg/scale=1.0 diff --git a/FlappyBird/assets/textures/ground.png b/FlappyBird/assets/textures/ground.png new file mode 100644 index 0000000..dd69afc Binary files /dev/null and b/FlappyBird/assets/textures/ground.png differ diff --git a/FlappyBird/assets/textures/ground.png.import b/FlappyBird/assets/textures/ground.png.import new file mode 100644 index 0000000..99e20bf --- /dev/null +++ b/FlappyBird/assets/textures/ground.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/ground.png-1c656240c2e4e7695bb1d95ac269a933.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/textures/ground.png" +dest_files=[ "res://.import/ground.png-1c656240c2e4e7695bb1d95ac269a933.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=false +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=false +svg/scale=1.0 diff --git a/FlappyBird/assets/textures/logo.png b/FlappyBird/assets/textures/logo.png new file mode 100644 index 0000000..e46f267 Binary files /dev/null and b/FlappyBird/assets/textures/logo.png differ diff --git a/FlappyBird/assets/textures/logo.png.import b/FlappyBird/assets/textures/logo.png.import new file mode 100644 index 0000000..9576d4f --- /dev/null +++ b/FlappyBird/assets/textures/logo.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/logo.png-0f96317da5ff1739435d5950a05f0dfb.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/textures/logo.png" +dest_files=[ "res://.import/logo.png-0f96317da5ff1739435d5950a05f0dfb.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=false +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=false +svg/scale=1.0 diff --git a/FlappyBird/assets/textures/message.png b/FlappyBird/assets/textures/message.png new file mode 100644 index 0000000..063f051 Binary files /dev/null and b/FlappyBird/assets/textures/message.png differ diff --git a/FlappyBird/assets/textures/message.png.import b/FlappyBird/assets/textures/message.png.import new file mode 100644 index 0000000..f9408b4 --- /dev/null +++ b/FlappyBird/assets/textures/message.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/message.png-2aad12e66983c1700549fd5e505528cb.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/textures/message.png" +dest_files=[ "res://.import/message.png-2aad12e66983c1700549fd5e505528cb.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=false +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=false +svg/scale=1.0 diff --git a/FlappyBird/assets/textures/pipe.png b/FlappyBird/assets/textures/pipe.png new file mode 100644 index 0000000..fe88932 Binary files /dev/null and b/FlappyBird/assets/textures/pipe.png differ diff --git a/FlappyBird/assets/textures/pipe.png.import b/FlappyBird/assets/textures/pipe.png.import new file mode 100644 index 0000000..e8150e6 --- /dev/null +++ b/FlappyBird/assets/textures/pipe.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/pipe.png-a2176cf7a4c88df57e6290aabfe0de3a.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/textures/pipe.png" +dest_files=[ "res://.import/pipe.png-a2176cf7a4c88df57e6290aabfe0de3a.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=false +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=false +svg/scale=1.0 diff --git a/FlappyBird/default_env.tres b/FlappyBird/default_env.tres new file mode 100644 index 0000000..20207a4 --- /dev/null +++ b/FlappyBird/default_env.tres @@ -0,0 +1,7 @@ +[gd_resource type="Environment" load_steps=2 format=2] + +[sub_resource type="ProceduralSky" id=1] + +[resource] +background_mode = 2 +background_sky = SubResource( 1 ) diff --git a/FlappyBird/icon.png b/FlappyBird/icon.png new file mode 100644 index 0000000..c98fbb6 Binary files /dev/null and b/FlappyBird/icon.png differ diff --git a/FlappyBird/icon.png.import b/FlappyBird/icon.png.import new file mode 100644 index 0000000..96cbf46 --- /dev/null +++ b/FlappyBird/icon.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" +metadata={ +"vram_texture": false +} + +[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/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 diff --git a/FlappyBird/project.godot b/FlappyBird/project.godot new file mode 100644 index 0000000..ee138c2 --- /dev/null +++ b/FlappyBird/project.godot @@ -0,0 +1,43 @@ +; 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=4 + +[application] + +config/name="FlappyBird" +run/main_scene="res://Menu.tscn" +config/icon="res://assets/textures/logo.png" + +[display] + +window/size/width=480 +window/size/height=854 +window/handheld/orientation="sensor_portrait" +window/stretch/mode="2d" +window/stretch/aspect="keep" + +[input] + +Click={ +"deadzone": 0.5, +"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) + ] +} + +[input_devices] + +pointing/emulate_touch_from_mouse=true + +[physics] + +common/enable_pause_aware_picking=true + +[rendering] + +environment/default_environment="res://default_env.tres" diff --git a/FlappyBird/scripts/Ground.cs b/FlappyBird/scripts/Ground.cs new file mode 100644 index 0000000..62872a7 --- /dev/null +++ b/FlappyBird/scripts/Ground.cs @@ -0,0 +1,14 @@ +using Godot; +using System; + +public class Ground : Area2D +{ + private void _on_Ground_player_entered(object body) + { + if (body is Player) + { + Player player = body as Player; + player.die(); + } + } +} diff --git a/FlappyBird/scripts/Menu.cs b/FlappyBird/scripts/Menu.cs new file mode 100644 index 0000000..dfb567d --- /dev/null +++ b/FlappyBird/scripts/Menu.cs @@ -0,0 +1,13 @@ +using Godot; +using System; + +public class Menu : Control +{ + public override void _Process(float delta) + { + if (Input.IsActionJustPressed("Click")) + { + GetTree().ChangeScene("res://World.tscn"); + } + } +} diff --git a/FlappyBird/scripts/Obstacle.cs b/FlappyBird/scripts/Obstacle.cs new file mode 100644 index 0000000..dc6a80a --- /dev/null +++ b/FlappyBird/scripts/Obstacle.cs @@ -0,0 +1,36 @@ +using Godot; +using System; + +public class Obstacle : Area2D +{ + private const float moveSpeed = 145f; + + + private void _on_Pipe_player_entered(object body) + { + if (body is Player) + { + Player player = body as Player; + player.die(); + } + } + + private void _on_Obstacle_player_exited(object body) + { + if (body is Player) + { + Player player = body as Player; + player.score_increase(); + } + } + + public override void _PhysicsProcess(float delta) + { + Translate(new Vector2(-moveSpeed * delta, 0)); + + if (Position.x < -200) + { + QueueFree(); + } + } +} diff --git a/FlappyBird/scripts/Player.cs b/FlappyBird/scripts/Player.cs new file mode 100644 index 0000000..0e6deba --- /dev/null +++ b/FlappyBird/scripts/Player.cs @@ -0,0 +1,52 @@ +using Godot; +using System; + +public class Player : RigidBody2D +{ + private const float jumpForce = -225f; + private bool alive = true; + private int score = 0; + private Label labelScore; + private ulong timeDied = 0; + private const int respawnTime = 3; + private Sprite spriteGameOver; + + public override void _Ready() + { + labelScore = GetNode