class_name GirlMob extends BaseMob const DEBUG = false onready var jump_grace_timer = $"JumpGraceTimer" onready var boots = $"Boots" onready var hair = $"Hair" onready var body = $"Body" onready var just_fallen_timer = $"JustFallenTimer" onready var just_jumped_timer = $"JustJumpedTimer" var lightning var sprite_direction: bool = true var timer_stair = 0.0 var walking_up = false var walking_down = false export var start_flipped = false var jumping_p1 = false var jumping_p2 = false var outside_the_building = false var navmap onready var stair_collider_down = $"StairColliderL" onready var stair_collider_up = $"StairColliderR" onready var walker = $Walker func _ready(): flip(start_flipped) func flip(toggle: bool): boots.set_flip_h(toggle) hair.set_flip_h(toggle) body.set_flip_h(toggle) if toggle: stair_collider_down.set_position(Vector2(3, 27)) stair_collider_up.set_position(Vector2(10, 14)) else: stair_collider_down.set_position(Vector2(-3, 27)) stair_collider_up.set_position(Vector2(-10, 14)) sprite_direction = toggle func animate(_delta): if abs(real_velocity.y) < 0.0001: if previous_real_velocity.y > 0.0: just_fallen_timer.start() if (abs(real_velocity.x) > 0.01 and abs(real_velocity.y) < 0.01) or walking_up or walking_down: boots.play() else: boots.stop() hair.speed_scale = 0.2 + (abs(real_velocity.x) + abs(real_velocity.y)) / 80.0 if !just_fallen_timer.is_stopped(): hair.speed_scale += just_fallen_timer.time_left * 10.0 if outside_the_building: hair.speed_scale += 4 func strike(): .strike() lives -= 1 boots.stop() #hair.stop() #body.stop() walker.stop_all() func post_movement(_delta): if frozen: return if real_velocity.y > 0: if jumping_p1: jumping_p1 = false jumping_p2 = true if abs(real_velocity.y) < 0.0001: if jump_grace_timer.is_stopped(): velocity.y = 0 jumping_p1 = false jumping_p2 = false else: if !jumping_p1 and !jumping_p2: velocity.y = -jump_burst jump_grace_timer.stop() just_jumped_timer.start() if !outside_the_building: walker.hop() jumping_p1 = true func stairs(delta): walking_up = false max_velocity = base_max_velocity gravity = 300.0 walking_down = false if abs(velocity.x) > 0 and !jumping_p1 and !jumping_p2 and jump_grace_timer.is_stopped(): if stair_collider_up.get_overlapping_areas().size() > 0: timer_stair += delta / 2.0 walking_up = true if timer_stair > 0.1: timer_stair = 0.0 move_local_y(-8.0) else: walking_up = false if just_jumped_timer.is_stopped() and stair_collider_down.get_overlapping_areas().size() > 0 and not stair_collider_up.get_overlapping_areas().size() > 0: max_velocity = base_max_velocity / 2.0 gravity = 9600.0 walking_down = true else: max_velocity = base_max_velocity gravity = 300.0 walking_down = false if walking_up or walking_down: boots.budge = false else: boots.budge = true func _unfreeze(_body): frozen = false func _unflip(_body): flip(false)