begun work on msx off level indicator

This commit is contained in:
pennyrigate 2023-12-26 21:15:04 -05:00
parent 137f5ff414
commit 2774decaf9
10 changed files with 351 additions and 60 deletions

View file

@ -13,8 +13,7 @@ onready var respawn_raycast = $RespawnRaycast
onready var shard_position = $Position2D
onready var start_position = position
onready var blink_timer = $BlinkTimer
onready var text_anim = $TextAnim
onready var cop_detector = $CopDetector
onready var text_anims = $TextAnim
const shard = preload("res://objects/collectibles/shard.tscn")
const BloodSpray := preload("res://objects/environment/blood/blood_spray.tscn")
#DIALOGUE
@ -26,6 +25,11 @@ const fucking_cop = preload("res://audio/sounds/msx_fucking_cop.ogg")
const goddammit = preload("res://audio/sounds/msx_goddammit.ogg")
const motherfucker = preload("res://audio/sounds/msx_motherfucker.ogg")
const shit = preload("res://audio/sounds/msx_shit.ogg")
const death_sounds = [
Audio.a_msx_die,
fuck,
shit
]
func _ready():
raycast.add_exception($Hitbox)
@ -43,14 +47,14 @@ func _physics_process(delta):
if raycast.get_collider().is_in_group("player_hitbox"):
if first_lead == true:
Audio.play_sound(help_me,Audio.ac_voice)
text_anim.play("help me")
text_anims.play("help me")
first_lead = false
is_moving = true
velocity.y += 128 * delta
velocity = move_and_slide_with_snap(velocity, Vector2.DOWN, Vector2.UP, true)
#Anims
if velocity.x == 0:
if !anims.get_current_animation() == "give" && !anims.get_current_animation() == "respawn" && !anims.get_current_animation() == "blink" && !anims.get_current_animation() == "come here" && !anims.get_current_animation() == "help me": anims.play("idle")
if !anims.get_current_animation() == "give" && !anims.get_current_animation() == "respawn" && !anims.get_current_animation() == "blink": anims.play("idle")
else:
anims.play("walk")
#Stop at the end of path and give shard
@ -59,12 +63,10 @@ func _physics_process(delta):
velocity.x = 0
if is_holding_shard:
anims.play("give")
#Cop detector
if cop_detector.is_colliding():
print(cop_detector.get_collider())
func spawn_shard():
Audio.play_sound(here_take_this,Audio.ac_voice)
text_anims.play("here take this")
var ShardInstance = shard.instance()
ShardInstance.global_position = Vector2(shard_position.global_position.x,shard_position.global_position.y)
ShardInstance.number = 1
@ -73,7 +75,7 @@ func spawn_shard():
func switch_action():
Audio.play_sound(come_here,Audio.ac_voice)
anims.play("come here")
text_anims.play("come here")
func spray_blood():
for i in 16:
@ -92,7 +94,7 @@ func die():
death_particles.global_position = global_position
death_particles.emitting = true
spray_blood()
Audio.play_sound(Audio.a_msx_die,Audio.ac_die)
Audio.play_sound(death_sounds[randi() % death_sounds.size()],Audio.ac_voice)
is_moving = false
velocity.x = 0
position = start_position