Compare commits
3 commits
f1fc198a5b
...
ca6cc3a370
| Author | SHA1 | Date | |
|---|---|---|---|
| ca6cc3a370 | |||
| 98187b6742 | |||
| 38d7e6d761 |
5 changed files with 428 additions and 80 deletions
Binary file not shown.
|
Before Width: | Height: | Size: 2 KiB After Width: | Height: | Size: 2.1 KiB |
|
|
@ -2,6 +2,14 @@
|
|||
|
||||
[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"]
|
||||
load_path = "res://.godot/imported/Player.png-54d4b13ac506f96b99814af866f299ae.ctex"
|
||||
|
||||
|
|
@ -11,14 +19,18 @@ region = Rect2(0, 0, 64, 32)
|
|||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_1y441"]
|
||||
atlas = ExtResource("1_qkju4")
|
||||
region = Rect2(448, 0, 64, 32)
|
||||
region = Rect2(512, 0, 64, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_vhg5s"]
|
||||
atlas = SubResource("CompressedTexture2D_qkju4")
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_5232b"]
|
||||
atlas = ExtResource("1_qkju4")
|
||||
region = Rect2(0, 0, 64, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_cafjo"]
|
||||
atlas = ExtResource("1_qkju4")
|
||||
region = Rect2(64, 0, 64, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_lrw40"]
|
||||
atlas = SubResource("CompressedTexture2D_qkju4")
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_xqred"]
|
||||
atlas = ExtResource("1_qkju4")
|
||||
region = Rect2(128, 0, 64, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ygdw1"]
|
||||
|
|
@ -41,9 +53,28 @@ region = Rect2(256, 0, 64, 32)
|
|||
animations = [{
|
||||
"frames": [{
|
||||
"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")
|
||||
}],
|
||||
"loop": 1,
|
||||
"loop": 0,
|
||||
"name": &"Idle",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
|
|
@ -51,24 +82,21 @@ animations = [{
|
|||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_1y441")
|
||||
}],
|
||||
"loop": 1,
|
||||
"loop": 0,
|
||||
"name": &"InAir",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_65ufv")
|
||||
"texture": SubResource("AtlasTexture_5232b")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_vhg5s")
|
||||
"texture": SubResource("AtlasTexture_cafjo")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_lrw40")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_vhg5s")
|
||||
"texture": SubResource("AtlasTexture_xqred")
|
||||
}],
|
||||
"loop": 1,
|
||||
"loop": 2,
|
||||
"name": &"Moving",
|
||||
"speed": 7.0
|
||||
}, {
|
||||
|
|
@ -79,7 +107,7 @@ animations = [{
|
|||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_2f2n7")
|
||||
}],
|
||||
"loop": 1,
|
||||
"loop": 0,
|
||||
"name": &"ReachX",
|
||||
"speed": 4.0
|
||||
}, {
|
||||
|
|
@ -90,7 +118,7 @@ animations = [{
|
|||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_hy70p")
|
||||
}],
|
||||
"loop": 1,
|
||||
"loop": 0,
|
||||
"name": &"ReachY",
|
||||
"speed": 4.0
|
||||
}]
|
||||
|
|
|
|||
|
|
@ -76,10 +76,21 @@ var wrapArcStartAngle := 0.0 # Angle around the corner where the arc begins.
|
|||
var wrapSpeed := 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 ##
|
||||
###########
|
||||
@onready var sprite: AnimatedSprite2D = $AnimatedSprite2D
|
||||
@onready var sprite: Sprite2D = $Sprite2D
|
||||
@onready var collisionShape: CollisionShape2D = $CollisionShape2D
|
||||
# Edge-finding raycasts, one each side, under a pivot we turn to face the surface we're on.
|
||||
@onready var edgeSensors: Node2D = $EdgeSensors
|
||||
|
|
@ -108,8 +119,8 @@ func _ready() -> void:
|
|||
rightEdgeSensor.add_exception(self)
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
var xInput := Input.get_axis("moveLeft", "moveRight")
|
||||
var yInput := Input.get_axis("moveDown", "moveUp")
|
||||
# Note: Up is positive y.
|
||||
var moveInput := Vector2(Input.get_axis("moveLeft", "moveRight"), Input.get_axis("moveDown", "moveUp"))
|
||||
|
||||
if isWrapping:
|
||||
_update_wrap(delta)
|
||||
|
|
@ -119,18 +130,18 @@ func _physics_process(delta: float) -> void:
|
|||
if not wasInAir:
|
||||
isHoppingAcross = false
|
||||
|
||||
if isStickingToWall and yInput != 0.0:
|
||||
wallFacingY = -signf(yInput)
|
||||
if _start_edge_wrap(xInput, yInput):
|
||||
if isStickingToWall and moveInput.y != 0.0:
|
||||
wallFacingY = -signf(moveInput.y)
|
||||
if _start_edge_wrap(moveInput):
|
||||
return
|
||||
|
||||
# Animated Sprite
|
||||
_update_facing(xInput, yInput)
|
||||
_update_animation(xInput, yInput)
|
||||
_update_facing(moveInput)
|
||||
_update_animation_conditions(moveInput)
|
||||
|
||||
_update_vertical_movement(delta, xInput, yInput)
|
||||
_update_floor_hop(delta, xInput, yInput)
|
||||
_update_horizontal_movement(delta, xInput, yInput)
|
||||
_update_vertical_movement(delta, moveInput)
|
||||
_update_floor_hop(delta, moveInput)
|
||||
_update_horizontal_movement(delta, moveInput)
|
||||
_hold_at_edge(delta)
|
||||
|
||||
var wasOnWall := (isStickingToWall and not is_on_floor())
|
||||
|
|
@ -140,7 +151,7 @@ func _physics_process(delta: float) -> void:
|
|||
|
||||
_update_wall_sticking(wasOnWall)
|
||||
|
||||
var climbedPastWallTop := wasOnWall and not isStickingToWall and yInput > 0
|
||||
var climbedPastWallTop := wasOnWall and not isStickingToWall and moveInput.y > 0
|
||||
var tryingToLetGo := timeSpentUnstickingWall >= HOLD_TIME
|
||||
if climbedPastWallTop and not tryingToLetGo and _start_wall_top_wrap():
|
||||
return
|
||||
|
|
@ -149,7 +160,7 @@ func _physics_process(delta: float) -> void:
|
|||
|
||||
# In a corner, stick to the ceiling if pressing up, otherwise the wall.
|
||||
if isStickingToWall and isStickingToCeiling:
|
||||
if yInput > 0:
|
||||
if moveInput.y > 0:
|
||||
isStickingToWall = false
|
||||
else:
|
||||
isStickingToCeiling = false
|
||||
|
|
@ -165,54 +176,45 @@ func _physics_process(delta: float) -> void:
|
|||
|
||||
# ---- Movement steps (in the order _physics_process runs them) ----
|
||||
|
||||
func _update_facing(xInput: float, yInput: float) -> void:
|
||||
if xInput == 0.0 and yInput == 0.0:
|
||||
func _update_facing(moveInput: Vector2) -> void:
|
||||
if moveInput == Vector2.ZERO:
|
||||
return
|
||||
|
||||
if isStickingToCeiling:
|
||||
sprite.flip_h = xInput > 0 # Upside down, so flipped the other way.
|
||||
sprite.flip_h = moveInput.x > 0 # Upside down, so flipped the other way.
|
||||
elif isStickingToWall:
|
||||
if wallNormalX < 0: sprite.flip_h = yInput < 0
|
||||
else: sprite.flip_h = yInput > 0
|
||||
if wallNormalX < 0: sprite.flip_h = moveInput.y < 0
|
||||
else: sprite.flip_h = moveInput.y > 0
|
||||
else:
|
||||
sprite.flip_h = xInput < 0
|
||||
sprite.flip_h = moveInput.x < 0
|
||||
|
||||
func _update_animation(xInput:float, yInput:float):
|
||||
if xInput and (isStickingToCeiling or is_on_floor()) and timeSpentHoldingEdge == 0:
|
||||
sprite.play("Moving")
|
||||
elif yInput and isStickingToWall and timeSpentHoldingEdge == 0:
|
||||
sprite.play("Moving")
|
||||
# Facts the AnimationTree's state machine reads to pick an animation (see the
|
||||
# transitions' advance expressions in player.tscn).
|
||||
func _update_animation_conditions(moveInput: Vector2) -> void:
|
||||
isOnSurface = _get_surface_normal() != Vector2.ZERO
|
||||
isCrawling = ((moveInput.x != 0.0 and (isStickingToCeiling or is_on_floor()))
|
||||
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))
|
||||
|
||||
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:
|
||||
func _update_vertical_movement(delta: float, moveInput: Vector2) -> void:
|
||||
if isStickingToCeiling:
|
||||
_update_ceiling_letting_go(delta, xInput, yInput)
|
||||
_update_ceiling_letting_go(delta, moveInput)
|
||||
elif isStickingToWall:
|
||||
var targetSpeed := -CLIMB_SPEED * yInput
|
||||
var targetSpeed := -CLIMB_SPEED * moveInput.y
|
||||
velocity.y = _accelerate(velocity.y, targetSpeed, delta)
|
||||
elif not is_on_floor():
|
||||
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.
|
||||
func _update_ceiling_letting_go(delta: float, xInput: float, yInput: float) -> void:
|
||||
if yInput >= 0:
|
||||
func _update_ceiling_letting_go(delta: float, moveInput: Vector2) -> void:
|
||||
if moveInput.y >= 0:
|
||||
ignoreCeilingUnstickUntilRelease = false
|
||||
|
||||
var holdingDown := yInput < 0
|
||||
var standingStill := xInput == 0.0
|
||||
var holdingDown := moveInput.y < 0
|
||||
var standingStill := moveInput.x == 0.0
|
||||
if holdingDown and standingStill and not ignoreCeilingUnstickUntilRelease:
|
||||
timeSpentUnstickingCeiling += delta
|
||||
else:
|
||||
|
|
@ -230,8 +232,8 @@ func _update_ceiling_letting_go(delta: float, xInput: float, yInput: float) -> v
|
|||
velocity.y = get_gravity().y * delta
|
||||
|
||||
# Hopping from the floop while holding still.
|
||||
func _update_floor_hop(delta: float, xInput: float, yInput: float) -> void:
|
||||
if is_on_floor() and not isStickingToWall and xInput == 0.0 and yInput > 0:
|
||||
func _update_floor_hop(delta: float, moveInput: Vector2) -> void:
|
||||
if is_on_floor() and not isStickingToWall and moveInput.x == 0.0 and moveInput.y > 0:
|
||||
timeSpentHoldingUpOnFloor += delta
|
||||
else:
|
||||
timeSpentHoldingUpOnFloor = 0.0
|
||||
|
|
@ -240,25 +242,25 @@ func _update_floor_hop(delta: float, xInput: float, yInput: float) -> void:
|
|||
timeSpentHoldingUpOnFloor = 0.0
|
||||
velocity.y = -_get_hop_speed(_get_hop_height())
|
||||
|
||||
func _update_horizontal_movement(delta: float, xInput: float, yInput: float) -> void:
|
||||
func _update_horizontal_movement(delta: float, moveInput: Vector2) -> void:
|
||||
if isStickingToWall and not is_on_floor():
|
||||
_update_wall_letting_go(delta, xInput, yInput)
|
||||
_update_wall_letting_go(delta, moveInput)
|
||||
return
|
||||
|
||||
timeSpentUnstickingWall = 0.0
|
||||
if is_on_floor() or isStickingToCeiling:
|
||||
velocity.x = _accelerate(velocity.x, xInput * GROUND_SPEED, delta)
|
||||
velocity.x = _accelerate(velocity.x, moveInput.x * GROUND_SPEED, delta)
|
||||
elif not isHoppingAcross:
|
||||
velocity.x = _air_steer(velocity.x, xInput, delta)
|
||||
velocity.x = _air_steer(velocity.x, moveInput.x, delta)
|
||||
|
||||
# Holding away (not climbing) for HOLD_TIME hops to the opposite wall if one's
|
||||
# in reach, otherwise lets go.
|
||||
func _update_wall_letting_go(delta: float, xInput: float, yInput: float) -> void:
|
||||
var pressingAwayFromWall := xInput * wallNormalX > 0
|
||||
func _update_wall_letting_go(delta: float, moveInput: Vector2) -> void:
|
||||
var pressingAwayFromWall := moveInput.x * wallNormalX > 0
|
||||
if not pressingAwayFromWall:
|
||||
ignoreWallUnstickUntilRelease = false
|
||||
|
||||
var standingStill := yInput == 0.0
|
||||
var standingStill := moveInput.y == 0.0
|
||||
if pressingAwayFromWall and standingStill and not ignoreWallUnstickUntilRelease:
|
||||
timeSpentUnstickingWall += delta
|
||||
else:
|
||||
|
|
@ -272,7 +274,7 @@ func _update_wall_letting_go(delta: float, xInput: float, yInput: float) -> void
|
|||
if wallDistance >= 0.0:
|
||||
_hop_across(wallDistance)
|
||||
else:
|
||||
velocity.x = xInput * GROUND_SPEED
|
||||
velocity.x = moveInput.x * GROUND_SPEED
|
||||
|
||||
func _update_wall_sticking(wasOnWall: bool) -> void:
|
||||
var meantToLetGo := timeSpentUnstickingWall >= HOLD_TIME
|
||||
|
|
@ -300,7 +302,18 @@ func _update_sprite_rotation(delta: float) -> void:
|
|||
|
||||
# Smooth, and the same speed at any frame rate thanks to exp().
|
||||
var turnAmount := 1.0 - exp(-ROTATE_TO_SURFACE_SPEED * delta)
|
||||
sprite.rotation = lerp_angle(sprite.rotation, targetRotation, turnAmount)
|
||||
_set_sprite_rotation(lerp_angle(smoothSpriteRotation, 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 ----
|
||||
|
||||
|
|
@ -338,6 +351,15 @@ func _get_surface_normal() -> Vector2:
|
|||
if isStickingToWall: return Vector2(wallNormalX, 0)
|
||||
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:
|
||||
if is_on_floor():
|
||||
if sprite.flip_h:
|
||||
|
|
@ -386,12 +408,12 @@ func _hop_across(distance: float) -> void:
|
|||
# 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
|
||||
# only it has an edge).
|
||||
func _start_edge_wrap(xInput: float, yInput: float) -> bool:
|
||||
func _start_edge_wrap(moveInput: Vector2) -> bool:
|
||||
var normal := _get_surface_normal()
|
||||
if normal == Vector2.ZERO:
|
||||
return false
|
||||
|
||||
var inputDirection := Vector2(xInput, -yInput) # Up is negative y.
|
||||
var inputDirection := Vector2(moveInput.x, -moveInput.y) # Up is negative y.
|
||||
var pressingIntoSurface := inputDirection.dot(-normal) >= 0.5
|
||||
if not pressingIntoSurface:
|
||||
return false
|
||||
|
|
@ -564,7 +586,7 @@ func _update_wrap(delta: float) -> void:
|
|||
arcProgress = minf(distance / arcLength, 1.0)
|
||||
var angle := lerp_angle(wrapArcStartAngle, wrapOntoNormal.angle(), arcProgress)
|
||||
var positionOnArc := wrapCorner + Vector2.from_angle(angle) * _wrap_radius()
|
||||
sprite.rotation = lerp_angle(_rotation_for(wrapFromNormal), _rotation_for(wrapOntoNormal), arcProgress)
|
||||
_set_sprite_rotation(lerp_angle(_rotation_for(wrapFromNormal), _rotation_for(wrapOntoNormal), arcProgress))
|
||||
|
||||
# Exit.
|
||||
var exitProgress := maxf(distance - arcLength, 0.0) / exitOffset.length()
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
[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://bpa664tsd4kwn" path="res://Assets/Sounds/slime_land_2.ogg" id="4_land2"]
|
||||
[ext_resource type="SpriteFrames" uid="uid://d0suj5i5kalpp" path="res://Assets/slime_player.tres" id="5_4m0gv"]
|
||||
[ext_resource type="Texture2D" uid="uid://d1yojr8i1ffy4" path="res://Assets/Player.png" 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://1dmf4p7x4y3b" path="res://Assets/Sounds/slime_wrap.ogg" id="6_wrap"]
|
||||
|
||||
|
|
@ -12,14 +12,298 @@
|
|||
[sub_resource type="Gradient" id="Gradient_splat"]
|
||||
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]
|
||||
script = ExtResource("1_eovys")
|
||||
landSounds = Array[AudioStream]([ExtResource("3_land1"), ExtResource("4_land2"), ExtResource("5_land3")])
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." unique_id=402647784]
|
||||
sprite_frames = ExtResource("5_4m0gv")
|
||||
animation = &"ReachY"
|
||||
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=402647784]
|
||||
texture = ExtResource("5_4m0gv")
|
||||
offset = Vector2(0, -6)
|
||||
hframes = 9
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1379572123]
|
||||
shape = SubResource("CircleShape2D_eovys")
|
||||
|
|
@ -45,6 +329,7 @@ spread = 55.0
|
|||
gravity = Vector2(0, 500)
|
||||
initial_velocity_min = 40.0
|
||||
initial_velocity_max = 90.0
|
||||
scale_amount_min = 2.0
|
||||
scale_amount_max = 2.0
|
||||
color_initial_ramp = SubResource("Gradient_splat")
|
||||
|
||||
|
|
@ -56,3 +341,12 @@ bus = &"SFX"
|
|||
stream = ExtResource("6_wrap")
|
||||
volume_db = -10.0
|
||||
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")
|
||||
|
|
|
|||
|
|
@ -23,8 +23,12 @@ Settings="*res://Autoloads/settings.gd"
|
|||
|
||||
window/size/viewport_width=640
|
||||
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/aspect="expand"
|
||||
window/stretch/scale_mode="integer"
|
||||
|
||||
[dotnet]
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue