ADD: some sfx + alarm.

main
bog 2023-10-01 10:33:55 +02:00
parent 728cd1b766
commit 9e8fbafaa8
12 changed files with 269 additions and 36 deletions

View File

@ -4,6 +4,8 @@ class CheckPointData:
var checkpoint_name var checkpoint_name
var player_position var player_position
var strikes: bool = false var strikes: bool = false
var strikes_freq = 5.0
var alarm = false
var music = '' var music = ''
func _init(myname, ppos, mymusic): func _init(myname, ppos, mymusic):
@ -27,10 +29,14 @@ func add_checkpoint(myname, pos, music):
if cp.checkpoint_name == myname: if cp.checkpoint_name == myname:
return return
var strikes = false var strikes = false
var alarm = false
if m_checkpoints.is_empty() == false: if m_checkpoints.is_empty() == false:
strikes = m_checkpoints.back().strikes strikes = m_checkpoints.back().strikes
alarm = m_checkpoints.back().alarm
m_checkpoints.push_back(CheckPointData.new(myname, pos, music)) m_checkpoints.push_back(CheckPointData.new(myname, pos, music))
m_checkpoints.back().strikes = strikes m_checkpoints.back().strikes = strikes
m_checkpoints.back().alarm = alarm
func has_checkpoint(): func has_checkpoint():
return m_checkpoints.is_empty() == false return m_checkpoints.is_empty() == false

20
src/Levels/CanvasAlarm.gd Normal file
View File

@ -0,0 +1,20 @@
extends CanvasLayer
var m_freq = 2
var m_phase = 0.0
var m_alarm_on = false
func _ready():
$ColorRect.visible = false
func _process(delta):
if m_alarm_on:
$ColorRect.visible = true
var t = sin(2 * PI * m_phase)
m_phase += m_freq * delta
$ColorRect.color = Color(1.0, 0.2, 0.2, (1.0 - t) * 0.0 + t * 0.1)
if t >= 0.95:
Music.play_sfx('piew')
else:
$ColorRect.visible = false

View File

@ -6,6 +6,8 @@ func _ready():
var cp = CheckPoint.get_checkpoint() var cp = CheckPoint.get_checkpoint()
$Sandbox/Player/Actor.global_position = cp.player_position $Sandbox/Player/Actor.global_position = cp.player_position
$Sandbox.strike_enabled = cp.strikes $Sandbox.strike_enabled = cp.strikes
$Sandbox/CanvasAlarm.m_alarm_on = cp.alarm
if cp.music != '': if cp.music != '':
Music.play(cp.music) Music.play(cp.music)
else: else:
@ -15,17 +17,30 @@ func _ready():
Hello prisoner, Hello prisoner,
Our spaceship is under attack, but don\'t worry, Our spaceship is under attack, but don\'t worry,
you will be executed at time, as soon as we escape. you will be executed at time, as soon as we escape.
Good luck ! Good luck ! Muhahahahaha
') ')
func _start(): func _start():
pass pass
func _process(_delta): func _process(_delta):
pass $CanvasTime/Label.text = str(round($EndTimer.time_left))
func _on_area_2d_body_entered(_body): func _on_area_2d_body_entered(_body):
$Sandbox.strike_enabled = true $Sandbox.strike_enabled = true
$Sandbox.m_strike_freq = 5.0
$Sandbox/CanvasAlarm.m_alarm_on = true
if CheckPoint.has_checkpoint(): if CheckPoint.has_checkpoint():
CheckPoint.get_checkpoint().strikes = true CheckPoint.get_checkpoint().strikes = true
CheckPoint.get_checkpoint().alarm = true
func _on_area_2d_more_body_entered(_body):
$Sandbox.strike_enabled = true
$Sandbox.m_strike_freq = 1.0
$CanvasTime.visible = true
$EndTimer.start()
if CheckPoint.has_checkpoint():
CheckPoint.get_checkpoint().strikes = true
CheckPoint.get_checkpoint().alarm = true

File diff suppressed because one or more lines are too long

View File

@ -2,7 +2,7 @@ extends Control
func _ready(): func _ready():
pass # Replace with function body. Music.play('novox')
func _process(_delta): func _process(_delta):

BIN
src/Music/explose.wav Normal file

Binary file not shown.

View File

