Skip to content
Open
11 changes: 5 additions & 6 deletions Scene/Zones/BaseZoneAct2.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
[ext_resource type="PackedScene" uid="uid://cioq5saowvqxj" path="res://Entities/MainObjects/Player.tscn" id="18"]
[ext_resource type="Script" path="res://Scripts/Objects/CollapseLayer.gd" id="21_fdxp4"]
[ext_resource type="PackedScene" uid="uid://urapmknlu0s5" path="res://Entities/Gimmicks/HorizontalBar.tscn" id="22_ethvu"]
[ext_resource type="PackedScene" uid="uid://blfw540cqicg3" path="res://Entities/Gimmicks/CatapultDEZ.tscn" id="23_6d3ti"]
[ext_resource type="PackedScene" path="res://Entities/Gimmicks/CatapultDEZ.tscn" id="23_6d3ti"]
[ext_resource type="PackedScene" uid="uid://4q0hpddgto2k" path="res://Entities/Gimmicks/Spring.tscn" id="23_n1r7l"]
[ext_resource type="PackedScene" uid="uid://ctg1aeiewvyvj" path="res://Entities/Gimmicks/ForceRoll.tscn" id="23_nxyu5"]
[ext_resource type="Texture2D" uid="uid://b4cw5q2u4jyb8" path="res://Graphics/Gimmicks/HorizontalBarAlt.png" id="24_ipqgj"]
Expand All @@ -38,12 +38,12 @@
[ext_resource type="PackedScene" uid="uid://xpsg8eoppqbo" path="res://Entities/Gimmicks/MonkeyBar/Hook.tscn" id="33_ix8uv"]
[ext_resource type="PackedScene" uid="uid://c2esop5orct10" path="res://Entities/MainObjects/GoalPost.tscn" id="34"]
[ext_resource type="PackedScene" uid="uid://chyrwm1qwvlyt" path="res://Entities/Gimmicks/Switch.tscn" id="36_bann4"]
[ext_resource type="PackedScene" uid="uid://cbix8ljuynffp" path="res://Entities/Gimmicks/CatapultWFZ.tscn" id="37_rbgxl"]
[ext_resource type="PackedScene" path="res://Entities/Gimmicks/CatapultWFZ.tscn" id="37_rbgxl"]
[ext_resource type="PackedScene" uid="uid://dasp221fqgrno" path="res://Entities/Obstacles/Platform.tscn" id="38"]
[ext_resource type="PackedScene" uid="uid://cfteqnft5ynr7" path="res://Entities/Hazards/Spikes.tscn" id="39_13rhf"]
[ext_resource type="PackedScene" uid="uid://c1n8wnllp8pk2" path="res://Entities/Items/SpecialStageRing.tscn" id="40_mjl70"]
[ext_resource type="PackedScene" path="res://Entities/Backgrounds/GHZWaterfall.tscn" id="41_mosa4"]
[ext_resource type="PackedScene" uid="uid://dneumyovipdy3" path="res://Entities/Gimmicks/CatapultFBZ.tscn" id="41_w8bgu"]
[ext_resource type="PackedScene" path="res://Entities/Gimmicks/CatapultFBZ.tscn" id="41_w8bgu"]

[sub_resource type="Animation" id="1"]
resource_name = "Glow"
Expand Down Expand Up @@ -98,7 +98,6 @@ point_count = 4
size = Vector2(128, 24)

