Compare commits

..

No commits in common. "ca6cc3a370a93323ae689e3c3494900774a62d28" and "f1fc198a5b2ad1bb560df0a6c2cbd247fa22f604" have entirely different histories.

5 changed files with 80 additions and 428 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2 KiB

View file

@ -2,14 +2,6 @@
[ext_resource type="Texture2D" uid="uid://d1yojr8i1ffy4" path="res://Assets/Player.png" id="1_qkju4"] [ext_resource type="Texture2D" uid="uid://d1yojr8i1ffy4" path="res://Assets/Player.png" id="1_qkju4"]
[sub_resource type="AtlasTexture" id="AtlasTexture_vhg5s"]
atlas = ExtResource("1_qkju4")
region = Rect2(64, 0, 64, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_lrw40"]
atlas = ExtResource("1_qkju4")
region = Rect2(192, 0, 64, 32)
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_qkju4"] [sub_resource type="CompressedTexture2D" id="CompressedTexture2D_qkju4"]
load_path = "res://.godot/imported/Player.png-54d4b13ac506f96b99814af866f299ae.ctex" load_path = "res://.godot/imported/Player.png-54d4b13ac506f96b99814af866f299ae.ctex"
@ -19,18 +11,14 @@ region = Rect2(0, 0, 64, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_1y441"] [sub_resource type="AtlasTexture" id="AtlasTexture_1y441"]
atlas = ExtResource("1_qkju4") atlas = ExtResource("1_qkju4")
region = Rect2(512, 0, 64, 32) region = Rect2(448, 0, 64, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_5232b"] [sub_resource type="AtlasTexture" id="AtlasTexture_vhg5s"]
atlas = ExtResource("1_qkju4") atlas = SubResource("CompressedTexture2D_qkju4")
region = Rect2(0, 0, 64, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_cafjo"]
atlas = ExtResource("1_qkju4")
region = Rect2(64, 0, 64, 32) region = Rect2(64, 0, 64, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_xqred"] [sub_resource type="AtlasTexture" id="AtlasTexture_lrw40"]
atlas = ExtResource("1_qkju4") atlas = SubResource("CompressedTexture2D_qkju4")
region = Rect2(128, 0, 64, 32) region = Rect2(128, 0, 64, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_ygdw1"] [sub_resource type="AtlasTexture" id="AtlasTexture_ygdw1"]
@ -53,28 +41,9 @@ region = Rect2(256, 0, 64, 32)
animations = [{ animations = [{
"frames": [{ "frames": [{
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_vhg5s")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_lrw40")
}],
"loop": 0,
"name": &"Crouch",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_lrw40")
}],
"loop": 0,
"name": &"Crouching",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_65ufv") "texture": SubResource("AtlasTexture_65ufv")
}], }],
"loop": 0, "loop": 1,
"name": &"Idle", "name": &"Idle",
"speed": 5.0 "speed": 5.0
}, { }, {
@ -82,21 +51,24 @@ animations = [{
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_1y441") "texture": SubResource("AtlasTexture_1y441")
}], }],
"loop": 0, "loop": 1,
"name": &"InAir", "name": &"InAir",
"speed": 5.0 "speed": 5.0
}, { }, {
"frames": [{ "frames": [{
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_5232b") "texture": SubResource("AtlasTexture_65ufv")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_cafjo") "texture": SubResource("AtlasTexture_vhg5s")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_xqred") "texture": SubResource("AtlasTexture_lrw40")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_vhg5s")
}], }],
"loop": 2, "loop": 1,
"name": &"Moving", "name": &"Moving",
"speed": 7.0 "speed": 7.0
}, { }, {
@ -107,7 +79,7 @@ animations = [{
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_2f2n7") "texture": SubResource("AtlasTexture_2f2n7")
}], }],
"loop": 0, "loop": 1,
"name": &"ReachX", "name": &"ReachX",
"speed": 4.0 "speed": 4.0
}, { }, {
@ -118,7 +90,7 @@ animations = [{
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_hy70p") "texture": SubResource("AtlasTexture_hy70p")
}], }],
"loop": 0, "loop": 1,
"name": &"ReachY", "name": &"ReachY",
"speed": 4.0 "speed": 4.0
}] }]

View file

