Skip to content

Commit

Permalink
New & improved flappy mario (a-little-org-called-mario#251)
Browse files Browse the repository at this point in the history
* Flappy mario

* Add ACKNOWLEDGEMENTS

* Add clouds, Add sound effect when entering of exiting a cloud, Changed pipe sprite

* Changed cloud spawn position, Changed cloud size

* Added preset pipes

* Add game over screen, add reset button, add preset clouds, add sound effects

* Fixed merge issue and migrated logic to new inventory system

* Fixed some merge conflict introduced bugs

* Resolved review comment, use _unhandled_input instead of _process

* Add lost controls

* Fixed loss of control when game is over

* Removed dubble coin
  • Loading branch information
SoepIepeI authored Apr 17, 2022
1 parent 18f0429 commit f000cea
Show file tree
Hide file tree
Showing 15 changed files with 408 additions and 60 deletions.
6 changes: 4 additions & 2 deletions localization/loca.csv
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@ ACHIEVEMENT UNLOCKED: %s,ERRUNGENSCHAFT FREIGESCHALTET: %s
GET ALL THE COINS IN LEVEL 0,SAMMLE ALLE MUENZEN IN LEVEL 0
GET ALL THE COINS IN LEVEL 1,SAMMLE ALLE MUENZEN IN LEVEL 1
GET ALL THE COINS IN LEVEL 2,SAMMLE ALLE MUENZEN IN LEVEL 2
SPACE TO [rainbow freq=0.5 sat=1 val=20]FLY UP[/rainbow],LEERTASTE ZUM [rainbow freq=0.5 sat=1 val=20]HOCHFLIEGEN[/rainbow]
"SPACE TO [rainbow freq=0.5 sat=1 val=20]FLY UP[/rainbow]", "LEERTASTE ZUM [rainbow freq=0.5 sat=1 val=20]HOCHFLIEGEN[/rainbow]"
"[rainbow freq=0.5 sat=1 val=20]GAME OVER[/rainbow]", "[rainbow freq=0.5 sat=1 val=20]SPIEL IST AUS[/rainbow]"
"PRESS 'R' TO RESTART", "DRÜCKE 'R', UM NEU ZU STARTEN"
IT'S RAINING COINS! YOU SHOT 10 TIMES!,ES REGNET MÜNZEN! DU HAST 10 MAL GESCHOSSEN!
"HEY PILOT. IT'S ME, LIQUID RANDALL.",
IT LOOKS LIKE SOME NASTY MERGE CONFLICTS ARE BOMBARDING THE REPO PLANET.,
BUT DON'T SWEAT IT- THE NEW AND IMPROVED MARWING CAN TAKE CARE OF IT.,
JUST... FLY AROUND A BIT AND SHOOT THINGS.,
OH! THEY'RE UNMANNED DRONES. IT'S FINE, YOU DON'T HAVE TO FEEL BAD.,
SO GET TO WORK, MY DARLING.,
I BELIEVE IN YOU. YOU CAN DO IT.,
I BELIEVE IN YOU. YOU CAN DO IT.,
2 changes: 1 addition & 1 deletion project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -493,5 +493,5 @@ common/enable_pause_aware_picking=true
[rendering]

2d/snapping/use_gpu_pixel_snap=true
environment/default_clear_color=Color( 0.301961, 0.301961, 0.301961, 1 )
environment/default_clear_color=Color( 0.258824, 0.929412, 1, 1 )
environment/default_environment="res://default_env.tres"
6 changes: 3 additions & 3 deletions scenes/SceneTransition/SceneTransition.gd
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ func _on_change_scene(data):
animation.play("TransitionOut")

func _on_animation_finished(animation_name):
if animation_name == "TransitionOut":
get_tree().change_scene(next_scene)
animation.play("TransitionIn")
if animation_name == "TransitionOut":
get_tree().change_scene(next_scene)
animation.play("TransitionIn")
185 changes: 172 additions & 13 deletions scenes/levels/Flappy/Characters/Obstacles/Pipes.tscn
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=5 format=2]

[ext_resource path="res://sprites/pipe-green.png" type="Texture" id=1]
[ext_resource path="res://sprites/mario_tiles.png" type="Texture" id=1]
[ext_resource path="res://scenes/levels/Flappy/Characters/Obstacles/Obstacle.gd" type="Script" id=2]
[ext_resource path="res://scenes/Coin/Coin.tscn" type="PackedScene" id=3]

[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 24.5, 159.5 )

[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 24, 159 )
extents = Vector2( 23.75, 159.25 )

[node name="center" type="Node2D"]
position = Vector2( 500, 300 )
Expand All @@ -17,23 +14,185 @@ script = ExtResource( 2 )
[node name="Coin" parent="." instance=ExtResource( 3 )]