@ -7,15 +7,17 @@ var m_stop_timer = 0.0
var m_stop_time = 0.5 var m_stop_time = 0.5
var m_stop = false var m_stop = false
var m_next = null var m_next = null
var m_sfx_player : AudioStreamPlayer = null
var m_titles = [ var m_titles = [
'fight_or_die' 'fight_or_die'
] ]
func _ready(): func _ready():
m_player = AudioStreamPlayer.new() m_player = AudioStreamPlayer.new()
m_sfx_player = AudioStreamPlayer.new()
m_player.process_mode = Node.PROCESS_MODE_ALWAYS m_player.process_mode = Node.PROCESS_MODE_ALWAYS
add_child(m_player) add_child(m_player)
add_child(m_sfx_player)
func _process(delta): func _process(delta):
if m_stop: if m_stop:
@ -30,6 +32,9 @@ func _process(delta):
m_stop_timer += delta m_stop_timer += delta
func next(music_name): func next(music_name):
if m_player.playing and m_current == music_name:
return
if m_player.playing: if m_player.playing:
m_next = music_name m_next = music_name
m_stop = true m_stop = true
@ -37,7 +42,7 @@ func next(music_name):
play(music_name) play(music_name)
func play(music_name): func play(music_name):
m_player.volume_db = 0.0 m_player.volume_db = -7.0
m_current = music_name m_current = music_name
var data = load("res://Music/" + music_name + ".ogg") var data = load("res://Music/" + music_name + ".ogg")
data.loop = true data.loop = true
@ -45,5 +50,9 @@ func play(music_name):
m_player.seek(0) m_player.seek(0)
m_player.play() m_player.play()
func play_sfx(sfx_name):
m_sfx_player.stream = load("res://Music/" + sfx_name + ".wav")
m_sfx_player.play()
m_sfx_player.volume_db = 5

BIN
src/Music/novox.ogg Normal file

Binary file not shown.

BIN
src/Music/piew.wav Normal file

Binary file not shown.

BIN
src/Music/strike.wav Normal file

Binary file not shown.

View File

@ -9,6 +9,7 @@ var m_death_time = 1.0
var m_strike_time = 1.0 var m_strike_time = 1.0
var m_strike_timer = 0.0 var m_strike_timer = 0.0
var m_strike_freq = 5.0
var m_strikes = [] var m_strikes = []
func _ready(): func _ready():
@ -46,10 +47,11 @@ func process(delta):
ground = t ground = t
break break
if ground: if ground:
Music.play_sfx('strike')
self.add_broken_ground(ground, 1, 0.8) self.add_broken_ground(ground, 1, 0.8)
$Strikes.add_line(to_global($TileMap.map_to_local(ground)), 0.15) $Strikes.add_line(to_global($TileMap.map_to_local(ground)), 0.15)
m_strike_timer = 0.0 m_strike_timer = 0.0
m_strike_time = randf() * 5.0 m_strike_time = randf() * m_strike_freq
m_strike_timer += delta m_strike_timer += delta
if m_broken_timer >= m_broken_time: if m_broken_timer >= m_broken_time:
@ -95,6 +97,7 @@ func throw_bomb(from: Vector2, dir: Vector2, dist: float):
add_child(bomb) add_child(bomb)
func _on_bomb_explode(bomb, _level): func _on_bomb_explode(bomb, _level):
Music.play_sfx("explose")
var tilemap: TileMap = $TileMap var tilemap: TileMap = $TileMap
var pos = tilemap.local_to_map(bomb.position) var pos = tilemap.local_to_map(bomb.position)

View File

