src / chapters / 1 / chapter1.tscn
Diagram
Overridden virtual functions
_ready
func _ready() -> void:
set_prev_position()
func _ready() -> void:
if obtained: hide()
func _ready() -> void:
if player_path:
player = get_node(player_path)
player.dashed.connect(fly_away)
if obtained: hide()
func _ready() -> void:
playable = true
turn_right()
if not owner: return
if last_owner_name == owner.name:
position = restart_position
else:
restart_position = position
last_owner_name = owner.name
_physics_process
func _physics_process(_delta: float) -> void:
if player and player.state != Player.State.FAILED:
var diff = %Platform.global_position - prev_position
player.global_position += diff
set_prev_position()
func _physics_process(_delta: float) -> void:
if player:
var target := player.global_position + OFFSET
%Pivot.global_position = %Pivot.global_position.lerp(target, 0.1)
func _physics_process(_delta: float) -> void:
if touched and player:
var target := player.global_position + OFFSET
%Pivot.global_position = %Pivot.global_position.lerp(target, 0.1)
func _physics_process(delta: float) -> void:
var dx := Input.get_axis(&'move_left', &'move_right')
var dy := Input.get_axis(&'move_up', &'move_down')
var direction := Vector2(dx, dy)
var last_state := state
state = compute_state(delta, direction)
match state:
State.CLIMBING:
dx = 0
velocity.y = dy * CLIMBING_SPEED
State.DASHED:
velocity = direction.normalized() * DASH_SPEED
State.DASHING:
velocity *= DASH_ATTENUATION * delta
State.EXHAUSTED:
dx = 0
State.FAILED:
velocity.x = lerp(velocity.x, 0.0, 0.2)
velocity.y = lerp(velocity.y, 0.0, 0.2)
State.FALLING:
if last_state == State.CLIMBING \
and dy < 0:
velocity.y = JUMP_VELOCITY * 0.8
else:
var move_x := dx * SPEED * 0.8
if velocity.x * dx < 0: move_x *= 0.1
velocity.x = lerp(velocity.x, move_x, 0.2)
if velocity.y < JUMP_VELOCITY * 0.85:
velocity.y += GRAVITY * 1.15 * delta
else:
velocity.y += GRAVITY * delta
State.JUMPED:
velocity.y = JUMP_VELOCITY
State.KICKED:
velocity.y = JUMP_VELOCITY * 0.9
velocity.x = get_wall_normal().x * DASH_SPEED * 0.4
State.LOCKED:
dx = 0
velocity = Vector2(0, 0)
_: pass
if not playable: dx = 0
if not (state == State.DASHED \
or state == State.DASHING \
or state == State.FALLING \
or state == State.KICKED
):
if dx: velocity.x = dx * SPEED
else: velocity.x = move_toward(velocity.x, 0, SPEED*0.2)
if state == State.JUMPED:
velocity += jump_boost
jump_boost = Vector2(0, 0)
animate(playable)
move_and_slide()
Instantiators
|
Caution
|
No other scene instantiate this scene. |
Scene Tree
-
Chapter1 Control
-
Frames Node2D
-
CameraFrame res://src/stages/frame/camera_frame.tscn
-
CameraFrame2 res://src/stages/frame/camera_frame.tscn
-
CameraFrame3 res://src/stages/frame/camera_frame.tscn
-
CameraFrame4 res://src/stages/frame/camera_frame.tscn
-
CameraFrame5 res://src/stages/frame/camera_frame.tscn
-
-
Voids Node2D
-
Stage1 Area2D
-
CollisionShape2D CollisionShape2D
-
-
Stage2 Area2D
-
CollisionShape2D CollisionShape2D
-
-
Stage3 Area2D
-
CollisionShape2D CollisionShape2D
-
-
Stage4 Area2D
-
CollisionShape2D CollisionShape2D
-
-
Stage5 Area2D
-
CollisionShape2D CollisionShape2D
-
-
-
Traps Node2D
-
Spikes Node2D
-
Stage1 Node2D
-
Stage2 Node2D
-
Stage3 Node2D
-
Stage4 Node2D
-
-
-
Gimmicks Node2D
-
Stage2 Node2D
-
Stage3 Node2D
-
Stage4 Node2D
-
Stage5 Node2D
-
OneWayScaffold res://src/stages/gimmicks/one_way_scaffold/one_way_scaffold.tscn
-
Platforms Node2D
-
CrumblingPlatform1 res://src/stages/gimmicks/crumbling_platform/crumbling_platform.tscn
-
CrumblingPlatform2 res://src/stages/gimmicks/crumbling_platform/crumbling_platform.tscn
-
CrumblingPlatform3 res://src/stages/gimmicks/crumbling_platform/crumbling_platform.tscn
-
CrumblingPlatform4 res://src/stages/gimmicks/crumbling_platform/crumbling_platform.tscn
-
-
-
-
StageGround0 res://src/stages/0/stage_ground_0.tscn
-
Strawberries Node2D
-
Strawberry1 res://src/stages/gimmicks/strawberry/strawberry.tscn
-
CollisionShape2D CollisionShape2D
-
-
Strawberry2 res://src/stages/gimmicks/strawberry/strawberry.tscn
-
CollisionShape2D CollisionShape2D
-
-
FlyingStrawberry res://src/stages/gimmicks/flying_strawberry/flying_strawberry.tscn
-
CollisionShape2D CollisionShape2D
-
-
-
CheckPoints Node2D
-
Stage2 Area2D
-
CollisionShape2D CollisionShape2D
-
-
Stage3 Area2D
-
CollisionShape2D CollisionShape2D
-
-
Stage4 Area2D
-
CollisionShape2D CollisionShape2D
-
-
-
Player res://src/player/player.tscn
-
Signal Connections
func _on_player_failed() -> void:
restart()
Properties
| Name | Value |
|---|---|
layout_mode |
|
anchors_preset |
|
anchor_right |
|
anchor_bottom |
|
grow_horizontal |
|
grow_vertical |
|
script |
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
collision_layer |
|
collision_mask |
|
| Name | Value |
|---|---|
position |
|
shape |
|
| Name | Value |
|---|---|
collision_layer |
|
collision_mask |
|
| Name | Value |
|---|---|
position |
|
shape |
|
| Name | Value |
|---|---|
collision_layer |
|
collision_mask |
|
| Name | Value |
|---|---|
position |
|
shape |
|
| Name | Value |
|---|---|
position |
|
collision_layer |
|
collision_mask |
|
| Name | Value |
|---|---|
position |
|
shape |
|
| Name | Value |
|---|---|
position |
|
collision_layer |
|
collision_mask |
|
| Name | Value |
|---|---|
position |
|
shape |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
rotation |
|
| Name | Value |
|---|---|
position |
|
rotation |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
rotation |
|
| Name | Value |
|---|---|
position |
|
rotation |
|
| Name | Value |
|---|---|
position |
|
rotation |
|
| Name | Value |
|---|---|
position |
|
rotation |
|
| Name | Value |
|---|---|
position |
|
rotation |
|
| Name | Value |
|---|---|
position |
|
rotation |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
unique_name_in_owner |
|
position |
|
| Name | Value |
|---|---|
unique_name_in_owner |
|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
tile_map_data |
|
| Name | Value |
|---|---|
unique_name_in_owner |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
shape |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
shape |
|
| Name | Value |
|---|---|
position |
|
player_path |
|
| Name | Value |
|---|---|
position |
|
shape |
|
| Name | Value |
|---|---|
position |
|
collision_layer |
|
| Name | Value |
|---|---|
position |
|
shape |
|
debug_color |
|
| Name | Value |
|---|---|
position |
|
collision_layer |
|
| Name | Value |
|---|---|
position |
|
shape |
|
debug_color |
|
| Name | Value |
|---|---|
position |
|
collision_layer |
|
| Name | Value |
|---|---|
position |
|
shape |
|
debug_color |
|
| Name | Value |
|---|---|
unique_name_in_owner |
|
position |
|
chapter_1.gd
extends Control
func restart() -> void:
for s in %Strawberries.get_children(): s.reset()
%Pulley1.reset()
func _on_player_failed() -> void:
restart()