diff --git a/Assets/Player.png b/Assets/Player.png index 2853cbe..7737ae9 100755 Binary files a/Assets/Player.png and b/Assets/Player.png differ diff --git a/Assets/slime_player.tres b/Assets/slime_player.tres index 2f0e5d8..21fc699 100755 --- a/Assets/slime_player.tres +++ b/Assets/slime_player.tres @@ -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 }] diff --git a/Characters/player.gd b/Characters/player.gd index 3c2de03..bca8bd7 100755 --- a/Characters/player.gd +++ b/Characters/player.gd @@ -43,7 +43,6 @@ const ROTATE_TO_SURFACE_SPEED = 25.0 const MIN_LAND_SPEED_FOR_SPLAT = 60.0 const LAND_PITCH_MIN = 0.87 const LAND_PITCH_MAX = 1.15 -const RESPAWN_DELAY = 2.5 # Prototype: reloads the level this long after shattering. ############### ## Variables ## @@ -77,12 +76,21 @@ var wrapArcStartAngle := 0.0 # Angle around the corner where the arc begins. var wrapSpeed := 0.0 var wrapDistanceTravelled := 0.0 -var isShattered := false +# 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 @@ -111,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) @@ -122,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()) @@ -143,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 @@ -152,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 @@ -168,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") - - elif !is_on_floor() and !isStickingToWall and !isStickingToCeiling: - sprite.play("InAir") - - elif _get_surface_normal() != Vector2.ZERO and timeSpentHoldingEdge > 0: - sprite.play("ReachX") +# 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 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: @@ -233,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 @@ -243,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: @@ -275,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 @@ -303,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 ---- @@ -341,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: @@ -389,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 @@ -567,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() @@ -645,22 +664,6 @@ func _splat(normal: Vector2) -> void: landSound.pitch_scale = randf_range(LAND_PITCH_MIN, LAND_PITCH_MAX) landSound.play() -# Bursts into a particle per (non-black) pixel of the current frame. -# push: the direction we were hit towards. exclude: bodies the pixels pass through. -func shatter(push: Vector2, exclude: Array[RID] = []) -> void: - if isShattered: - return - isShattered = true - - var burst := PixelBurst.new() - get_parent().add_child(burst) - burst.burst_from_sprite(sprite, push, exclude) - - hide() - set_physics_process(false) - collisionShape.set_deferred("disabled", true) - get_tree().create_timer(RESPAWN_DELAY).timeout.connect(get_tree().reload_current_scene) - # ---- Physics queries (all ignore the slime itself) ---- func _get_radius() -> float: diff --git a/Characters/player.tscn b/Characters/player.tscn index 207b16a..04cf2e9 100755 --- a/Characters/player.tscn +++ b/Characters/player.tscn @@ -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") diff --git a/Effects/pixel_burst.gd b/Effects/pixel_burst.gd deleted file mode 100644 index 975f656..0000000 --- a/Effects/pixel_burst.gd +++ /dev/null @@ -1,169 +0,0 @@ -class_name PixelBurst -extends Node2D - -# Breaks a sprite's current frame into chunks of CHUNK_SIZE x CHUNK_SIZE pixels. -# Each chunk is a small physics body, so they bounce off the level and pile up -# on each other. Black (outline) and transparent pixels are left out; a chunk -# with nothing else in it isn't made at all. - -const CHUNK_SIZE = 2 # Sprite pixels per side of a chunk. 1 = a body per pixel. -const BLACK_THRESHOLD = 0.1 # Pixels with all channels below this count as black. - -# Chunks are on their own physics layer (3) so the slime doesn't bump into them. -const CHUNK_LAYER = 1 << 2 -const CHUNK_MASK = 1 | CHUNK_LAYER # The level, hazards, and other chunks. -# A hair smaller than the chunk so neighbours don't start out overlapping. -const SHAPE_SHRINK = 0.1 -const MAX_PUSH_OUT = 16 # Chunks spawned inside the level move out by up to this. -# How long chunks ignore the `exclude` bodies, e.g. to get out from under the piston head. -const EXCLUDE_TIME = 1.0 - -const CHUNK_FRICTION = 0.8 -const CHUNK_BOUNCE = 0.2 -const CHUNK_MASS = 0.05 - -# How hard chunks squirt out sideways from under whatever pushed them, and back against it. -const SIDEWAYS_SPEED_MIN = 40.0 -const SIDEWAYS_SPEED_MAX = 220.0 -const BACK_SPEED_MIN = 20.0 -const BACK_SPEED_MAX = 180.0 - -var chunks: Array[RigidBody2D] = [] - - -# push: the direction the sprite was hit towards (e.g. DOWN for a piston from above). -# exclude: bodies the chunks pass through for EXCLUDE_TIME (e.g. the piston head). -func burst_from_sprite(sprite: AnimatedSprite2D, push: Vector2, exclude: Array[RID] = []) -> void: - top_level = true - global_position = Vector2.ZERO - z_index = sprite.z_index + 1 - - var texture := sprite.sprite_frames.get_frame_texture(sprite.animation, sprite.frame) - var image := _get_image(texture) - if image == null: - return - - var size := image.get_size() - var spriteTransform := sprite.get_global_transform() - var center := sprite.global_position - var sideways := push.orthogonal() - # Chunks stay upright (rotation locked), so turn their pixels to the nearest - # quarter turn of the sprite instead. - var quarterTurns := posmod(roundi(sprite.global_rotation / (PI / 2)), 4) - - var material := PhysicsMaterial.new() - material.friction = CHUNK_FRICTION - material.bounce = CHUNK_BOUNCE - var shape := RectangleShape2D.new() - shape.size = Vector2.ONE * (CHUNK_SIZE - SHAPE_SHRINK) - - for chunkY in range(0, size.y, CHUNK_SIZE): - for chunkX in range(0, size.x, CHUNK_SIZE): - var chunkImage := _make_chunk_image(image, Vector2i(chunkX, chunkY)) - if chunkImage == null: - continue - if sprite.flip_h: - chunkImage.flip_x() - if sprite.flip_v: - chunkImage.flip_y() - for turn in quarterTurns: - chunkImage.rotate_90(CLOCKWISE) - - # Chunk centre in the sprite's local space (it's centered). - var localCenter := Vector2(chunkX, chunkY) + Vector2.ONE * CHUNK_SIZE / 2.0 - Vector2(size) / 2.0 - if sprite.flip_h: - localCenter.x = -localCenter.x - if sprite.flip_v: - localCenter.y = -localCenter.y - var worldPoint := spriteTransform * (localCenter + sprite.offset) - worldPoint = _push_out_of_solid(worldPoint, -push, shape, exclude) - - var side := signf((worldPoint - center).dot(sideways)) - if side == 0.0: - side = [-1.0, 1.0].pick_random() - var velocity := sideways * side * randf_range(SIDEWAYS_SPEED_MIN, SIDEWAYS_SPEED_MAX) - velocity -= push * randf_range(BACK_SPEED_MIN, BACK_SPEED_MAX) - - _spawn_chunk(chunkImage, worldPoint, velocity, shape, material, exclude) - - -func _spawn_chunk(chunkImage: Image, at: Vector2, velocity: Vector2, shape: Shape2D, - material: PhysicsMaterial, exclude: Array[RID]) -> void: - var body := RigidBody2D.new() - body.collision_layer = CHUNK_LAYER - body.collision_mask = CHUNK_MASK - body.lock_rotation = true - body.mass = CHUNK_MASS - body.physics_material_override = material - body.continuous_cd = RigidBody2D.CCD_MODE_CAST_RAY # Small and fast: don't skip through things. - body.position = at - body.linear_velocity = velocity - - var collision := CollisionShape2D.new() - collision.shape = shape - body.add_child(collision) - - var chunkSprite := Sprite2D.new() - chunkSprite.texture = ImageTexture.create_from_image(chunkImage) - body.add_child(chunkSprite) - - add_child(body) - chunks.append(body) - - if exclude.is_empty(): - return - for rid in exclude: - PhysicsServer2D.body_add_collision_exception(body.get_rid(), rid) - get_tree().create_timer(EXCLUDE_TIME, false, true).timeout.connect(func() -> void: - if is_instance_valid(body): - for rid in exclude: - PhysicsServer2D.body_remove_collision_exception(body.get_rid(), rid) - ) - - -# The chunk's pixels with black ones made transparent, or null if nothing's left. -func _make_chunk_image(image: Image, topLeft: Vector2i) -> Image: - var region := Rect2i(topLeft, Vector2i.ONE * CHUNK_SIZE).intersection(Rect2i(Vector2i.ZERO, image.get_size())) - var chunkImage := image.get_region(region) - chunkImage.convert(Image.FORMAT_RGBA8) - var hasColor := false - for y in chunkImage.get_height(): - for x in chunkImage.get_width(): - var color := chunkImage.get_pixel(x, y) - if color.a < 0.5 or _is_black(color): - chunkImage.set_pixel(x, y, Color.TRANSPARENT) - else: - hasColor = true - if not hasColor: - return null - return chunkImage - - -func _is_black(color: Color) -> bool: - return color.r < BLACK_THRESHOLD and color.g < BLACK_THRESHOLD and color.b < BLACK_THRESHOLD - - -# Moves a spot where the chunk would start inside the level out along `direction`, a pixel at a time. -func _push_out_of_solid(point: Vector2, direction: Vector2, shape: Shape2D, exclude: Array[RID]) -> Vector2: - var query := PhysicsShapeQueryParameters2D.new() - query.shape = shape - query.collision_mask = 1 # Just the level and hazards, not other chunks. - query.exclude = exclude - for step in MAX_PUSH_OUT: - query.transform = Transform2D(0.0, point) - if get_world_2d().direct_space_state.intersect_shape(query, 1).is_empty(): - break - point += direction - return point - - -func _get_image(texture: Texture2D) -> Image: - var image: Image - if texture is AtlasTexture: - var atlas := texture as AtlasTexture - image = atlas.atlas.get_image().get_region(Rect2i(atlas.region)) - else: - image = texture.get_image() - if image != null and image.is_compressed(): - image.decompress() - return image diff --git a/Effects/pixel_burst.gd.uid b/Effects/pixel_burst.gd.uid deleted file mode 100644 index 4fdd91d..0000000 --- a/Effects/pixel_burst.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://hmc5cy1srfxt diff --git a/Hazards/piston.gd b/Hazards/piston.gd deleted file mode 100644 index 0052972..0000000 --- a/Hazards/piston.gd +++ /dev/null @@ -1,144 +0,0 @@ -@tool -extends Node2D - -# A piston that slams down on a timer. Anything with a shatter() method caught -# under the head while it slams (or is down) gets shattered. -# The node's origin is the bottom of the housing; the head hangs just below it. -# Rotate the node to slam in other directions. - -enum State { WAITING, WINDUP, SLAMMING, HOLDING, RETRACTING } - -@export var slamDistance := 80.0: # How far the head travels down from rest. - set(value): - slamDistance = value - _rebuild() -@export var headSize := Vector2(48, 16): - set(value): - headSize = value - _rebuild() -@export var startDelay := 0.0 # Offset the timer, to stagger several pistons. -@export var waitTime := 1.5 # Retracted time between slams. -@export var windupTime := 0.35 # A short lift and shake before slamming, as a warning. -@export var slamSpeed := 900.0 -@export var holdTime := 0.4 -@export var retractSpeed := 80.0 - -const WINDUP_LIFT = 4.0 -const WINDUP_SHAKE = 1.0 -const HOUSING_HEIGHT = 24.0 -const SHAFT_WIDTH = 10.0 -const SHAFT_OVERLAP = 4.0 # How far the shaft starts up inside the housing. -const CRUSH_ZONE_DEPTH = 4.0 # How far below the head the crush check reaches. -const CRUSH_ZONE_INSET = 2.0 # Narrower than the head, so brushing its side is safe. - -const HEAD_COLOR = Color(0.55, 0.57, 0.62) -const HEAD_STRIPE_COLOR = Color(0.85, 0.65, 0.1) -const SHAFT_COLOR = Color(0.35, 0.36, 0.4) -const HOUSING_COLOR = Color(0.25, 0.26, 0.3) - -var state := State.WAITING -var stateTime := 0.0 -var headOffset := 0.0 # How far the head is below rest. - -@onready var head: AnimatableBody2D = $Head -@onready var headShape: CollisionShape2D = $Head/CollisionShape2D -@onready var crushZone: Area2D = $Head/CrushZone -@onready var crushShape: CollisionShape2D = $Head/CrushZone/CollisionShape2D -@onready var plate: Polygon2D = $Head/Plate -@onready var stripe: Polygon2D = $Head/Stripe -@onready var shaft: Polygon2D = $Shaft -@onready var housing: Polygon2D = $Housing - - -func _ready() -> void: - _rebuild() - stateTime = -startDelay - _place_head(0.0, 0.0) - - -func _physics_process(delta: float) -> void: - if Engine.is_editor_hint(): - return - - stateTime += delta - match state: - State.WAITING: - if stateTime >= waitTime: - _set_state(State.WINDUP) - State.WINDUP: - var progress := minf(stateTime / windupTime, 1.0) - var shake := randf_range(-WINDUP_SHAKE, WINDUP_SHAKE) - _place_head(-WINDUP_LIFT * progress, shake) - if stateTime >= windupTime: - _set_state(State.SLAMMING) - State.SLAMMING: - _place_head(minf(headOffset + slamSpeed * delta, slamDistance), 0.0) - _crush() - if headOffset >= slamDistance: - _set_state(State.HOLDING) - State.HOLDING: - _crush() # Overlaps from the last slam frame show up a frame late. - if stateTime >= holdTime: - _set_state(State.RETRACTING) - State.RETRACTING: - _place_head(maxf(headOffset - retractSpeed * delta, 0.0), 0.0) - if headOffset <= 0.0: - _set_state(State.WAITING) - - -func _set_state(newState: State) -> void: - state = newState - stateTime = 0.0 - - -func _crush() -> void: - var slamDirection := Vector2.DOWN.rotated(global_rotation) - var passThrough: Array[RID] = [head.get_rid()] - for body in crushZone.get_overlapping_bodies(): - if body.has_method("shatter"): - body.shatter(slamDirection, passThrough) - - -func _place_head(offset: float, shakeX: float) -> void: - headOffset = offset - head.position = Vector2(shakeX, headOffset + headSize.y / 2.0) - # The shaft is a 1px tall rect stretched from inside the housing down to the head. - shaft.scale.y = maxf(headOffset, 0.0) + SHAFT_OVERLAP - - -# Sizes the shapes and visuals from the exports. Runs in the editor too, as a preview. -func _rebuild() -> void: - if not is_node_ready(): - return - - var headRect := RectangleShape2D.new() - headRect.size = headSize - headShape.shape = headRect - - var crushRect := RectangleShape2D.new() - crushRect.size = Vector2(headSize.x - CRUSH_ZONE_INSET * 2, headSize.y + CRUSH_ZONE_DEPTH) - crushShape.shape = crushRect - crushShape.position = Vector2(0, CRUSH_ZONE_DEPTH / 2.0) - - var half := headSize / 2.0 - plate.polygon = _rect_polygon(-half, half) - plate.color = HEAD_COLOR - stripe.polygon = _rect_polygon(Vector2(-half.x, half.y - 3), Vector2(half.x, half.y - 1)) - stripe.color = HEAD_STRIPE_COLOR - - shaft.polygon = _rect_polygon(Vector2(-SHAFT_WIDTH / 2, 0), Vector2(SHAFT_WIDTH / 2, 1)) - shaft.color = SHAFT_COLOR - shaft.position = Vector2(0, -SHAFT_OVERLAP) - - var housingHalfWidth := maxf(headSize.x / 2.0 - 6.0, SHAFT_WIDTH) - housing.polygon = _rect_polygon(Vector2(-housingHalfWidth, -HOUSING_HEIGHT), Vector2(housingHalfWidth, 0)) - housing.color = HOUSING_COLOR - - _place_head(headOffset, 0.0) - - -func _rect_polygon(topLeft: Vector2, bottomRight: Vector2) -> PackedVector2Array: - return PackedVector2Array([ - topLeft, Vector2(bottomRight.x, topLeft.y), - bottomRight, Vector2(topLeft.x, bottomRight.y), - ]) diff --git a/Hazards/piston.gd.uid b/Hazards/piston.gd.uid deleted file mode 100644 index e67e1d3..0000000 --- a/Hazards/piston.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://11w13udqki1x diff --git a/Hazards/piston.tscn b/Hazards/piston.tscn deleted file mode 100644 index 00e172a..0000000 --- a/Hazards/piston.tscn +++ /dev/null @@ -1,24 +0,0 @@ -[gd_scene format=3] - -[ext_resource type="Script" path="res://Hazards/piston.gd" id="1_piston"] - -[node name="Piston" type="Node2D"] -script = ExtResource("1_piston") - -[node name="Shaft" type="Polygon2D" parent="."] - -[node name="Head" type="AnimatableBody2D" parent="."] -position = Vector2(0, 8) - -[node name="CollisionShape2D" type="CollisionShape2D" parent="Head"] - -[node name="Plate" type="Polygon2D" parent="Head"] - -[node name="Stripe" type="Polygon2D" parent="Head"] - -[node name="CrushZone" type="Area2D" parent="Head"] -monitorable = false - -[node name="CollisionShape2D" type="CollisionShape2D" parent="Head/CrushZone"] - -[node name="Housing" type="Polygon2D" parent="."] diff --git a/Levels/test_level.tscn b/Levels/test_level.tscn index eae422a..27592a1 100755 --- a/Levels/test_level.tscn +++ b/Levels/test_level.tscn @@ -3,7 +3,6 @@ [ext_resource type="PackedScene" uid="uid://uaxviwb40nn8" path="res://Characters/player.tscn" id="1_ormqy"] [ext_resource type="TileSet" uid="uid://tuiytikmuvdy" path="res://Assets/level_tiles.tres" id="2_4k50d"] [ext_resource type="PackedScene" path="res://UI/pause_menu.tscn" id="3_pause"] -[ext_resource type="PackedScene" path="res://Hazards/piston.tscn" id="4_piston"] [node name="TestLevel" type="Node2D" unique_id=1824208737] @@ -14,9 +13,6 @@ position = Vector2(329, 266) tile_map_data = PackedByteArray("AAAAAA4AAAAAAAAAAAABAA4AAAAAAAAAAAACAA4AAAAAAAAAAAADAA4AAAAAAAAAAAAEAA4AAAAAAAAAAAAFAA4AAAAAAAAAAAAGAA4AAAAAAAAAAAAHAA4AAAAAAAAAAAAIAA4AAAAAAAAAAAAJAA4AAAAAAAAAAAAKAA4AAAAAAAAAAAALAA4AAAAAAAAAAAAMAA4AAAAAAAAAAAANAA4AAAAAAAAAAAAOAA4AAAAAAAAAAAAPAA4AAAAAAAAAAAAQAA4AAAAAAAAAAAARAA4AAAAAAAAAAAASAA4AAAAAAAAAAAATAA4AAAAAAAAAAAAKAAsAAAAAAAAAAAAJAAsAAAAAAAAAAAAJAAwAAAAAAAAAAAAJAA0AAAAAAAAAAAAKAA0AAAAAAAAAAAAKAAwAAAAAAAAAAAATAA0AAAAAAAAAAAATAAwAAAAAAAAAAAATAAsAAAAAAAAAAAATAAoAAAAAAAAAAAATAAkAAAAAAAAAAAATAAgAAAAAAAAAAAATAAcAAAAAAAAAAAATAAYAAAAAAAAAAAATAAUAAAAAAAAAAAATAAQAAAAAAAAAAAATAAMAAAAAAAAAAAATAAIAAAAAAAAAAAATAAEAAAAAAAAAAAATAAAAAAAAAAAAAAASAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAPAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAANAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAALAAAAAAAAAAAAAAAKAAAAAAAAAAAAAAAJAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAHAAAAAAAAAAAAAAAGAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAADAAAAAAAAAAAAAAACAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAAoAAAAAAAAAAAAAAAsAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAA0AAAAAAAAAAAAQAA0AAAAAAAAAAAAQAAsAAAAAAAAAAAARAAsAAAAAAAAAAAASAAsAAAAAAAAAAAAQAAwAAAABAAAAAAASAAkAAAAAAAAAAAARAAkAAAAAAAAAAAARAAgAAAAAAAAAAAARAAcAAAAAAAAAAAACAAwAAAAAAAAAAAACAAsAAAAAAAAAAAACAAoAAAAAAAAAAAADAAoAAAAAAAAAAAAEAAoAAAAAAAAAAAAEAAsAAAAAAAAAAAAEAAwAAAAAAAAAAAABAAgAAAAAAAAAAAACAAgAAAAAAAAAAAADAAgAAAAAAAAAAAAEAAgAAAAAAAAAAAACAAYAAAAAAAAAAAADAAYAAAAAAAAAAAAEAAYAAAAAAAAAAAACAAUAAAAAAAAAAAACAAQAAAAAAAAAAAACAAMAAAAAAAAAAAACAAIAAAAAAAAAAAAEAAIAAAAAAAAAAAAEAAMAAAAAAAAAAAAEAAQAAAAAAAAAAAAEAAUAAAAAAAAAAAASAAQAAAAAAAAAAAARAAQAAAAAAAAAAAAQAAQAAAAAAAAAAAAPAAQAAAAAAAAAAAAOAAQAAAACAAAAAAANAAQAAAAAAAAAAAAMAAQAAAAAAAAAAAALAAQAAAAAAAAAAAAOAAMAAAADAAAAAAANAAMAAAABAAAAAAAMAAMAAAAEAAAAAAAMAAIAAAAAAAEAAAALAAIAAAABAAAAAAALAAMAAAAAAAAAAAALAAEAAAAAAAAAAAAPAAMAAAABAAAAAAAQAAMAAAABAAAAAAARAAMAAAAFAAAAAAARAAEAAAAAAAEAAAAOAAEAAAABAAEAAAAQAAEAAAABAAAAAAAPAAEAAAABAAAAAAARAAIAAAACAAAAAAAOAAIAAAACAAAAAAAQAAIAAAAAAAAAAAAPAAIAAAAAAAAAAAASAAEAAAAAAAAAAAASAAIAAAAAAAAAAAASAAMAAAAAAAAAAAANAAIAAAAAAAAAAAAMAAEAAAAAAAAAAAAKAAMAAAAAAAAAAAAJAAMAAAAAAAAAAAAGAAMAAAAAAAAAAAAFAAMAAAAAAAAAAAAIAAMAAAAAAAAAAAAGAAYAAAAAAAAAAAAHAAYAAAAAAAAAAAAIAAYAAAAAAAAAAAANAAEAAAAAAAAAAAAKAAEAAAAAAAAAAAA=") tile_set = ExtResource("2_4k50d") -[node name="Piston" parent="." instance=ExtResource("4_piston")] -position = Vector2(448, 352) - [node name="PauseMenu" parent="." unique_id=904032161 instance=ExtResource("3_pause")] visible = false diff --git a/project.godot b/project.godot index f43494f..20c254a 100755 --- a/project.godot +++ b/project.godot @@ -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]