generated from krampus/template-godot4
MP3 player has force feedback
All checks were successful
linting & formatting / build (push) Successful in 24s
All checks were successful
linting & formatting / build (push) Successful in 24s
This commit is contained in:
parent
36e5bcf099
commit
dc26836020
@ -1,8 +1,12 @@
|
|||||||
extends Tool
|
extends Tool
|
||||||
## Pump up the jamz!
|
## Pump up the jamz!
|
||||||
|
|
||||||
|
const RUMBLE_INTENSITY = 0.006
|
||||||
|
const RUMBLE_DROPOFF = 0.8
|
||||||
|
|
||||||
@onready var mp3_controller: MP3Controller = %MP3Controller
|
@onready var mp3_controller: MP3Controller = %MP3Controller
|
||||||
@onready var audio_stream_player: AudioStreamPlayer = %AudioStreamPlayer
|
@onready var audio_stream_player: AudioStreamPlayer = %AudioStreamPlayer
|
||||||
|
@onready var rumbler: Rumbler3D = %Rumbler
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
@ -16,13 +20,20 @@ func unlocked() -> bool:
|
|||||||
func fire() -> void:
|
func fire() -> void:
|
||||||
if not firing:
|
if not firing:
|
||||||
firing = true
|
firing = true
|
||||||
|
rumbler.intensity = RUMBLE_INTENSITY
|
||||||
mp3_controller.select()
|
mp3_controller.select()
|
||||||
|
|
||||||
|
|
||||||
func switch_mode() -> void:
|
func switch_mode() -> void:
|
||||||
|
rumbler.intensity = RUMBLE_INTENSITY
|
||||||
mp3_controller.cancel()
|
mp3_controller.cancel()
|
||||||
|
|
||||||
|
|
||||||
|
func _physics_process(delta: float) -> void:
|
||||||
|
rumbler.intensity *= RUMBLE_DROPOFF
|
||||||
|
super._physics_process(delta)
|
||||||
|
|
||||||
|
|
||||||
func _on_mp3_collected(_track: MP3Track) -> void:
|
func _on_mp3_collected(_track: MP3Track) -> void:
|
||||||
# TODO we may want to dynamically build the player tracklist
|
# TODO we may want to dynamically build the player tracklist
|
||||||
# rather than rebuilding the whole thing each time a track is collected
|
# rather than rebuilding the whole thing each time a track is collected
|
||||||
|
Loading…
x
Reference in New Issue
Block a user