[node name="pipe_top" type="Area2D" parent="."]
position = Vector2( 0, -200 )
position = Vector2( 0, -65 )

[node name="pipe_end" type="Sprite" parent="pipe_top"]
rotation = -3.14159
texture = ExtResource( 1 )
region_enabled = true
region_rect = Rect2( -0.0676117, 31.7523, 47.9341, 48.3292 )

[node name="pipe" type="Sprite" parent="pipe_top"]
position = Vector2( 0, -38 )
rotation = -3.14159
texture = ExtResource( 1 )
region_enabled = true
region_rect = Rect2( -0.0676117, 51.9004, 47.9341, 28.1811 )

[node name="pipe2" type="Sprite" parent="pipe_top"]
position = Vector2( 0, -38 )
rotation = -3.14159
texture = ExtResource( 1 )
region_enabled = true
region_rect = Rect2( -0.0676117, 51.9004, 47.9341, 28.1811 )

[node name="pipe3" type="Sprite" parent="pipe_top"]
position = Vector2( 0, -66 )
rotation = -3.14159
texture = ExtResource( 1 )
region_enabled = true
region_rect = Rect2( -0.0676117, 51.9004, 47.9341, 28.1811 )

[node name="pipe4" type="Sprite" parent="pipe_top"]
position = Vector2( 0, -94 )
rotation = -3.14159
texture = ExtResource( 1 )
region_enabled = true
region_rect = Rect2( -0.0676117, 51.9004, 47.9341, 28.1811 )

[node name="pipe5" type="Sprite" parent="pipe_top"]
position = Vector2( 0, -122 )
rotation = -3.14159
texture = ExtResource( 1 )
region_enabled = true
region_rect = Rect2( -0.0676117, 51.9004, 47.9341, 28.1811 )

[node name="pipe6" type="Sprite" parent="pipe_top"]
position = Vector2( 0, -150 )
rotation = -3.14159
texture = ExtResource( 1 )
region_enabled = true
region_rect = Rect2( -0.0676117, 51.9004, 47.9341, 28.1811 )

[node name="pipe7" type="Sprite" parent="pipe_top"]
position = Vector2( 0, -178 )
rotation = -3.14159
texture = ExtResource( 1 )
region_enabled = true
region_rect = Rect2( -0.0676117, 51.9004, 47.9341, 28.1811 )

[node name="pipe8" type="Sprite" parent="pipe_top"]
position = Vector2( 0, -206 )
rotation = -3.14159
texture = ExtResource( 1 )
region_enabled = true
region_rect = Rect2( -0.0676117, 51.9004, 47.9341, 28.1811 )

[node name="pipe9" type="Sprite" parent="pipe_top"]
position = Vector2( 0, -234 )
rotation = -3.14159
texture = ExtResource( 1 )
region_enabled = true
region_rect = Rect2( -0.0676117, 51.9004, 47.9341, 28.1811 )

[node name="pipe10" type="Sprite" parent="pipe_top"]
position = Vector2( 0, -262 )
rotation = -3.14159
texture = ExtResource( 1 )
region_enabled = true
region_rect = Rect2( -0.0676117, 51.9004, 47.9341, 28.1811 )

[node name="pipe11" type="Sprite" parent="pipe_top"]
position = Vector2( 0, -290 )
rotation = -3.14159
texture = ExtResource( 1 )
region_enabled = true
region_rect = Rect2( -0.0676117, 51.9004, 47.9341, 28.1811 )

[node name="CollisionShape2D" type="CollisionShape2D" parent="pipe_top"]
position = Vector2( 0.25, -136.25 )
shape = SubResource( 1 )

[node name="pipe_bottom" type="Area2D" parent="."]
position = Vector2( 0, 200 )
[node name="pipe_down" type="Area2D" parent="."]
position = Vector2( 0, 65 )
rotation = 3.14159

[node name="pipe" type="Sprite" parent="pipe_bottom"]
[node name="pipe_end" type="Sprite" parent="pipe_down"]
rotation = -3.14159
texture = ExtResource( 1 )
region_enabled = true
region_rect = Rect2( -0.0676117, 31.7523, 47.9341, 48.3292 )

[node name="CollisionShape2D" type="CollisionShape2D" parent="pipe_bottom"]
shape = SubResource( 2 )
[node name="pipe" type="Sprite" parent="pipe_down"]
position = Vector2( 0, -38 )
rotation = -3.14159
texture = ExtResource( 1 )
region_enabled = true
region_rect = Rect2( -0.0676117, 51.9004, 47.9341, 28.1811 )