@ -76,21 +76,10 @@ var wrapArcStartAngle := 0.0 # Angle around the corner where the arc begins.
var wrapSpeed := 0.0 var wrapSpeed := 0.0
var wrapDistanceTravelled := 0.0 var wrapDistanceTravelled := 0.0
# The sprite's rotation turns smoothly, but it's only drawn at quarter turns so
# its pixels stay square (see _set_sprite_rotation).
var smoothSpriteRotation := 0.0
# Read by the AnimationTree's state machine. Set in _update_animation_conditions.
var isOnSurface := false
var isCrawling := false # Moving along the surface we're on.
var isHoldingAtEdge := false
var isPressingIntoSurface := false
var isReachingAway := false # Holding away from the surface, counting towards letting go/hopping.
########### ###########
## Nodes ## ## Nodes ##
########### ###########
@onready var sprite: Sprite2D = $Sprite2D @onready var sprite: AnimatedSprite2D = $AnimatedSprite2D
@onready var collisionShape: CollisionShape2D = $CollisionShape2D @onready var collisionShape: CollisionShape2D = $CollisionShape2D
# Edge-finding raycasts, one each side, under a pivot we turn to face the surface we're on. # Edge-finding raycasts, one each side, under a pivot we turn to face the surface we're on.
@onready var edgeSensors: Node2D = $EdgeSensors @onready var edgeSensors: Node2D = $EdgeSensors
@ -119,8 +108,8 @@ func _ready() -> void:
rightEdgeSensor.add_exception(self) rightEdgeSensor.add_exception(self)
func _physics_process(delta: float) -> void: func _physics_process(delta: float) -> void:
# Note: Up is positive y. var xInput := Input.get_axis("moveLeft", "moveRight")
var moveInput := Vector2(Input.get_axis("moveLeft", "moveRight"), Input.get_axis("moveDown", "moveUp")) var yInput := Input.get_axis("moveDown", "moveUp")
if isWrapping: if isWrapping:
_update_wrap(delta) _update_wrap(delta)
@ -130,18 +119,18 @@ func _physics_process(delta: float) -> void:
if not wasInAir: if not wasInAir:
isHoppingAcross = false isHoppingAcross = false
if isStickingToWall and moveInput.y != 0.0: if isStickingToWall and yInput != 0.0:
wallFacingY = -signf(moveInput.y) wallFacingY = -signf(yInput)
if _start_edge_wrap(moveInput): if _start_edge_wrap(xInput, yInput):
return return
# Animated Sprite # Animated Sprite
_update_facing(moveInput) _update_facing(xInput, yInput)
_update_animation_conditions(moveInput) _update_animation(xInput, yInput)
_update_vertical_movement(delta, moveInput) _update_vertical_movement(delta, xInput, yInput)
_update_floor_hop(delta, moveInput) _update_floor_hop(delta, xInput, yInput)
_update_horizontal_movement(delta, moveInput) _update_horizontal_movement(delta, xInput, yInput)
_hold_at_edge(delta) _hold_at_edge(delta)
var wasOnWall := (isStickingToWall and not is_on_floor()) var wasOnWall := (isStickingToWall and not is_on_floor())
@ -151,7 +140,7 @@ func _physics_process(delta: float) -> void:
_update_wall_sticking(wasOnWall) _update_wall_sticking(wasOnWall)
var climbedPastWallTop := wasOnWall and not isStickingToWall and moveInput.y > 0 var climbedPastWallTop := wasOnWall and not isStickingToWall and yInput > 0
var tryingToLetGo := timeSpentUnstickingWall >= HOLD_TIME var tryingToLetGo := timeSpentUnstickingWall >= HOLD_TIME
if climbedPastWallTop and not tryingToLetGo and _start_wall_top_wrap(): if climbedPastWallTop and not tryingToLetGo and _start_wall_top_wrap():
return return
@ -160,7 +149,7 @@ func _physics_process(delta: float) -> void:
# In a corner, stick to the ceiling if pressing up, otherwise the wall. # In a corner, stick to the ceiling if pressing up, otherwise the wall.
if isStickingToWall and isStickingToCeiling: if isStickingToWall and isStickingToCeiling:
if moveInput.y > 0: if yInput > 0:
isStickingToWall = false isStickingToWall = false
else: else:
isStickingToCeiling = false isStickingToCeiling = false
@ -176,45 +165,54 @@ func _physics_process(delta: float) -> void:
# ---- Movement steps (in the order _physics_process runs them) ---- # ---- Movement steps (in the order _physics_process runs them) ----
func _update_facing(moveInput: Vector2) -> void: func _update_facing(xInput: float, yInput: float) -> void:
if moveInput == Vector2.ZERO: if xInput == 0.0 and yInput == 0.0:
return return
if isStickingToCeiling: if isStickingToCeiling:
sprite.flip_h = moveInput.x > 0 # Upside down, so flipped the other way. sprite.flip_h = xInput > 0 # Upside down, so flipped the other way.
elif isStickingToWall: elif isStickingToWall:
if wallNormalX < 0: sprite.flip_h = moveInput.y < 0 if wallNormalX < 0: sprite.flip_h = yInput < 0
else: sprite.flip_h = moveInput.y > 0 else: sprite.flip_h = yInput > 0
else: else:
sprite.flip_h = moveInput.x < 0 sprite.flip_h = xInput < 0
# Facts the AnimationTree's state machine reads to pick an animation (see the func _update_animation(xInput:float, yInput:float):
# transitions' advance expressions in player.tscn). if xInput and (isStickingToCeiling or is_on_floor()) and timeSpentHoldingEdge == 0:
func _update_animation_conditions(moveInput: Vector2) -> void: sprite.play("Moving")
isOnSurface = _get_surface_normal() != Vector2.ZERO elif yInput and isStickingToWall and timeSpentHoldingEdge == 0:
isCrawling = ((moveInput.x != 0.0 and (isStickingToCeiling or is_on_floor())) sprite.play("Moving")
or (moveInput.y != 0.0 and isStickingToWall))
isHoldingAtEdge = timeSpentHoldingEdge > 0
isPressingIntoSurface = _is_pressing_into_surface(moveInput)
isReachingAway = ((is_on_floor() and timeSpentHoldingUpOnFloor > 0)
or (isStickingToCeiling and timeSpentUnstickingCeiling > 0)
or (isStickingToWall and timeSpentUnstickingWall > 0))
func _update_vertical_movement(delta: float, moveInput: Vector2) -> void: elif !is_on_floor() and !isStickingToWall and !isStickingToCeiling:
sprite.play("InAir")
elif _get_surface_normal() != Vector2.ZERO and timeSpentHoldingEdge > 0:
sprite.play("ReachX")
elif ((is_on_floor() and timeSpentHoldingUpOnFloor > 0) or
(isStickingToCeiling and timeSpentUnstickingCeiling > 0)):
sprite.play("ReachY")
elif isStickingToWall and timeSpentUnstickingWall > 0:
sprite.play("ReachY")
else:
sprite.play("Idle")
func _update_vertical_movement(delta: float, xInput: float, yInput: float) -> void:
if isStickingToCeiling: if isStickingToCeiling:
_update_ceiling_letting_go(delta, moveInput) _update_ceiling_letting_go(delta, xInput, yInput)
elif isStickingToWall: elif isStickingToWall:
var targetSpeed := -CLIMB_SPEED * moveInput.y var targetSpeed := -CLIMB_SPEED * yInput
velocity.y = _accelerate(velocity.y, targetSpeed, delta) velocity.y = _accelerate(velocity.y, targetSpeed, delta)
elif not is_on_floor(): elif not is_on_floor():
velocity.y = minf(velocity.y + get_gravity().y * delta, MAX_FALL_SPEED) velocity.y = minf(velocity.y + get_gravity().y * delta, MAX_FALL_SPEED)
# Holding down (not moving) for HOLD_TIME lets go, hopping onto a floor if one's in reach. # Holding down (not moving) for HOLD_TIME lets go, hopping onto a floor if one's in reach.
func _update_ceiling_letting_go(delta: float, moveInput: Vector2) -> void: func _update_ceiling_letting_go(delta: float, xInput: float, yInput: float) -> void:
if moveInput.y >= 0: if yInput >= 0:
ignoreCeilingUnstickUntilRelease = false ignoreCeilingUnstickUntilRelease = false
var holdingDown := moveInput.y < 0 var holdingDown := yInput < 0
var standingStill := moveInput.x == 0.0 var standingStill := xInput == 0.0
if holdingDown and standingStill and not ignoreCeilingUnstickUntilRelease: if holdingDown and standingStill and not ignoreCeilingUnstickUntilRelease:
timeSpentUnstickingCeiling += delta timeSpentUnstickingCeiling += delta
else: else:
@ -232,8 +230,8 @@ func _update_ceiling_letting_go(delta: float, moveInput: Vector2) -> void:
velocity.y = get_gravity().y * delta velocity.y = get_gravity().y * delta
# Hopping from the floop while holding still. # Hopping from the floop while holding still.
func _update_floor_hop(delta: float, moveInput: Vector2) -> void: func _update_floor_hop(delta: float, xInput: float, yInput: float) -> void:
if is_on_floor() and not isStickingToWall and moveInput.x == 0.0 and moveInput.y > 0: if is_on_floor() and not isStickingToWall and xInput == 0.0 and yInput > 0:
timeSpentHoldingUpOnFloor += delta timeSpentHoldingUpOnFloor += delta
else: else:
timeSpentHoldingUpOnFloor = 0.0 timeSpentHoldingUpOnFloor = 0.0
@ -242,25 +240,25 @@ func _update_floor_hop(delta: float, moveInput: Vector2) -> void:
timeSpentHoldingUpOnFloor = 0.0 timeSpentHoldingUpOnFloor = 0.0
velocity.y = -_get_hop_speed(_get_hop_height()) velocity.y = -_get_hop_speed(_get_hop_height())
func _update_horizontal_movement(delta: float, moveInput: Vector2) -> void: func _update_horizontal_movement(delta: float, xInput: float, yInput: float) -> void:
if isStickingToWall and not is_on_floor(): if isStickingToWall and not is_on_floor():
_update_wall_letting_go(delta, moveInput) _update_wall_letting_go(delta, xInput, yInput)
return return
timeSpentUnstickingWall = 0.0 timeSpentUnstickingWall = 0.0
if is_on_floor() or isStickingToCeiling: if is_on_floor() or isStickingToCeiling:
velocity.x = _accelerate(velocity.x, moveInput.x * GROUND_SPEED, delta) velocity.x = _accelerate(velocity.x, xInput * GROUND_SPEED, delta)
elif not isHoppingAcross: elif not isHoppingAcross:
velocity.x = _air_steer(velocity.x, moveInput.x, delta) velocity.x = _air_steer(velocity.x, xInput, delta)
# Holding away (not climbing) for HOLD_TIME hops to the opposite wall if one's # Holding away (not climbing) for HOLD_TIME hops to the opposite wall if one's
# in reach, otherwise lets go. # in reach, otherwise lets go.
func _update_wall_letting_go(delta: float, moveInput: Vector2) -> void: func _update_wall_letting_go(delta: float, xInput: float, yInput: float) -> void:
var pressingAwayFromWall := moveInput.x * wallNormalX > 0 var pressingAwayFromWall := xInput * wallNormalX > 0
if not pressingAwayFromWall: if not pressingAwayFromWall:
ignoreWallUnstickUntilRelease = false ignoreWallUnstickUntilRelease = false
var standingStill := moveInput.y == 0.0 var standingStill := yInput == 0.0
if pressingAwayFromWall and standingStill and not ignoreWallUnstickUntilRelease: if pressingAwayFromWall and standingStill and not ignoreWallUnstickUntilRelease:
timeSpentUnstickingWall += delta timeSpentUnstickingWall += delta
else: else:
@ -274,7 +272,7 @@ func _update_wall_letting_go(delta: float, moveInput: Vector2) -> void:
if wallDistance >= 0.0: if wallDistance >= 0.0:
_hop_across(wallDistance) _hop_across(wallDistance)
else: else:
velocity.x = moveInput.x * GROUND_SPEED velocity.x = xInput * GROUND_SPEED
func _update_wall_sticking(wasOnWall: bool) -> void: func _update_wall_sticking(wasOnWall: bool) -> void:
var meantToLetGo := timeSpentUnstickingWall >= HOLD_TIME var meantToLetGo := timeSpentUnstickingWall >= HOLD_TIME
@ -302,18 +300,7 @@ func _update_sprite_rotation(delta: float) -> void:
# Smooth, and the same speed at any frame rate thanks to exp(). # Smooth, and the same speed at any frame rate thanks to exp().
var turnAmount := 1.0 - exp(-ROTATE_TO_SURFACE_SPEED * delta) var turnAmount := 1.0 - exp(-ROTATE_TO_SURFACE_SPEED * delta)
_set_sprite_rotation(lerp_angle(smoothSpriteRotation, targetRotation, turnAmount)) sprite.rotation = lerp_angle(sprite.rotation, targetRotation, turnAmount)
# Rotated pixel art gets jagged and uneven, so draw the sprite at the nearest
# quarter turn. On a wrap it flips over halfway round the corner.
func _set_sprite_rotation(angle: float) -> void:
smoothSpriteRotation = angle
var snapped := snappedf(angle, PI / 2)
if is_equal_approx(snapped, sprite.rotation):
return
sprite.rotation = snapped
# Physics interpolation would otherwise tween through the angles in between.
sprite.reset_physics_interpolation()
# ---- Movement helpers ---- # ---- Movement helpers ----
@ -351,15 +338,6 @@ func _get_surface_normal() -> Vector2:
if isStickingToWall: return Vector2(wallNormalX, 0) if isStickingToWall: return Vector2(wallNormalX, 0)
return Vector2.ZERO return Vector2.ZERO
# True when the input points (within a couple of degrees) straight into the
# surface the slime is stuck to. moveInput is y-up, so flip it to Godot's y-down.
func _is_pressing_into_surface(moveInput: Vector2) -> bool:
var normal := _get_surface_normal()
if normal == Vector2.ZERO or moveInput == Vector2.ZERO:
return false
var inputDir := Vector2(moveInput.x, -moveInput.y)
return absf(inputDir.angle_to(-normal)) < deg_to_rad(2)
func _get_facing() -> Vector2: func _get_facing() -> Vector2:
if is_on_floor(): if is_on_floor():
if sprite.flip_h: if sprite.flip_h:
@ -408,12 +386,12 @@ func _hop_across(distance: float) -> void:
# Pressing into the surface near an edge starts wrapping around it. A direction # Pressing into the surface near an edge starts wrapping around it. A direction
# along the surface picks the side, otherwise facing does (or the other side if # along the surface picks the side, otherwise facing does (or the other side if
# only it has an edge). # only it has an edge).
func _start_edge_wrap(moveInput: Vector2) -> bool: func _start_edge_wrap(xInput: float, yInput: float) -> bool:
var normal := _get_surface_normal() var normal := _get_surface_normal()
if normal == Vector2.ZERO: if normal == Vector2.ZERO:
return false return false
var inputDirection := Vector2(moveInput.x, -moveInput.y) # Up is negative y. var inputDirection := Vector2(xInput, -yInput) # Up is negative y.
var pressingIntoSurface := inputDirection.dot(-normal) >= 0.5 var pressingIntoSurface := inputDirection.dot(-normal) >= 0.5
if not pressingIntoSurface: if not pressingIntoSurface:
return false return false
@ -586,7 +564,7 @@ func _update_wrap(delta: float) -> void:
arcProgress = minf(distance / arcLength, 1.0) arcProgress = minf(distance / arcLength, 1.0)
var angle := lerp_angle(wrapArcStartAngle, wrapOntoNormal.angle(), arcProgress) var angle := lerp_angle(wrapArcStartAngle, wrapOntoNormal.angle(), arcProgress)
var positionOnArc := wrapCorner + Vector2.from_angle(angle) * _wrap_radius() var positionOnArc := wrapCorner + Vector2.from_angle(angle) * _wrap_radius()
_set_sprite_rotation(lerp_angle(_rotation_for(wrapFromNormal), _rotation_for(wrapOntoNormal), arcProgress)) sprite.rotation = lerp_angle(_rotation_for(wrapFromNormal), _rotation_for(wrapOntoNormal), arcProgress)
# Exit. # Exit.
var exitProgress := maxf(distance - arcLength, 0.0) / exitOffset.length() var exitProgress := maxf(distance - arcLength, 0.0) / exitOffset.length()