[node name="BaseZoneAct2" type="Node2D"]
position = Vector2(1, -1)
script = ExtResource("2")
nextZone = "res://Scene/Zones/emerald_hill_zone.tscn"
animal1 = 2
Expand Down Expand Up @@ -1183,11 +1182,11 @@ position = Vector2(-134, 546)
[connection signal="pressed" from="HookSliderAssembly/MiddleSwitch" to="HookSliderAssembly/HookSlider" method="send_to_target" binds= [0]]
[connection signal="pressed" from="HookSliderAssembly/MiddleSwitch" to="HookSliderAssembly/HookSlider/MobileHook/RetractibleChain" method="send_to_height" binds= [120]]
[connection signal="target_reached" from="HookSliderAssembly/HookSlider/MobileHook/RetractibleChain" to="HookSliderAssembly/HookSlider" method="send_to_target" binds= [615]]
[connection signal="pressed" from="Switch" to="ChainedMonkeyBar/RetractibleChain" method="set_default_target" binds= [170]]
[connection signal="pressed" from="Switch" to="ChainedMonkeyBar/RetractibleChain" method="send_to_height" binds= [609]]
[connection signal="pressed" from="Switch" to="ChainedMonkeyBar/RetractibleChain" method="set_default_target" binds= [170]]
[connection signal="pressed" from="Switch2" to="ChainedMonkeyBar/RetractibleChain" method="set_home_height" binds= [170]]
[connection signal="pressed" from="Switch2" to="ChainedMonkeyBar/RetractibleChain" method="set_default_target" binds= [0]]
[connection signal="pressed" from="Switch2" to="ChainedMonkeyBar/RetractibleChain" method="send_to_height" binds= [170]]
[connection signal="pressed" from="Switch2" to="ChainedMonkeyBar/RetractibleChain" method="set_default_target" binds= [0]]

[editable path="ChainedMonkeyBar2"]
[editable path="ChainedMonkeyBar3"]
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Gimmicks/WaterBar.gd
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func _process(delta):
var horizontal_hitbox: Vector2 = player.get_predefined_hitbox(PlayerChar.HITBOXES.HORIZONTAL)
player.set_hitbox(horizontal_hitbox)
player.set_state(PlayerChar.STATES.GIMMICK, horizontal_hitbox)
player.avatar.get_animator().play(&"clingVerticalBar")
avatar.get_animator().play(&"clingVerticalBar")

player.set_movement(Vector2(0.0, 0.0))

Expand Down
2 changes: 1 addition & 1 deletion Scripts/Gimmicks/WindCurrent.gd
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func _physics_process(_delta: float) -> void:
player.push_vertical()

# force player direction
player.set_direction(PlayerChar.DIRECTIONS.RIGHT if current_vector.x > 0.0 else PlayerChar.DIRECTIONS.LEFT)
player.set_direction_signed(current_vector.x)

# force slide state if the player isn't currently on a gimmick
if player.get_state() != PlayerChar.STATES.GIMMICK and \
Expand Down
9 changes: 3 additions & 6 deletions Scripts/Global/Global.gd
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,11 @@ enum EMERALDS {
CYAN = 1 << 4,
SILVER = 1 << 5,
PURPLE = 1 << 6,
ALL = (1 << 7) - 1
_END,
ALL = ((_END - 1) << 1) - 1
}
# emeralds use bitwise flag operations, the equivalent for 7 emeralds would be 127
var emeralds: int = (func() -> int:
# make sure EMERALDS.ALL holds a correct value
assert(EMERALDS.ALL == (1 << EMERALDS.size() - 1) - 1)
return 0
).call()
var emeralds: int = 0
var specialStageID = 0
var level = null # reference to the currently active level
var levelTime = 0 # the timer that counts down while the level isn't completed or in a special ring
Expand Down
18 changes: 6 additions & 12 deletions Scripts/Misc/Score.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,12 @@ class_name Score extends Node2D

const SCORE: Array[int] = [10,100,200,500,1000,10000]
const RECTS: Array[Rect2] = [
# 10
Rect2(Vector2(0, 0), Vector2(10, 8)),
# 100
Rect2(Vector2(0, 0), Vector2(15, 8)),
# 200
Rect2(Vector2(0, 8), Vector2(15, 8)),
# 500
Rect2(Vector2(0, 18), Vector2(15, 8)),
# 1000
Rect2(Vector2(0, 0), Vector2(20, 8)),
# 10000
Rect2(Vector2(0, 0), Vector2(25, 8))
Rect2(0.0, 0.0, 10.0, 8.0), # 10
Rect2(0.0, 0.0, 15.0, 8.0), # 100
Rect2(0.0, 8.0, 15.0, 8.0), # 200
Rect2(0.0, 18.0, 15.0, 8.0), # 500
Rect2(0.0, 0.0, 20.0, 8.0), # 1000
Rect2(0.0, 0.0, 25.0, 8.0) # 10000
]