[node name="pipe2" type="Sprite" parent="pipe_down"]
position = Vector2( 0, -38 )
rotation = -3.14159
texture = ExtResource( 1 )
region_enabled = true
region_rect = Rect2( -0.0676117, 51.9004, 47.9341, 28.1811 )

[node name="pipe3" type="Sprite" parent="pipe_down"]
position = Vector2( 0, -66 )
rotation = -3.14159
texture = ExtResource( 1 )
region_enabled = true
region_rect = Rect2( -0.0676117, 51.9004, 47.9341, 28.1811 )

[node name="pipe4" type="Sprite" parent="pipe_down"]
position = Vector2( 0, -94 )
rotation = -3.14159
texture = ExtResource( 1 )
region_enabled = true
region_rect = Rect2( -0.0676117, 51.9004, 47.9341, 28.1811 )

[node name="pipe5" type="Sprite" parent="pipe_down"]
position = Vector2( 0, -122 )
rotation = -3.14159
texture = ExtResource( 1 )
region_enabled = true
region_rect = Rect2( -0.0676117, 51.9004, 47.9341, 28.1811 )

[node name="pipe6" type="Sprite" parent="pipe_down"]
position = Vector2( 0, -150 )
rotation = -3.14159
texture = ExtResource( 1 )
region_enabled = true
region_rect = Rect2( -0.0676117, 51.9004, 47.9341, 28.1811 )

[node name="pipe7" type="Sprite" parent="pipe_down"]
position = Vector2( 0, -178 )
rotation = -3.14159
texture = ExtResource( 1 )
region_enabled = true
region_rect = Rect2( -0.0676117, 51.9004, 47.9341, 28.1811 )

[node name="pipe8" type="Sprite" parent="pipe_down"]
position = Vector2( 0, -206 )
rotation = -3.14159
texture = ExtResource( 1 )
region_enabled = true
region_rect = Rect2( -0.0676117, 51.9004, 47.9341, 28.1811 )

[node name="pipe9" type="Sprite" parent="pipe_down"]
position = Vector2( 0, -234 )
rotation = -3.14159
texture = ExtResource( 1 )
region_enabled = true
region_rect = Rect2( -0.0676117, 51.9004, 47.9341, 28.1811 )

[node name="pipe10" type="Sprite" parent="pipe_down"]
position = Vector2( 0, -262 )
rotation = -3.14159
texture = ExtResource( 1 )
region_enabled = true
region_rect = Rect2( -0.0676117, 51.9004, 47.9341, 28.1811 )

[node name="pipe11" type="Sprite" parent="pipe_down"]
position = Vector2( 0, -290 )
rotation = -3.14159
texture = ExtResource( 1 )
region_enabled = true
region_rect = Rect2( -0.0676117, 51.9004, 47.9341, 28.1811 )

[node name="CollisionShape2D" type="CollisionShape2D" parent="pipe_down"]
position = Vector2( 0.25, -136.25 )
shape = SubResource( 1 )

[connection signal="body_entered" from="pipe_top" to="." method="_on_pipe_body_entered"]
[connection signal="body_entered" from="pipe_bottom" to="." method="_on_pipe_body_entered"]
[connection signal="body_entered" from="pipe_down" to="." method="_on_pipe_body_entered"]
6 changes: 5 additions & 1 deletion scenes/levels/Flappy/Characters/Player/PlayerFlying.tscn
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=6 format=2]

[ext_resource path="res://sprites/mario.png" type="Texture" id=1]
[ext_resource path="res://scenes/levels/Flappy/Characters/Player/PlayerFlyingControls.gd" type="Script" id=2]
[ext_resource path="res://audio/sfx/hit.wav" type="AudioStream" id=4]
[ext_resource path="res://scenes/CoinInventoryHandle.tscn" type="PackedScene" id=3]

[sub_resource type="CircleShape2D" id=1]
Expand All @@ -20,4 +21,7 @@ vframes = 2
position = Vector2( 0, 2.5 )
shape = SubResource( 1 )