@ -1,14 +1,14 @@
[preset.0] [preset.0]
name="Linux/X11" name="macOS"
platform="Linux/X11" platform="macOS"
runnable=true runnable=true
dedicated_server=false dedicated_server=false
custom_features="" custom_features=""
export_filter="all_resources" export_filter="all_resources"
include_filter="" include_filter=""
exclude_filter="" exclude_filter=""
export_path="../../Export/hello.x86_64" export_path="../../Export/aze/hello.zip"
encryption_include_filters="" encryption_include_filters=""
encryption_exclude_filters="" encryption_exclude_filters=""
encrypt_pck=false encrypt_pck=false
@ -16,24 +16,88 @@ encrypt_directory=false
[preset.0.options] [preset.0.options]
export/distribution_type=1
binary_format/architecture="universal"
custom_template/debug="" custom_template/debug=""
custom_template/release="" custom_template/release=""
debug/export_console_wrapper=1 debug/export_console_wrapper=1
binary_format/embed_pck=false application/icon=""
texture_format/bptc=true application/icon_interpolation=4
texture_format/s3tc=true application/bundle_identifier="bog.ld54s"
texture_format/etc=false application/signature=""
texture_format/etc2=false application/app_category="Games"
binary_format/architecture="x86_64" application/short_version="1.0"
application/version=""
application/copyright=""
application/copyright_localized={}
application/min_macos_version="10.12"
display/high_res=true
xcode/platform_build="14C18"
xcode/sdk_version="13.1"
xcode/sdk_build="22C55"
xcode/sdk_name="macosx13.1"
xcode/xcode_version="1420"
xcode/xcode_build="14C18"
codesign/codesign=1
codesign/installer_identity=""
codesign/apple_team_id=""
codesign/identity=""
codesign/entitlements/custom_file=""
codesign/entitlements/allow_jit_code_execution=false
codesign/entitlements/allow_unsigned_executable_memory=false
codesign/entitlements/allow_dyld_environment_variables=false
codesign/entitlements/disable_library_validation=false
codesign/entitlements/audio_input=false
codesign/entitlements/camera=false
codesign/entitlements/location=false
codesign/entitlements/address_book=false
codesign/entitlements/calendars=false
codesign/entitlements/photos_library=false
codesign/entitlements/apple_events=false
codesign/entitlements/debugging=false
codesign/entitlements/app_sandbox/enabled=false
codesign/entitlements/app_sandbox/network_server=false
codesign/entitlements/app_sandbox/network_client=false
codesign/entitlements/app_sandbox/device_usb=false
codesign/entitlements/app_sandbox/device_bluetooth=false
codesign/entitlements/app_sandbox/files_downloads=0
codesign/entitlements/app_sandbox/files_pictures=0
codesign/entitlements/app_sandbox/files_music=0
codesign/entitlements/app_sandbox/files_movies=0
codesign/entitlements/app_sandbox/files_user_selected=0
codesign/entitlements/app_sandbox/helper_executables=[]
codesign/custom_options=PackedStringArray()
notarization/notarization=0
privacy/microphone_usage_description=""
privacy/microphone_usage_description_localized={}
privacy/camera_usage_description=""
privacy/camera_usage_description_localized={}
privacy/location_usage_description=""
privacy/location_usage_description_localized={}
privacy/address_book_usage_description=""
privacy/address_book_usage_description_localized={}
privacy/calendar_usage_description=""
privacy/calendar_usage_description_localized={}
privacy/photos_library_usage_description=""
privacy/photos_library_usage_description_localized={}
privacy/desktop_folder_usage_description=""
privacy/desktop_folder_usage_description_localized={}
privacy/documents_folder_usage_description=""
privacy/documents_folder_usage_description_localized={}
privacy/downloads_folder_usage_description=""
privacy/downloads_folder_usage_description_localized={}
privacy/network_volumes_usage_description=""
privacy/network_volumes_usage_description_localized={}
privacy/removable_volumes_usage_description=""
privacy/removable_volumes_usage_description_localized={}
ssh_remote_deploy/enabled=false ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip" ssh_remote_deploy/host="user@host_ip"
ssh_remote_deploy/port="22" ssh_remote_deploy/port="22"
ssh_remote_deploy/extra_args_ssh="" ssh_remote_deploy/extra_args_ssh=""
ssh_remote_deploy/extra_args_scp="" ssh_remote_deploy/extra_args_scp=""
ssh_remote_deploy/run_script="#!/usr/bin/env bash ssh_remote_deploy/run_script="#!/usr/bin/env bash
export DISPLAY=:0
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\" unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
\"{temp_dir}/{exe_name}\" {cmd_args}" open \"{temp_dir}/{exe_name}.app\" --args {cmd_args}"
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\") kill $(pgrep -x -f \"{temp_dir}/{exe_name}.app/Contents/MacOS/{exe_name} {cmd_args}\")
rm -rf \"{temp_dir}\"" rm -rf \"{temp_dir}\""