var score_id: int = 0
Expand Down
7 changes: 4 additions & 3 deletions Scripts/Player/Player.gd
Original file line number Diff line number Diff line change
Expand Up @@ -1464,9 +1464,10 @@ func set_direction(new_direction: PlayerChar.DIRECTIONS) -> void:
## [param change_sprite_direction] - if [code]false[/code], only the movement direction
## is changed, and the sprite direction ([code]sprite.flip_h[/code]) is kept the same.
func set_direction_signed(new_direction: float, change_sprite_direction: bool = true) -> void:
_direction = signf(new_direction)
if change_sprite_direction:
sprite.flip_h = (_direction < 0.0)
if new_direction != 0.0:
_direction = signf(new_direction)
if change_sprite_direction:
sprite.flip_h = (_direction < 0.0)


## Flips player's movement direction.[br]
Expand Down
7 changes: 3 additions & 4 deletions Scripts/Player/PlayerAvatars/AmyAvatar.gd
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ func amy_jump_hammer_callback(_state: PlayerState, player: PlayerChar, _delta: f
# set ability used to true to prevent multiple uses
player.abilityUsed = true
# enable insta shield hitbox if hammer drop dashing
player.shieldSprite.get_node("InstaShieldHitbox/HitBox").disabled = (
get_animator().current_animation == "dropDash"
)
player.shieldSprite.get_node(^"InstaShieldHitbox/HitBox").set_deferred(
&"disabled", (get_animator().current_animation == "dropDash"))
# play hammer sound
player.sfx[30].play()
# play dropDash sound
Expand Down Expand Up @@ -90,7 +89,7 @@ func amy_exit_jump_dropdash_callback(_exit_state: PlayerState,
):

# Need to disable instashield hitbox on state exit regardless of other factors
player.shieldSprite.get_node("InstaShieldHitbox/HitBox").disabled = true
player.shieldSprite.get_node(^"InstaShieldHitbox/HitBox").set_deferred(&"disabled", true)

# If we haven't been charging the drop dash long enough, we bail here.
if drop_timer <= 1:
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Player/States/Air.gd
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func state_physics_process(delta: float) -> void:

# Change parent direction
# Check that lock direction isn't on
if !lockDir and parent.inputs[parent.INPUTS.XINPUT] != 0:
if !lockDir:
parent.set_direction_signed(parent.inputs[parent.INPUTS.XINPUT])

# Gravity
Expand Down
4 changes: 2 additions & 2 deletions Scripts/Player/States/AmyHammerSwing.gd
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ func state_physics_process(delta: float) -> void:
if parent.inputs[parent.INPUTS.XINPUT] != 0:
parent.set_direction_signed(parent.inputs[parent.INPUTS.XINPUT])
elif parent.movement.x != 0:
parent.set_direction_signed(signf(parent.movement.x))
parent.set_direction_signed(parent.movement.x)

# set to max speed based on direction
parent.movement.x = parent.top*parent.get_direction_multiplier()
parent.movement.x = parent.get_physics().top_speed*parent.get_direction_multiplier()

# decrease hammer time
if hammerTime > 0:
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Player/States/Fly.gd
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func state_physics_process(delta: float) -> void:
carriedPlayer.movement = parent.movement
carriedPlayer.get_state_object(parent.STATES.AIR).lockDir = true
# set carried player direction
carriedPlayer.set_direction_signed(parent.get_direction_multiplier(),false)
carriedPlayer.set_direction_signed(parent.get_direction_multiplier())

# set immediate inputs if ai
if parent.playerControl == 0:
Expand Down
15 changes: 7 additions & 8 deletions Scripts/Player/States/Glide.gd
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,16 @@ func state_physics_process(delta: float) -> void:
# check if not falling, if not then do glide routine
if !is_fall and !sliding:
# Turning
var direction: float = parent.get_direction_multiplier()
# left
if parent.get_direction_multiplier() > 0.0:
if direction > 0.0:
if turnTimer >= 180:
speedPreservation = abs(parent.movement.x)
if turnTimer > 0:
turnTimer -= 2.8125*delta*60
parent.movement.x = speedPreservation*cos(deg_to_rad(turnTimer))
# right
elif parent.get_direction_multiplier() < 0.0:
elif direction < 0.0:
if turnTimer <= 0:
speedPreservation = abs(parent.movement.x)
if turnTimer < 180:
Expand Down Expand Up @@ -132,7 +133,7 @@ func state_physics_process(delta: float) -> void:
# Go into sliding if on ground
if parent.ground and !sliding and groundBuffer >= 1:
animator.play("glideSlide")
parent.set_direction_signed(signf(parent.movement.x))
parent.set_direction_signed(parent.movement.x)
sliding = true
parent.reflective = false
$"../../SkidDustTimer".start(0.1)
Expand Down Expand Up @@ -167,10 +168,8 @@ func state_physics_process(delta: float) -> void:
# failure to climb up walls.
#
# This modification will be revisited later.
if (parent.movement.x != 0.0):
parent.set_direction_signed(signf(parent.movement.x))
else:
parent.set_direction(parent.get_direction())
parent.set_direction_signed(parent.movement.x)
parent.sprite.flip_h = (parent.get_direction_multiplier() < 0.0)

parent.set_character_action_state(KnucklesAvatar.CHAR_STATES.KNUCKLES_CLIMB,
parent.get_predefined_hitbox(PlayerChar.HITBOXES.GLIDE),
Expand All @@ -190,7 +189,7 @@ func state_physics_process(delta: float) -> void:
# if sliding then do sliding routine
elif sliding:

parent.set_direction_signed(signf(parent.movement.x))
parent.set_direction_signed(parent.movement.x)
parent.movement.x = move_toward(parent.movement.x,0,friction/GlobalFunctions.div_by_delta(delta))

# set direction
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Player/States/Normal.gd
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func state_process(delta: float) -> void:
if parent.inputs[parent.INPUTS.XINPUT] != 0 and !skid:
parent.set_direction_signed(parent.inputs[parent.INPUTS.XINPUT], false)
elif parent.movement.x != 0 and skid:
parent.set_direction_signed(signf(parent.movement.x), false)
parent.set_direction_signed(parent.movement.x, false)

# water running
parent.action_water_run_handle()
Expand Down
3 changes: 2 additions & 1 deletion Scripts/Player/States/Respawn.gd
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ func state_physics_process(delta: float) -> void:
if abs(distance)/16 > abs(parent.movement.x/60):
parent.movement.x = (distance/16)*60

parent.set_direction_signed(signf(distance))
parent.set_direction_signed(distance, false)
parent.sprite.flip_h = (parent.get_direction_multiplier() < 0.0)
else: # Go back to normal
# restore layer
parent.collision_layer = layerMemory
Expand Down
7 changes: 4 additions & 3 deletions Scripts/Player/States/WallClimb.gd
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ func state_process(_delta: float) -> void:
func state_physics_process(delta: float) -> void:
# do climb logic if climbUp is false
var animator: PlayerCharAnimationPlayer = parent.get_avatar().get_animator()
var camera: PlayerCamera = parent.get_camera()
if !climbUp:

# climbing
parent.movement.y = (parent.inputs[parent.INPUTS.YINPUT]+int(parent.isSuper)*sign(parent.inputs[parent.INPUTS.YINPUT]))*60
#Prevent player from leaving play area via climbing.
parent.global_position.y = clampf(parent.global_position.y,
parent.get_camera().target_limit_top+16,
parent.get_camera().target_limit_bottom)
camera.target_limit_top+16.0,
camera.target_limit_bottom)

# check vertically (sometimes clinging can cause clipping)
if parent.movement.y == 0:
Expand Down Expand Up @@ -87,7 +88,7 @@ func state_physics_process(delta: float) -> void:
else:
# climb up
# give camera time to follow so it doesn't snap
parent.get_camera().drag_lerp = 1.0
camera.drag_lerp = 1.0
climbTimer += delta
# stop current animations and play climb up
animator.stop()
Expand Down