[node name="CrashAudio" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource( 4 )

[node name="CoinInventoryHandle" parent="." instance=ExtResource( 3 )]
25 changes: 17 additions & 8 deletions scenes/levels/Flappy/Characters/Player/PlayerFlyingControls.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,19 @@ const ASCEND_FORCE = -200
const MAX_ROTATION_UP = -30.0
const MAX_ROTATION_DOWN = 90.0

var inventory = preload("res://scripts/resources/PlayerInventory.tres")

var GAMEOVER = preload("../../UI_flappy_gameover.tscn").instance()
var died = false

# Called when the node enters the scene tree for the first time.
func _ready():
inventory.reset()
EventBus.connect("heart_changed", self, "_on_heart_change")


func _physics_process(_delta: float) -> void:
if Input.is_action_just_pressed("jump"):
if !died && Input.is_action_just_pressed("jump"):
linear_velocity.y = ASCEND_FORCE;
angular_velocity = -10.0

Expand All @@ -25,13 +32,15 @@ func _physics_process(_delta: float) -> void:
angular_velocity = 0

func crash() -> void:
inventory.hearts -= 1
EventBus.emit_signal("heart_changed", {"value": -1})

func gameOver() -> void:
get_tree().reload_current_scene()

func _on_heart_change(_data):
var value = get_node("../UI/UI/HeartCount").count
#one because this is checked before the hearts counter is actually reduced
if value <= 1:
$CrashAudio.play()

var value = inventory.hearts
if value <= 0:
gameOver()

func gameOver() -> void:
get_parent().add_child(GAMEOVER)
died = true
60 changes: 53 additions & 7 deletions scenes/levels/Flappy/Flappy01.tscn
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
[gd_scene load_steps=8 format=2]
[gd_scene load_steps=10 format=2]

[ext_resource path="res://sprites/bg-tile.png" type="Texture" id=1]
[ext_resource path="res://scenes/levels/Flappy/env/env_spawner.gd" type="Script" id=1]
[ext_resource path="res://scenes/levels/Flappy/Characters/Player/PlayerFlying.tscn" type="PackedScene" id=2]
[ext_resource path="res://scenes/levels/Flappy/Characters/Obstacles/ObstacleSpawner.tscn" type="PackedScene" id=3]
[ext_resource path="res://scenes/levels/Flappy/UI_flappy.tscn" type="PackedScene" id=4]
[ext_resource path="res://scenes/levels/Flappy/deathBounds.gd" type="Script" id=5]
[ext_resource path="res://scenes/ui/PauseMenu.tscn" type="PackedScene" id=6]
[ext_resource path="res://scenes/levels/Flappy/Characters/Obstacles/Pipes.tscn" type="PackedScene" id=7]
[ext_resource path="res://scenes/levels/Flappy/env/cloud.tscn" type="PackedScene" id=8]

[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 125, 28 )
Expand All @@ -15,11 +17,6 @@ extents = Vector2( 125, 28 )
[node name="object_spawner" parent="." instance=ExtResource( 3 )]
wait_time = 1.5

[node name="Background" type="Sprite" parent="."]
scale = Vector2( 15.9844, 9.375 )
texture = ExtResource( 1 )
centered = false

[node name="Player_RigidBody" parent="." instance=ExtResource( 2 )]
position = Vector2( 109, 303 )

Expand All @@ -38,4 +35,53 @@ shape = SubResource( 1 )
position = Vector2( 125, -22 )
shape = SubResource( 1 )

[node name="env_spawner" type="Timer" parent="."]
autostart = true
script = ExtResource( 1 )

[node name="preset_pipes" parent="." instance=ExtResource( 7 )]
position = Vector2( 571, 286 )

[node name="preset_pipes2" parent="." instance=ExtResource( 7 )]
position = Vector2( 755, 241 )

[node name="preset_pipes3" parent="." instance=ExtResource( 7 )]
position = Vector2( 954, 296 )

[node name="Cloud" parent="." instance=ExtResource( 8 )]
position = Vector2( 1208, 307 )
scale = Vector2( 4, 4 )
region_rect = Rect2( 144, 47, 64, 33.2776 )
SPEED = -120

[node name="Cloud2" parent="." instance=ExtResource( 8 )]
position = Vector2( 863, 63 )
scale = Vector2( 2, 2 )
SPEED = -140

[node name="Cloud3" parent="." instance=ExtResource( 8 )]
position = Vector2( 931, 78 )
scale = Vector2( 3, 3 )

[node name="Cloud4" parent="." instance=ExtResource( 8 )]
position = Vector2( 724, 403 )
scale = Vector2( 2, 2 )
SPEED = -180

[node name="Cloud6" parent="." instance=ExtResource( 8 )]
position = Vector2( 1379, 151 )
scale = Vector2( 2, 2 )
SPEED = -240

[node name="Cloud7" parent="." instance=ExtResource( 8 )]
position = Vector2( 1408, 141 )
region_rect = Rect2( 1866, -504, 0, 0 )
SPEED = -150

[node name="Cloud5" parent="." instance=ExtResource( 8 )]
position = Vector2( 504, 473 )
scale = Vector2( 3, 3 )
SPEED = -170

[connection signal="body_entered" from="deathBounds" to="deathBounds" method="_on_deathBounds_body_entered"]
[connection signal="timeout" from="env_spawner" to="env_spawner" method="_on_env_spawner_timeout"]
Loading

0 comments on commit f000cea

Please sign in to comment.