- Added extra frame when pressing towards a surface while attached to two surfaces.
This commit is contained in:
parent
16c5a2b96d
commit
df467b469d
4 changed files with 34 additions and 25 deletions
Binary file not shown.
|
Before Width: | Height: | Size: 3 KiB After Width: | Height: | Size: 3 KiB |
|
|
@ -91,8 +91,21 @@ const BRIDGE_LEAN_LEFT_FRAME = 12 # Most of us bunched at the bottom.
|
||||||
const BRIDGE_VERTICAL_FRAME = 13 # Floor to ceiling.
|
const BRIDGE_VERTICAL_FRAME = 13 # Floor to ceiling.
|
||||||
# Floor to ceiling, leaning towards the surface we're holding towards: most of
|
# Floor to ceiling, leaning towards the surface we're holding towards: most of
|
||||||
# us down on the floor, or up on the ceiling.
|
# us down on the floor, or up on the ceiling.
|
||||||
const BRIDGE_VERTICAL_DOWN_FRAME = 14
|
const BRIDGE_VERTICAL_DOWN_FRAME = 15
|
||||||
const BRIDGE_VERTICAL_UP_FRAME = 15
|
const BRIDGE_VERTICAL_UP_FRAME = 17
|
||||||
|
# Halfway into each lean. The lean animations open on these, then go on to the
|
||||||
|
# full lean.
|
||||||
|
const BRIDGE_LEAN_RIGHT_MID_FRAME = 18
|
||||||
|
const BRIDGE_LEAN_LEFT_MID_FRAME = 19
|
||||||
|
const BRIDGE_VERTICAL_DOWN_MID_FRAME = 14
|
||||||
|
const BRIDGE_VERTICAL_UP_MID_FRAME = 16
|
||||||
|
# Every column frame, all centred between the surfaces (see _align_press_wall_sprite).
|
||||||
|
const BRIDGE_FRAMES = [
|
||||||
|
BRIDGE_FRAME, BRIDGE_LEAN_RIGHT_FRAME, BRIDGE_LEAN_LEFT_FRAME,
|
||||||
|
BRIDGE_LEAN_RIGHT_MID_FRAME, BRIDGE_LEAN_LEFT_MID_FRAME,
|
||||||
|
BRIDGE_VERTICAL_FRAME, BRIDGE_VERTICAL_DOWN_FRAME, BRIDGE_VERTICAL_UP_FRAME,
|
||||||
|
BRIDGE_VERTICAL_DOWN_MID_FRAME, BRIDGE_VERTICAL_UP_MID_FRAME,
|
||||||
|
]
|
||||||
const BRIDGE_GAP = 32.0 # One tile.
|
const BRIDGE_GAP = 32.0 # One tile.
|
||||||
const BRIDGE_GAP_TOLERANCE = 1.5
|
const BRIDGE_GAP_TOLERANCE = 1.5
|
||||||
# How long we show the plain bridge frame after attaching before leaning towards
|
# How long we show the plain bridge frame after attaching before leaning towards
|
||||||
|
|
@ -224,7 +237,7 @@ func _ready() -> void:
|
||||||
# they reform as from the sprite's offset, and that must not carry the shift.
|
# they reform as from the sprite's offset, and that must not carry the shift.
|
||||||
func _align_press_wall_sprite() -> void:
|
func _align_press_wall_sprite() -> void:
|
||||||
var targetPosition := spriteBasePosition
|
var targetPosition := spriteBasePosition
|
||||||
if sprite.frame in [BRIDGE_FRAME, BRIDGE_LEAN_RIGHT_FRAME, BRIDGE_LEAN_LEFT_FRAME, BRIDGE_VERTICAL_FRAME, BRIDGE_VERTICAL_DOWN_FRAME, BRIDGE_VERTICAL_UP_FRAME]:
|
if sprite.frame in BRIDGE_FRAMES:
|
||||||
# The sprite's offset lifts it off the surface we're on. Undo that so the
|
# The sprite's offset lifts it off the surface we're on. Undo that so the
|
||||||
# column sits centred on us, between the surfaces.
|
# column sits centred on us, between the surfaces.
|
||||||
targetPosition -= sprite.offset.rotated(sprite.rotation).round()
|
targetPosition -= sprite.offset.rotated(sprite.rotation).round()
|
||||||
|
|
@ -673,18 +686,18 @@ func _show_bridge_pose() -> void:
|
||||||
# and its top on the right.
|
# and its top on the right.
|
||||||
_set_sprite_rotation(_rotation_for(Vector2.RIGHT))
|
_set_sprite_rotation(_rotation_for(Vector2.RIGHT))
|
||||||
if bridgeLean < 0:
|
if bridgeLean < 0:
|
||||||
_show_pose(&"BridgeLeanLeft", BRIDGE_LEAN_LEFT_FRAME)
|
_show_pose(&"BridgeLeanLeft", BRIDGE_LEAN_LEFT_MID_FRAME)
|
||||||
elif bridgeLean > 0:
|
elif bridgeLean > 0:
|
||||||
_show_pose(&"BridgeLeanRight", BRIDGE_LEAN_RIGHT_FRAME)
|
_show_pose(&"BridgeLeanRight", BRIDGE_LEAN_RIGHT_MID_FRAME)
|
||||||
else:
|
else:
|
||||||
_show_pose(&"Bridge", BRIDGE_FRAME)
|
_show_pose(&"Bridge", BRIDGE_FRAME)
|
||||||
else:
|
else:
|
||||||
# Upright.
|
# Upright.
|
||||||
_set_sprite_rotation(0.0)
|
_set_sprite_rotation(0.0)
|
||||||
if bridgeLean < 0:
|
if bridgeLean < 0:
|
||||||
_show_pose(&"BridgeVerticalUp", BRIDGE_VERTICAL_UP_FRAME)
|
_show_pose(&"BridgeVerticalUp", BRIDGE_VERTICAL_UP_MID_FRAME)
|
||||||
elif bridgeLean > 0:
|
elif bridgeLean > 0:
|
||||||
_show_pose(&"BridgeVerticalDown", BRIDGE_VERTICAL_DOWN_FRAME)
|
_show_pose(&"BridgeVerticalDown", BRIDGE_VERTICAL_DOWN_MID_FRAME)
|
||||||
else:
|
else:
|
||||||
_show_pose(&"BridgeVertical", BRIDGE_VERTICAL_FRAME)
|
_show_pose(&"BridgeVertical", BRIDGE_VERTICAL_FRAME)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@ tracks/0/keys = {
|
||||||
[sub_resource type="Animation" id="Animation_BridgeLeanRight"]
|
[sub_resource type="Animation" id="Animation_BridgeLeanRight"]
|
||||||
resource_name = "BridgeLeanRight"
|
resource_name = "BridgeLeanRight"
|
||||||
length = 0.2
|
length = 0.2
|
||||||
loop_mode = 1
|
|
||||||
tracks/0/type = "value"
|
tracks/0/type = "value"
|
||||||
tracks/0/imported = false
|
tracks/0/imported = false
|
||||||
tracks/0/enabled = true
|
tracks/0/enabled = true
|
||||||
|
|
@ -40,16 +39,15 @@ tracks/0/path = NodePath("Sprite2D:frame")
|
||||||
tracks/0/interp = 1
|
tracks/0/interp = 1
|
||||||
tracks/0/loop_wrap = true
|
tracks/0/loop_wrap = true
|
||||||
tracks/0/keys = {
|
tracks/0/keys = {
|
||||||
"times": PackedFloat32Array(0),
|
"times": PackedFloat32Array(0, 0.1),
|
||||||
"transitions": PackedFloat32Array(1),
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
"update": 1,
|
"update": 1,
|
||||||
"values": [11]
|
"values": [18, 11]
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_BridgeLeanLeft"]
|
[sub_resource type="Animation" id="Animation_BridgeLeanLeft"]
|
||||||
resource_name = "BridgeLeanLeft"
|
resource_name = "BridgeLeanLeft"
|
||||||
length = 0.2
|
length = 0.2
|
||||||
loop_mode = 1
|
|
||||||
tracks/0/type = "value"
|
tracks/0/type = "value"
|
||||||
tracks/0/imported = false
|
tracks/0/imported = false
|
||||||
tracks/0/enabled = true
|
tracks/0/enabled = true
|
||||||
|
|
@ -57,10 +55,10 @@ tracks/0/path = NodePath("Sprite2D:frame")
|
||||||
tracks/0/interp = 1
|
tracks/0/interp = 1
|
||||||
tracks/0/loop_wrap = true
|
tracks/0/loop_wrap = true
|
||||||
tracks/0/keys = {
|
tracks/0/keys = {
|
||||||
"times": PackedFloat32Array(0),
|
"times": PackedFloat32Array(0, 0.1),
|
||||||
"transitions": PackedFloat32Array(1),
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
"update": 1,
|
"update": 1,
|
||||||
"values": [12]
|
"values": [19, 12]
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_BridgeVertical"]
|
[sub_resource type="Animation" id="Animation_BridgeVertical"]
|
||||||
|
|
@ -83,7 +81,6 @@ tracks/0/keys = {
|
||||||
[sub_resource type="Animation" id="Animation_BridgeVerticalDown"]
|
[sub_resource type="Animation" id="Animation_BridgeVerticalDown"]
|
||||||
resource_name = "BridgeVerticalDown"
|
resource_name = "BridgeVerticalDown"
|
||||||
length = 0.2
|
length = 0.2
|
||||||
loop_mode = 1
|
|
||||||
tracks/0/type = "value"
|
tracks/0/type = "value"
|
||||||
tracks/0/imported = false
|
tracks/0/imported = false
|
||||||
tracks/0/enabled = true
|
tracks/0/enabled = true
|
||||||
|
|
@ -91,16 +88,15 @@ tracks/0/path = NodePath("Sprite2D:frame")
|
||||||
tracks/0/interp = 1
|
tracks/0/interp = 1
|
||||||
tracks/0/loop_wrap = true
|
tracks/0/loop_wrap = true
|
||||||
tracks/0/keys = {
|
tracks/0/keys = {
|
||||||
"times": PackedFloat32Array(0),
|
"times": PackedFloat32Array(0, 0.1),
|
||||||
"transitions": PackedFloat32Array(1),
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
"update": 1,
|
"update": 1,
|
||||||
"values": [14]
|
"values": [14, 15]
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_BridgeVerticalUp"]
|
[sub_resource type="Animation" id="Animation_BridgeVerticalUp"]
|
||||||
resource_name = "BridgeVerticalUp"
|
resource_name = "BridgeVerticalUp"
|
||||||
length = 0.2
|
length = 0.2
|
||||||
loop_mode = 1
|
|
||||||
tracks/0/type = "value"
|
tracks/0/type = "value"
|
||||||
tracks/0/imported = false
|
tracks/0/imported = false
|
||||||
tracks/0/enabled = true
|
tracks/0/enabled = true
|
||||||
|
|
@ -108,10 +104,10 @@ tracks/0/path = NodePath("Sprite2D:frame")
|
||||||
tracks/0/interp = 1
|
tracks/0/interp = 1
|
||||||
tracks/0/loop_wrap = true
|
tracks/0/loop_wrap = true
|
||||||
tracks/0/keys = {
|
tracks/0/keys = {
|
||||||
"times": PackedFloat32Array(0),
|
"times": PackedFloat32Array(0, 0.1),
|
||||||
"transitions": PackedFloat32Array(1),
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
"update": 1,
|
"update": 1,
|
||||||
"values": [15]
|
"values": [16, 17]
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_Crouch"]
|
[sub_resource type="Animation" id="Animation_Crouch"]
|
||||||
|
|
@ -584,7 +580,7 @@ landSounds = Array[AudioStream]([ExtResource("3_land1"), ExtResource("4_land2"),
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=402647784]
|
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=402647784]
|
||||||
texture = ExtResource("5_4m0gv")
|
texture = ExtResource("5_4m0gv")
|
||||||
offset = Vector2(0, -6)
|
offset = Vector2(0, -6)
|
||||||
hframes = 4
|
hframes = 5
|
||||||
vframes = 4
|
vframes = 4
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1379572123]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1379572123]
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ extends Camera2D
|
||||||
class_name RoomCamera
|
class_name RoomCamera
|
||||||
|
|
||||||
# Splits the level into screen-sized rooms and snaps to whichever room the
|
# Splits the level into screen-sized rooms and snaps to whichever room the
|
||||||
# target is in, VVVVVV style: the camera never scrolls, it just cuts to the
|
# target is in: the camera never scrolls, it just cuts to the
|
||||||
# next screen when the target crosses a room border.
|
# next screen when the target crosses a room border.
|
||||||
#
|
#
|
||||||
# Room (0, 0) has its top-left corner at the level's origin, room (1, 0) is the
|
# Room (0, 0) has its top-left corner at the level's origin, room (1, 0) is the
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue