From 1afcba119076397237572618d76cba97536208ff Mon Sep 17 00:00:00 2001 From: Elmar-Wiese <74299074+Elmar-Wiese@users.noreply.github.com> Date: Mon, 18 Apr 2022 17:59:30 +0200 Subject: [PATCH] Kaizo lvl (#409) * Add Kaizo level and added reset to normal background music The kaizo level can be done with a triple jump. Used the oh goodness in .asset_donations Don't really know how to * Added Spike png * added spikes to kaizo_lvl * HalveBaseBlox * Added spikes to kaizo level * moved it into the music folder --- .../music}/oh goodness.mp3 | Bin audio/music/oh goodness.mp3.import | 15 ++++++ scenes/boxes/HalveBaseBox.tscn | 48 +++++++++++++++++ scenes/boxes/SpikeBox.tscn | 17 ++++++ scenes/levels/Kaizo/Kaizo.gd | 10 ++++ scenes/levels/Kaizo/Kaizo.tscn | 51 ++++++++++++++++++ scenes/platformer/characters/Player.gd | 3 +- scripts/Main.gd | 13 +++-- scripts/boxes/SpikeBox.gd | 13 +++++ sprites/Spikes.png | Bin 0 -> 590 bytes sprites/Spikes.png.import | 35 ++++++++++++ 11 files changed, 200 insertions(+), 5 deletions(-) rename {.asset_donations => audio/music}/oh goodness.mp3 (100%) create mode 100644 audio/music/oh goodness.mp3.import create mode 100644 scenes/boxes/HalveBaseBox.tscn create mode 100644 scenes/boxes/SpikeBox.tscn create mode 100644 scenes/levels/Kaizo/Kaizo.gd create mode 100644 scenes/levels/Kaizo/Kaizo.tscn create mode 100644 scripts/boxes/SpikeBox.gd create mode 100644 sprites/Spikes.png create mode 100644 sprites/Spikes.png.import diff --git a/.asset_donations/oh goodness.mp3 b/audio/music/oh goodness.mp3 similarity index 100% rename from .asset_donations/oh goodness.mp3 rename to audio/music/oh goodness.mp3 diff --git a/audio/music/oh goodness.mp3.import b/audio/music/oh goodness.mp3.import new file mode 100644 index 000000000..e2af45260 --- /dev/null +++ b/audio/music/oh goodness.mp3.import @@ -0,0 +1,15 @@ +[remap] + +importer="mp3" +type="AudioStreamMP3" +path="res://.import/oh goodness.mp3-cd2ba01ebb3e0c6a69a177f535ad8b80.mp3str" + +[deps] + +source_file="res://audio/music/oh goodness.mp3" +dest_files=[ "res://.import/oh goodness.mp3-cd2ba01ebb3e0c6a69a177f535ad8b80.mp3str" ] + +[params] + +loop=true +loop_offset=0 diff --git a/scenes/boxes/HalveBaseBox.tscn b/scenes/boxes/HalveBaseBox.tscn new file mode 100644 index 000000000..86b35d73b --- /dev/null +++ b/scenes/boxes/HalveBaseBox.tscn @@ -0,0 +1,48 @@ +[gd_scene load_steps=6 format=2] + +[ext_resource path="res://sprites/Spikes.png" type="Texture" id=1] +[ext_resource path="res://audio/sfx/meow.wav" type="AudioStream" id=2] +[ext_resource path="res://scripts/boxes/BaseBox.gd" type="Script" id=3] + +[sub_resource type="RectangleShape2D" id=1] +extents = Vector2( 32, 14.75 ) + +[sub_resource type="RectangleShape2D" id=2] +extents = Vector2( 32, 4 ) + +[node name="halveBaseBox" type="Node2D"] +script = ExtResource( 3 ) + +[node name="box" type="Area2D" parent="."] +position = Vector2( 0, -17 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="box"] +shape = SubResource( 1 ) +one_way_collision_margin = 128.0 + +[node name="Body" type="StaticBody2D" parent="."] +position = Vector2( 0, -17 ) +collision_layer = 2 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Body"] +shape = SubResource( 1 ) +one_way_collision_margin = 128.0 + +[node name="HitArea" type="Area2D" parent="."] +position = Vector2( 0, -1 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="HitArea"] +position = Vector2( 0, -3 ) +shape = SubResource( 2 ) +one_way_collision_margin = 128.0 + +[node name="Sprite" type="Sprite" parent="."] +z_index = 10 +texture = ExtResource( 1 ) + +[node name="Tween" type="Tween" parent="."] + +[node name="MeowStream" type="AudioStreamPlayer2D" parent="."] +position = Vector2( 0, -14 ) +stream = ExtResource( 2 ) +bus = "sfx" diff --git a/scenes/boxes/SpikeBox.tscn b/scenes/boxes/SpikeBox.tscn new file mode 100644 index 000000000..a4bad0feb --- /dev/null +++ b/scenes/boxes/SpikeBox.tscn @@ -0,0 +1,17 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://scenes/boxes/HalveBaseBox.tscn" type="PackedScene" id=1] +[ext_resource path="res://scripts/boxes/SpikeBox.gd" type="Script" id=3] + +[node name="SpikeBox" instance=ExtResource( 1 )] +position = Vector2( 0, -3 ) +script = ExtResource( 3 ) + +[node name="HitArea" parent="." index="2"] +position = Vector2( 0, 0 ) + +[node name="CollisionShape2D" parent="HitArea" index="0"] +position = Vector2( 0, -4 ) + +[node name="MeowStream" parent="." index="5"] +position = Vector2( 0, -17 ) diff --git a/scenes/levels/Kaizo/Kaizo.gd b/scenes/levels/Kaizo/Kaizo.gd new file mode 100644 index 000000000..16ced248a --- /dev/null +++ b/scenes/levels/Kaizo/Kaizo.gd @@ -0,0 +1,10 @@ +extends TileMap + + +func _ready(): + EventBus.emit_signal("bgm_changed", get_node("AudioStreamPlayer")) + + +func _exit_tree(): + EventBus.emit_signal("bgm_changed", "reset") + diff --git a/scenes/levels/Kaizo/Kaizo.tscn b/scenes/levels/Kaizo/Kaizo.tscn new file mode 100644 index 000000000..77de15f10 --- /dev/null +++ b/scenes/levels/Kaizo/Kaizo.tscn @@ -0,0 +1,51 @@ +[gd_scene load_steps=9 format=2] + +[ext_resource path="res://scenes/levels/TileSet.tres" type="TileSet" id=1] +[ext_resource path="res://sprites/bg-tile.png" type="Texture" id=2] +[ext_resource path="res://scenes/EndPortal.tscn" type="PackedScene" id=3] +[ext_resource path="res://scenes/title/Background.gd" type="Script" id=4] +[ext_resource path="res://scenes/SpawnPoint.tscn" type="PackedScene" id=5] +[ext_resource path="res://audio/music/oh goodness.mp3" type="AudioStream" id=6] +[ext_resource path="res://scenes/levels/Kaizo/Kaizo.gd" type="Script" id=7] +[ext_resource path="res://scenes/boxes/SpikeBox.tscn" type="PackedScene" id=8] + +[node name="TileMap2" type="TileMap"] +tile_set = ExtResource( 1 ) +collision_layer = 2 +format = 1 +tile_data = PoolIntArray( 8, 0, 0, 9, 0, 0, 10, 0, 0, 11, 0, 0, 12, 0, 0, 13, 0, 0, 14, 0, 0, 15, 0, 0, 16, 0, 0, 65544, 0, 0, 65545, 1, 0, 65546, 1, 0, 65547, 1, 0, 65548, 0, 0, 65549, 1, 0, 65550, 1, 0, 65551, 1, 0, 65552, 0, 0, 131080, 0, 0, 131081, 1, 0, 131082, 1, 0, 131083, 1, 0, 131084, 1, 0, 131085, 1, 0, 131086, 1, 0, 131087, 1, 0, 131088, 0, 0, 196616, 0, 0, 196617, 1, 0, 196618, 1, 0, 196619, 1, 0, 196620, 0, 0, 196621, 1, 0, 196622, 1, 0, 196623, 1, 0, 196624, 0, 0, 262152, 0, 0, 262153, 1, 0, 262154, 1, 0, 262155, 1, 0, 262156, 0, 0, 262157, 0, 0, 262158, 0, 0, 262159, 0, 0, 262160, 0, 0, 327688, 0, 0, 327689, 1, 0, 327690, 1, 0, 327691, 1, 0, 327692, 0, 0, 327693, 0, 0, 327694, 0, 0, 327695, 0, 0, 327696, 0, 0, 393224, 0, 0, 393225, 1, 0, 393226, 1, 0, 393227, 1, 0, 393228, 0, 0, 393229, 0, 0, 393230, 0, 0, 393231, 0, 0, 393232, 0, 0, 458760, 0, 0, 458761, 1, 0, 458762, 1, 0, 458763, 1, 0, 458764, 0, 0, 458765, 0, 0, 458766, 0, 0, 458767, 0, 0, 458768, 0, 0, 524296, 0, 0, 524297, 1, 0, 524298, 1, 0, 524299, 1, 0, 524300, 0, 0, 524301, 0, 0, 524302, 0, 0, 524303, 0, 0, 524304, 0, 0, 589832, 0, 0, 589833, 0, 0, 589834, 0, 0, 589835, 0, 0, 589836, 0, 0, 589837, 0, 0, 589838, 0, 0, 589839, 0, 0, 589840, 0, 0 ) +script = ExtResource( 7 ) + +[node name="EndPortal" parent="." instance=ExtResource( 3 )] +position = Vector2( 929, 156 ) + +[node name="SpawnPoint2" parent="." instance=ExtResource( 5 )] +position = Vector2( 669, 483 ) + +[node name="Background2" type="Sprite" parent="."] +modulate = Color( 0.7, 0.7, 0.7, 1 ) +position = Vector2( -433, -225 ) +z_index = -1 +texture = ExtResource( 2 ) +centered = false +region_enabled = true +region_rect = Rect2( 0, 0, 1920, 1080 ) +script = ExtResource( 4 ) +__meta__ = { +"_edit_lock_": true +} + +[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] +stream = ExtResource( 6 ) +volume_db = -5.0 +autoplay = true +bus = "music" + +[node name="SpikeBox" parent="." instance=ExtResource( 8 )] +position = Vector2( 608, 98 ) + +[node name="SpikeBox2" parent="." instance=ExtResource( 8 )] +position = Vector2( 672, 98 ) + +[node name="SpikeBox3" parent="." instance=ExtResource( 8 )] +position = Vector2( 736, 98 ) diff --git a/scenes/platformer/characters/Player.gd b/scenes/platformer/characters/Player.gd index 5f6406eba..af3a89a3b 100644 --- a/scenes/platformer/characters/Player.gd +++ b/scenes/platformer/characters/Player.gd @@ -233,11 +233,12 @@ func jump(): EventBus.emit_signal("jumping") -func super_jump(): +func super_jump(): super_jump_timer = 0 stats.jump_xp += 1 stats.acrobatics += 1 tween.stop_all() + set_hitbox_crouching(false) stretch(0.2, 0, 1.0, 2.5) y_motion.set_speed(JUMPFORCE * -100) anticipating_jump = false diff --git a/scripts/Main.gd b/scripts/Main.gd index 18db2be9c..a30d947f0 100644 --- a/scripts/Main.gd +++ b/scripts/Main.gd @@ -9,6 +9,7 @@ onready var hub: TileMap = $TileMap onready var level: Node = $TileMap onready var bgm: AudioStreamPlayer = $Audio/BGM onready var ui: CanvasLayer = $UI +onready var defaultBGMStream : AudioStream = bgm.stream.duplicate() var completionSound = preload("res://audio/sfx/portal.wav") var coinSound = preload("res://audio/sfx/coin.wav") @@ -33,10 +34,14 @@ func _on_ui_visibility_changed(data): func _bgm_changed(data) -> void: - if "playing" in data: - bgm.playing = data.playing - if "stream" in data: - bgm.stream = data.stream + if typeof(data) == TYPE_STRING and data == "reset": + bgm.stream = defaultBGMStream + bgm.playing = true + else: + if "playing" in data: + bgm.playing = data.playing + if "stream" in data: + bgm.stream = data.stream func _hook_portals() -> void: diff --git a/scripts/boxes/SpikeBox.gd b/scripts/boxes/SpikeBox.gd new file mode 100644 index 000000000..b681b4e01 --- /dev/null +++ b/scripts/boxes/SpikeBox.gd @@ -0,0 +1,13 @@ +extends BaseBox + + +var inventory = preload("res://scripts/resources/PlayerInventory.tres") + +func bounce(body: KinematicBody2D): + on_bounce(body) + if not body is Player: + return + + audio_meow.play() + EventBus.emit_signal("heart_changed", {"value": -inventory.hearts}) + diff --git a/sprites/Spikes.png b/sprites/Spikes.png new file mode 100644 index 0000000000000000000000000000000000000000..f75b1bef45d63895eb2f0af97f66cafec74a4dbc GIT binary patch literal 590 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1quc4Uaut978JN-p)Ml#cU{WY;sxX3&%Yok+lqo zd&TqZdKA7$R(*PA%wgyA@zGW1iSuk;ZG7Hpc5cb!P1nA}i{%{uTPL7)J8z%b<+&$Y zwjPskU%PS35i>Chhn!^3!UI!oW!y8BzY_9X;Pt!rb0pip<~*w{I`V8$MfJ}w@&cMt zCi8?pG}UIRv^tc2yyeIza63ZkJ;QvLZN73Fj|g8_)hJMK&ee7&_bk(>YqxH-_N4U+ zFdcvPDr#5ZwWD(v1SP*~_?Yo5S9VHP1^bPM+Sk8ty|C(_=Z8tRcE+eLj68g)!R)4_ z`h?Kx7t3~BUUP8wfhp`KN`+>b25@wKy|Fx9`lgdw(srlW$BwBtBt6TCy_0)bFxG`lZ-qDPNncj*LW+ZNqrGH*(aWWaU6fxjSOwI0noH_Rl^ICPc~Tiy zW+l6Bsc+=8W%u7(msdY-`US5l7#rRJEzIYo46h;cs#2gpjF|&nCB5HexE7 zKk`_FI%vHt>Q2-ne|`=^M@TE2~Sr)mvv4FO#nJw1b+Yk literal 0 HcmV?d00001 diff --git a/sprites/Spikes.png.import b/sprites/Spikes.png.import new file mode 100644 index 000000000..396220104 --- /dev/null +++ b/sprites/Spikes.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Spikes.png-74291f56ae13d23045f77f35df84afea.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://sprites/Spikes.png" +dest_files=[ "res://.import/Spikes.png-74291f56ae13d23045f77f35df84afea.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 +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0