View file

@ -3,7 +3,7 @@
[ext_resource type="Script" uid="uid://drxbt88sjb1y4" path="res://Characters/player.gd" id="1_eovys"] [ext_resource type="Script" uid="uid://drxbt88sjb1y4" path="res://Characters/player.gd" id="1_eovys"]
[ext_resource type="AudioStream" uid="uid://b06e7ntjhc4dp" path="res://Assets/Sounds/slime_land_1.ogg" id="3_land1"] [ext_resource type="AudioStream" uid="uid://b06e7ntjhc4dp" path="res://Assets/Sounds/slime_land_1.ogg" id="3_land1"]
[ext_resource type="AudioStream" uid="uid://bpa664tsd4kwn" path="res://Assets/Sounds/slime_land_2.ogg" id="4_land2"] [ext_resource type="AudioStream" uid="uid://bpa664tsd4kwn" path="res://Assets/Sounds/slime_land_2.ogg" id="4_land2"]
[ext_resource type="Texture2D" uid="uid://d1yojr8i1ffy4" path="res://Assets/Player.png" id="5_4m0gv"] [ext_resource type="SpriteFrames" uid="uid://d0suj5i5kalpp" path="res://Assets/slime_player.tres" id="5_4m0gv"]
[ext_resource type="AudioStream" uid="uid://ceyykao0r6u7g" path="res://Assets/Sounds/slime_land_3.ogg" id="5_land3"] [ext_resource type="AudioStream" uid="uid://ceyykao0r6u7g" path="res://Assets/Sounds/slime_land_3.ogg" id="5_land3"]
[ext_resource type="AudioStream" uid="uid://1dmf4p7x4y3b" path="res://Assets/Sounds/slime_wrap.ogg" id="6_wrap"] [ext_resource type="AudioStream" uid="uid://1dmf4p7x4y3b" path="res://Assets/Sounds/slime_wrap.ogg" id="6_wrap"]
@ -12,298 +12,14 @@
[sub_resource type="Gradient" id="Gradient_splat"] [sub_resource type="Gradient" id="Gradient_splat"]
colors = PackedColorArray(0, 0.6666667, 0, 1, 0, 1, 0.50980395, 1) colors = PackedColorArray(0, 0.6666667, 0, 1, 0, 1, 0.50980395, 1)
[sub_resource type="Animation" id="Animation_Crouch"]
resource_name = "Crouch"
length = 0.4
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.2),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [1, 3]
}
[sub_resource type="Animation" id="Animation_Idle"]
resource_name = "Idle"
length = 0.2
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [0]
}
[sub_resource type="Animation" id="Animation_InAir"]
resource_name = "InAir"
length = 0.2
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [8]
}
[sub_resource type="Animation" id="Animation_Moving"]
resource_name = "Moving"
length = 0.571429
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.142857, 0.285714, 0.428571),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"update": 1,
"values": [0, 1, 2, 1]
}
[sub_resource type="Animation" id="Animation_4m0gv"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [0]
}
[sub_resource type="Animation" id="Animation_ReachX"]
resource_name = "ReachX"
length = 0.5
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.25),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [6, 7]
}
[sub_resource type="Animation" id="Animation_ReachY"]
resource_name = "ReachY"
length = 0.5
step = 0.1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.2),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [4, 5]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_slime"]
_data = {
&"Crouch": SubResource("Animation_Crouch"),
&"Idle": SubResource("Animation_Idle"),
&"InAir": SubResource("Animation_InAir"),
&"Moving": SubResource("Animation_Moving"),
&"RESET": SubResource("Animation_4m0gv"),
&"ReachX": SubResource("Animation_ReachX"),
&"ReachY": SubResource("Animation_ReachY")
}
[sub_resource type="AnimationNodeAnimation" id="AnimNode_Crouch"]
animation = &"Crouch"
[sub_resource type="AnimationNodeAnimation" id="AnimNode_Idle"]
animation = &"Idle"
[sub_resource type="AnimationNodeAnimation" id="AnimNode_InAir"]
animation = &"InAir"
[sub_resource type="AnimationNodeAnimation" id="AnimNode_Moving"]
animation = &"Moving"
[sub_resource type="AnimationNodeAnimation" id="AnimNode_ReachX"]
animation = &"ReachX"
[sub_resource type="AnimationNodeAnimation" id="AnimNode_ReachY"]
animation = &"ReachY"
[sub_resource type="AnimationNodeStateMachineTransition" id="Transition_Start"]
advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="Transition_Idle_Moving"]
advance_mode = 2
advance_expression = "isCrawling and not isHoldingAtEdge"
[sub_resource type="AnimationNodeStateMachineTransition" id="Transition_Idle_InAir"]
advance_mode = 2
advance_expression = "not isOnSurface"
[sub_resource type="AnimationNodeStateMachineTransition" id="Transition_Idle_ReachX"]
advance_mode = 2
advance_expression = "isOnSurface and isHoldingAtEdge"
[sub_resource type="AnimationNodeStateMachineTransition" id="Transition_Idle_ReachY"]
advance_mode = 2
advance_expression = "isReachingAway and not isCrawling and not isHoldingAtEdge and not isPressingIntoSurface"
[sub_resource type="AnimationNodeStateMachineTransition" id="Transition_Idle_Crouch"]
advance_mode = 2
advance_expression = "isPressingIntoSurface and not isCrawling and not isHoldingAtEdge"
[sub_resource type="AnimationNodeStateMachineTransition" id="Transition_Moving_Idle"]
advance_mode = 2
advance_expression = "isOnSurface and not (isCrawling or isHoldingAtEdge or isPressingIntoSurface or isReachingAway)"
[sub_resource type="AnimationNodeStateMachineTransition" id="Transition_Moving_InAir"]
advance_mode = 2
advance_expression = "not isOnSurface"
[sub_resource type="AnimationNodeStateMachineTransition" id="Transition_Moving_ReachX"]
advance_mode = 2
advance_expression = "isOnSurface and isHoldingAtEdge"
[sub_resource type="AnimationNodeStateMachineTransition" id="Transition_Moving_ReachY"]
advance_mode = 2
advance_expression = "isReachingAway and not isCrawling and not isHoldingAtEdge and not isPressingIntoSurface"
[sub_resource type="AnimationNodeStateMachineTransition" id="Transition_Moving_Crouch"]
advance_mode = 2
advance_expression = "isPressingIntoSurface and not isCrawling and not isHoldingAtEdge"
[sub_resource type="AnimationNodeStateMachineTransition" id="Transition_InAir_Idle"]
advance_mode = 2
advance_expression = "isOnSurface and not (isCrawling or isHoldingAtEdge or isPressingIntoSurface or isReachingAway)"
[sub_resource type="AnimationNodeStateMachineTransition" id="Transition_InAir_Moving"]
advance_mode = 2
advance_expression = "isCrawling and not isHoldingAtEdge"
[sub_resource type="AnimationNodeStateMachineTransition" id="Transition_InAir_ReachX"]
advance_mode = 2
advance_expression = "isOnSurface and isHoldingAtEdge"
[sub_resource type="AnimationNodeStateMachineTransition" id="Transition_InAir_ReachY"]
advance_mode = 2
advance_expression = "isReachingAway and not isCrawling and not isHoldingAtEdge and not isPressingIntoSurface"
[sub_resource type="AnimationNodeStateMachineTransition" id="Transition_InAir_Crouch"]
advance_mode = 2
advance_expression = "isPressingIntoSurface and not isCrawling and not isHoldingAtEdge"
[sub_resource type="AnimationNodeStateMachineTransition" id="Transition_ReachX_Idle"]
advance_mode = 2
advance_expression = "isOnSurface and not (isCrawling or isHoldingAtEdge or isPressingIntoSurface or isReachingAway)"
[sub_resource type="AnimationNodeStateMachineTransition" id="Transition_ReachX_Moving"]
advance_mode = 2
advance_expression = "isCrawling and not isHoldingAtEdge"
[sub_resource type="AnimationNodeStateMachineTransition" id="Transition_ReachX_InAir"]
advance_mode = 2
advance_expression = "not isOnSurface"
[sub_resource type="AnimationNodeStateMachineTransition" id="Transition_ReachX_ReachY"]
advance_mode = 2
advance_expression = "isReachingAway and not isCrawling and not isHoldingAtEdge and not isPressingIntoSurface"
[sub_resource type="AnimationNodeStateMachineTransition" id="Transition_ReachX_Crouch"]
advance_mode = 2
advance_expression = "isPressingIntoSurface and not isCrawling and not isHoldingAtEdge"
[sub_resource type="AnimationNodeStateMachineTransition" id="Transition_ReachY_Idle"]
advance_mode = 2
advance_expression = "isOnSurface and not (isCrawling or isHoldingAtEdge or isPressingIntoSurface or isReachingAway)"
[sub_resource type="AnimationNodeStateMachineTransition" id="Transition_ReachY_Moving"]
advance_mode = 2
advance_expression = "isCrawling and not isHoldingAtEdge"
[sub_resource type="AnimationNodeStateMachineTransition" id="Transition_ReachY_InAir"]
advance_mode = 2
advance_expression = "not isOnSurface"
[sub_resource type="AnimationNodeStateMachineTransition" id="Transition_ReachY_ReachX"]
advance_mode = 2
advance_expression = "isOnSurface and isHoldingAtEdge"
[sub_resource type="AnimationNodeStateMachineTransition" id="Transition_ReachY_Crouch"]
advance_mode = 2
advance_expression = "isPressingIntoSurface and not isCrawling and not isHoldingAtEdge"
[sub_resource type="AnimationNodeStateMachineTransition" id="Transition_Crouch_Idle"]
advance_mode = 2
advance_expression = "isOnSurface and not (isCrawling or isHoldingAtEdge or isPressingIntoSurface or isReachingAway)"
[sub_resource type="AnimationNodeStateMachineTransition" id="Transition_Crouch_Moving"]
advance_mode = 2
advance_expression = "isCrawling and not isHoldingAtEdge"
[sub_resource type="AnimationNodeStateMachineTransition" id="Transition_Crouch_InAir"]
advance_mode = 2
advance_expression = "not isOnSurface"
[sub_resource type="AnimationNodeStateMachineTransition" id="Transition_Crouch_ReachX"]
advance_mode = 2
advance_expression = "isOnSurface and isHoldingAtEdge"
[sub_resource type="AnimationNodeStateMachineTransition" id="Transition_Crouch_ReachY"]
advance_mode = 2
advance_expression = "isReachingAway and not isCrawling and not isHoldingAtEdge and not isPressingIntoSurface"
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_slime"]
states/Crouch/node = SubResource("AnimNode_Crouch")
states/Crouch/position = Vector2(150, 300)
states/Idle/node = SubResource("AnimNode_Idle")
states/Idle/position = Vector2(400, 100)
states/InAir/node = SubResource("AnimNode_InAir")
states/InAir/position = Vector2(400, -100)
states/Moving/node = SubResource("AnimNode_Moving")
states/Moving/position = Vector2(650, 100)
states/ReachX/node = SubResource("AnimNode_ReachX")
states/ReachX/position = Vector2(650, 300)
states/ReachY/node = SubResource("AnimNode_ReachY")
states/ReachY/position = Vector2(400, 300)
states/Start/position = Vector2(150, 100)
transitions = ["Start", "Idle", SubResource("Transition_Start"), "Idle", "Moving", SubResource("Transition_Idle_Moving"), "Idle", "InAir", SubResource("Transition_Idle_InAir"), "Idle", "ReachX", SubResource("Transition_Idle_ReachX"), "Idle", "ReachY", SubResource("Transition_Idle_ReachY"), "Idle", "Crouch", SubResource("Transition_Idle_Crouch"), "Moving", "Idle", SubResource("Transition_Moving_Idle"), "Moving", "InAir", SubResource("Transition_Moving_InAir"), "Moving", "ReachX", SubResource("Transition_Moving_ReachX"), "Moving", "ReachY", SubResource("Transition_Moving_ReachY"), "Moving", "Crouch", SubResource("Transition_Moving_Crouch"), "InAir", "Idle", SubResource("Transition_InAir_Idle"), "InAir", "Moving", SubResource("Transition_InAir_Moving"), "InAir", "ReachX", SubResource("Transition_InAir_ReachX"), "InAir", "ReachY", SubResource("Transition_InAir_ReachY"), "InAir", "Crouch", SubResource("Transition_InAir_Crouch"), "ReachX", "Idle", SubResource("Transition_ReachX_Idle"), "ReachX", "Moving", SubResource("Transition_ReachX_Moving"), "ReachX", "InAir", SubResource("Transition_ReachX_InAir"), "ReachX", "ReachY", SubResource("Transition_ReachX_ReachY"), "ReachX", "Crouch", SubResource("Transition_ReachX_Crouch"), "ReachY", "Idle", SubResource("Transition_ReachY_Idle"), "ReachY", "Moving", SubResource("Transition_ReachY_Moving"), "ReachY", "InAir", SubResource("Transition_ReachY_InAir"), "ReachY", "ReachX", SubResource("Transition_ReachY_ReachX"), "ReachY", "Crouch", SubResource("Transition_ReachY_Crouch"), "Crouch", "Idle", SubResource("Transition_Crouch_Idle"), "Crouch", "Moving", SubResource("Transition_Crouch_Moving"), "Crouch", "InAir", SubResource("Transition_Crouch_InAir"), "Crouch", "ReachX", SubResource("Transition_Crouch_ReachX"), "Crouch", "ReachY", SubResource("Transition_Crouch_ReachY")]
graph_offset = Vector2(0, -150)
[node name="Player" type="CharacterBody2D" unique_id=150873177] [node name="Player" type="CharacterBody2D" unique_id=150873177]
script = ExtResource("1_eovys") script = ExtResource("1_eovys")
landSounds = Array[AudioStream]([ExtResource("3_land1"), ExtResource("4_land2"), ExtResource("5_land3")]) landSounds = Array[AudioStream]([ExtResource("3_land1"), ExtResource("4_land2"), ExtResource("5_land3")])
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=402647784] [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." unique_id=402647784]
texture = ExtResource("5_4m0gv") sprite_frames = ExtResource("5_4m0gv")
animation = &"ReachY"
offset = Vector2(0, -6) offset = Vector2(0, -6)
hframes = 9
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1379572123] [node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1379572123]
shape = SubResource("CircleShape2D_eovys") shape = SubResource("CircleShape2D_eovys")
@ -329,7 +45,6 @@ spread = 55.0
gravity = Vector2(0, 500) gravity = Vector2(0, 500)
initial_velocity_min = 40.0 initial_velocity_min = 40.0
initial_velocity_max = 90.0 initial_velocity_max = 90.0
scale_amount_min = 2.0
scale_amount_max = 2.0 scale_amount_max = 2.0
color_initial_ramp = SubResource("Gradient_splat") color_initial_ramp = SubResource("Gradient_splat")
@ -341,12 +56,3 @@ bus = &"SFX"
stream = ExtResource("6_wrap") stream = ExtResource("6_wrap")
volume_db = -10.0 volume_db = -10.0
bus = &"SFX" bus = &"SFX"
[node name="AnimationPlayer" type="AnimationPlayer" parent="." unique_id=1488197074]
libraries/ = SubResource("AnimationLibrary_slime")
[node name="AnimationTree" type="AnimationTree" parent="." unique_id=1390314332]
callback_mode_process = 0
tree_root = SubResource("AnimationNodeStateMachine_slime")
advance_expression_base_node = NodePath("..")
anim_player = NodePath("../AnimationPlayer")

View file

@ -23,12 +23,8 @@ Settings="*res://Autoloads/settings.gd"
window/size/viewport_width=640 window/size/viewport_width=640
window/size/viewport_height=480 window/size/viewport_height=480
window/size/window_width_override=1280
window/size/window_height_override=960
window/size/mode=2
window/stretch/mode="viewport" window/stretch/mode="viewport"
window/stretch/aspect="expand" window/stretch/aspect="expand"
window/stretch/scale_mode="integer"
[dotnet] [dotnet]