Skip to content

Commit

Permalink
Add new sound and other improvements for bus (#526)
Browse files Browse the repository at this point in the history
* New bus drive and idle sounds

* Fix skidding for bus

* Add hitbox collision shape for bus

* Add hit flash ShaderMaterial to bus
  • Loading branch information
captaincolonelfox authored Jul 16, 2022
1 parent 850574b commit 905d329
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 19 deletions.
1 change: 1 addition & 0 deletions ACKNOWLEDGEMENTS
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Fireball Shoot Sound: Jacob Posten
FireFlower Sprite: Jacob Posten
Platform Sprite: https://hawier.itch.io/hawier-platformer-pack
Bus Sprite: https://www.pngpix.com/download/bus-png-transparent-image
Bus Sounds: https://freesound.org/people/MarlonHJ/sounds/
Pipe Sprite: https://github.com/samuelcust/flappy-bird-assets
Sign: Nemisys
Food Sprite (sprites/food.png): https://opengameart.org/content/cc0-food-icons CC0 (public domain)
Expand Down
Binary file added audio/sfx/bus/engine_drive_sound.wav
Binary file not shown.
21 changes: 21 additions & 0 deletions audio/sfx/bus/engine_drive_sound.wav.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[remap]

importer="wav"
type="AudioStreamSample"
path="res://.import/engine_drive_sound.wav-57f5ee3e9a4a50fa326133b77a6d44b4.sample"

[deps]

source_file="res://audio/sfx/bus/engine_drive_sound.wav"
dest_files=[ "res://.import/engine_drive_sound.wav-57f5ee3e9a4a50fa326133b77a6d44b4.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=true
compress/mode=0
Binary file added audio/sfx/bus/engine_idle_sound.wav
Binary file not shown.
21 changes: 21 additions & 0 deletions audio/sfx/bus/engine_idle_sound.wav.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[remap]

importer="wav"
type="AudioStreamSample"
path="res://.import/engine_idle_sound.wav-94f347e5bb114145c0b65f2fb6b70eba.sample"

[deps]

source_file="res://audio/sfx/bus/engine_idle_sound.wav"
dest_files=[ "res://.import/engine_idle_sound.wav-94f347e5bb114145c0b65f2fb6b70eba.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=true
compress/mode=0
6 changes: 4 additions & 2 deletions scenes/platformer/characters/Bus.gd
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
extends AnimatedSprite

export(NodePath) var collision_shape: NodePath
export(NodePath) onready var hitbox_collision = get_node(hitbox_collision) as CollisionShape2D

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

Expand Down Expand Up @@ -44,6 +45,7 @@ func _activate_bus(active: bool) -> void:

# Collision
collision.disabled = !active
hitbox_collision.disabled = !active
player.collision.disabled = active
set_process(active)
inventory.has_bus = active # does nothing if already active.
Expand All @@ -69,12 +71,12 @@ func _set_state(newState):
if (newState == busState.RESTING):
animation = "standing"
playing = true
resting_sound.playing = true # When more state sounds are added that continuously should play
resting_sound.play(resting_sound.get_playback_position()) # When more state sounds are added that continuously should play
moving_sound.playing = false # make all the sounds a dictionary.
if (newState == busState.MOVING):
animation = "driving"
playing = true
moving_sound.playing = true
moving_sound.play(moving_sound.get_playback_position())
resting_sound.playing = false
state = newState

Expand Down
4 changes: 2 additions & 2 deletions scenes/platformer/characters/Player.gd
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func _physics_process(delta: float) -> void:


# skids until a little before you're moving in the opposite direction to give a run up.
skidding_force = SKIDTHRESHOLD - (x_motion.max_speed * 1.2)
skidding_force = (SKIDTHRESHOLD * powerupspeed) - (x_motion.max_speed * 1.2)
jerk_modifier = 3
animationSpeed = 6
anim.playback_speed = animationSpeed
Expand Down Expand Up @@ -135,7 +135,7 @@ func _physics_process(delta: float) -> void:
if skidding:
anim.playAnim("Skid")

$SkidSFX.volume_db = abs(x_motion.get_speed()) * 0.02
$SkidSFX.volume_db = clamp(abs(x_motion.get_speed()) * 0.02, 0, 10)
$SkidSFX.playing = skidding

jump_buffer_timer -= delta
Expand Down
16 changes: 13 additions & 3 deletions scenes/platformer/characters/Player.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=65 format=2]
[gd_scene load_steps=67 format=2]

[ext_resource path="res://scenes/platformer/characters/RunParticles.gd" type="Script" id=1]
[ext_resource path="res://sprites/mario.png" type="Texture" id=2]
Expand All @@ -18,8 +18,8 @@
[ext_resource path="res://scripts/BouncyMoustache.gd" type="Script" id=16]
[ext_resource path="res://scenes/CameraFCandidate.gd" type="Script" id=17]
[ext_resource path="res://sprites/fireball.png" type="Texture" id=18]
[ext_resource path="res://audio/music/givehimagun.mp3" type="AudioStream" id=19]
[ext_resource path="res://audio/music/dramaticgamemusic.mp3" type="AudioStream" id=20]
[ext_resource path="res://audio/sfx/bus/engine_drive_sound.wav" type="AudioStream" id=19]
[ext_resource path="res://audio/sfx/bus/engine_idle_sound.wav" type="AudioStream" id=20]
[ext_resource path="res://sprites/blunt.png" type="Texture" id=21]
[ext_resource path="res://audio/sfx/toasty.wav" type="AudioStream" id=22]
[ext_resource path="res://audio/sfx/jump.wav" type="AudioStream" id=23]
Expand All @@ -32,6 +32,9 @@
[sub_resource type="RectangleShape2D" id=44]
extents = Vector2( 24, 28 )

[sub_resource type="RectangleShape2D" id=48]
extents = Vector2( 56, 25 )

[sub_resource type="Curve" id=11]
_data = [ Vector2( 0, 0 ), 0.0, 2.49311, 0, 0, Vector2( 1, 1 ), 0.329092, 0.0, 0, 0 ]

Expand Down Expand Up @@ -272,6 +275,11 @@ collision_mask = 24
[node name="CollisionShape2D" parent="Hitbox" index="0"]
shape = SubResource( 44 )

[node name="BusCollisionShape" type="CollisionShape2D" parent="Hitbox"]
position = Vector2( 0, 7 )
shape = SubResource( 48 )
disabled = true

[node name="Trail" type="Line2D" parent="."]
width = 30.0
width_curve = SubResource( 11 )
Expand Down Expand Up @@ -459,13 +467,15 @@ script = ExtResource( 1 )

[node name="BusSprite" type="AnimatedSprite" parent="Pivot"]
visible = false
material = SubResource( 15 )
position = Vector2( 0, 4 )
scale = Vector2( 0.767105, 0.725 )
frames = SubResource( 41 )
animation = "standing"
flip_h = true
script = ExtResource( 11 )
collision_shape = NodePath("../../BusCollision")
hitbox_collision = NodePath("../../Hitbox/BusCollisionShape")

[node name="Horn" type="AudioStreamPlayer" parent="Pivot/BusSprite"]
stream = ExtResource( 22 )
Expand Down
24 changes: 12 additions & 12 deletions scenes/powerups/Bus.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 24.5, 11.25 )

[sub_resource type="AtlasTexture" id=6]
atlas = ExtResource( 4 )
region = Rect2( 0, 0, 175, 82 )

[sub_resource type="AtlasTexture" id=7]
atlas = ExtResource( 4 )
region = Rect2( 175, 0, 175, 82 )

[sub_resource type="AtlasTexture" id=2]
atlas = ExtResource( 3 )
region = Rect2( 0, 0, 190, 80 )
Expand All @@ -32,16 +24,24 @@ region = Rect2( 380, 0, 190, 80 )
atlas = ExtResource( 3 )
region = Rect2( 570, 0, 190, 80 )

[sub_resource type="AtlasTexture" id=6]
atlas = ExtResource( 4 )
region = Rect2( 0, 0, 175, 82 )

[sub_resource type="AtlasTexture" id=7]
atlas = ExtResource( 4 )
region = Rect2( 175, 0, 175, 82 )

[sub_resource type="SpriteFrames" id=8]
animations = [ {
"frames": [ SubResource( 6 ), SubResource( 7 ) ],
"frames": [ SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ) ],
"loop": true,
"name": "standing",
"name": "driving",
"speed": 5.0
}, {
"frames": [ SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ) ],
"frames": [ SubResource( 6 ), SubResource( 7 ) ],
"loop": true,
"name": "driving",
"name": "standing",
"speed": 5.0
} ]

Expand Down

1 comment on commit 905d329

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.