src / chapters / 0 / chapter_0.tscn
Diagram
Overridden virtual functions
_ready
func _ready() -> void:
if not owner: start()
func _ready() -> void:
initial_position = position
freeze = true
%FailureCollisionShape2D.disabled = true
func _ready() -> void:
playable = true
current = self
restart_position = global_position
turn_right()
_process
func _process(_delta: float) -> void:
if not Player.playable: freeze = true
func _process(_delta: float) -> void:
var camera = current_camera()
if camera:
global_position = camera.global_position + OFFSET
_input
func _input(event: InputEvent) -> void:
if not state == State.AWAIT_INPUT: return
if event.is_action_pressed(&'move_dash'):
player.unlock()
player.dash(Vector2(1, -1))
%AnimationPlayer.play(&'finish')
_physics_process
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, State.SLIDING:
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)
velocity.y += GRAVITY * delta
if state == State.SLIDING: velocity.y *= 0.8
velocity.y = [velocity.y, MAX_VELOCITY_Y].min()
if falling_time < 0.1 \
and Input.is_action_just_released(&'move_jump'):
velocity.y += DOWNFORCE_ON_LITTLE_JUMP * 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
-
Chapter0 Control
-
Transitionable res://src/mixins/transitionable/transitionable.tscn
-
CanvasLayer CanvasLayer
-
OpeningCurtain res://src/curtain/opening/opening.tscn
-
RestartCurtain res://src/curtain/opening/opening.tscn
-
-
Background ColorRect
-
Frames Node2D
-
CameralFrame 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
-
CameraFrame6 res://src/stages/frame/camera_frame.tscn
-
-
StageGround0 res://src/stages/0/stage_ground_0.tscn
-
Scenery Node2D
-
Voids Node2D
-
Area2D Area2D
-
CollisionShape2D CollisionShape2D
-
-
Area2D2 Area2D
-
CollisionShape2D CollisionShape2D
-
-
-
Gimmicks Node2D
-
FallingIceBlock res://src/stages/0/gimmicks/falling_ice_block/falling_ice_block.tscn
-
StoneBirdge res://src/stages/0/gimmicks/stone_bridge/stone_bridge.tscn
-
ClimbLecture res://src/stages/0/gimmicks/climb_lecture/climb_lecture.tscn
-
DashLecture res://src/stages/0/gimmicks/dash_lecture/dash_lecture.tscn
-
-
CheckPoints Node2D
-
Area2D Area2D
-
CollisionShape2D CollisionShape2D
-
-
Area2D2 Area2D
-
CollisionShape2D CollisionShape2D
-
-
-
AirWall Node2D
-
StaticBody2D StaticBody2D
-
CollisionShape2D CollisionShape2D
-
-
StaticBody2D2 StaticBody2D
-
CollisionShape2D CollisionShape2D
-
-
-
Player res://src/player/player.tscn
-
AnimationPlayer AnimationPlayer
-
Signal Connections
func _on_stage_0_event(event_name: String) -> void:
var key = "event_%s" % event_name
if %AnimationPlayer.has_animation(key):
%AnimationPlayer.play(key)
func _on_dash_lecture_finished() -> void:
%Transitionable.transit(self)
func _on_player_failed() -> void:
await get_tree().create_timer(3).timeout
restart()
Animations
Animation_xb7cu
01.get_closer
02.pass_by
03.laughing
event_04.zoom_in
event_05.zoom_out
opening
Properties
| Name | Value |
|---|---|
layout_mode |
|
anchors_preset |
|
anchor_right |
|
anchor_bottom |
|
grow_horizontal |
|
grow_vertical |
|
script |
|
metadata/edit_vertical_guides |
|
| Name | Value |
|---|---|
unique_name_in_owner |
|
callbacks |
|
| Name | Value |
|---|---|
unique_name_in_owner |
|
pattern |
|
center |
|
| Name | Value |
|---|---|
unique_name_in_owner |
|
pattern |
|
| Name | Value |
|---|---|
layout_mode |
|
anchors_preset |
|
anchor_right |
|
anchor_bottom |
|
offset_left |
|
offset_top |
|
offset_right |
|
offset_bottom |
|
grow_horizontal |
|
grow_vertical |
|
color |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
tile_map_data |
|
| 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 |
|---|---|
unique_name_in_owner |
|
position |
|
| Name | Value |
|---|---|
unique_name_in_owner |
|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
collision_layer |
|
| Name | Value |
|---|---|
position |
|
shape |
|
| Name | Value |
|---|---|
position |
|
collision_layer |
|
| Name | Value |
|---|---|
position |
|
shape |
|
| Name | Value |
|---|---|
position |
|
shape |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
position |
|
shape |
|
| Name | Value |
|---|---|
unique_name_in_owner |
|
position |
|
| Name | Value |
|---|---|
unique_name_in_owner |
|
libraries/ |
|
autoplay |
|
chapter_0.gd
extends Control
func restart() -> void:
%FallingIceBlock.reset()
%StoneBirdge.reset()
func _on_stage_0_event(event_name: String) -> void:
var key = "event_%s" % event_name
if %AnimationPlayer.has_animation(key):
%AnimationPlayer.play(key)
func _on_player_failed() -> void:
await get_tree().create_timer(3).timeout
restart()
# TODO: 演出を入れる
func _on_dash_lecture_finished() -> void:
%Transitionable.transit(self)