Table of Contents
src / stages / gimmicks / strawberry / strawberry.tscn
Diagram
Overridden virtual functions
_ready
func _ready() -> void:
if obtained: hide()
_physics_process
func _physics_process(_delta: float) -> void:
if player:
var target := player.global_position + OFFSET
%Pivot.global_position = %Pivot.global_position.lerp(target, 0.1)
Instantiators
Scene Tree
-
Strawberry Area2D
-
Pivot Node2D
-
Sprite2D Sprite2D
-
HitArea Area2D
-
CollisionShape2D CollisionShape2D
-
-
-
AnimationPlayer AnimationPlayer
-
Signal Connections
$.:[area_entered]⇒$.
func _on_area_entered(_area: Area2D) -> void:
if not obtained and player: ascend()
$Pivot/HitArea:[area_entered]⇒$.
func _on_hit_area_entered(area: Area2D) -> void:
player = area.owner as Player
Animations
idle (autoplay)
Animation_rlj1e
ascend
Properties
| Name | Value |
|---|---|
scale |
|
collision_layer |
|
collision_mask |
|
script |
| Name | Value |
|---|---|
unique_name_in_owner |
|
| Name | Value |
|---|---|
texture |
|
hframes |
|
| Name | Value |
|---|---|
collision_layer |
|
collision_mask |
|
| Name | Value |
|---|---|
position |
|
shape |
|
| Name | Value |
|---|---|
unique_name_in_owner |
|
libraries |
|
autoplay |
|
strawberry.gd
extends Area2D
@onready var player : Player
@export var obtained : bool = false
const OFFSET := Vector2(0, -200)
func _ready() -> void:
if obtained: hide()
func reset() -> void:
player = null
%Pivot.position = Vector2(0, 0)
if obtained: hide()
play(&'RESET')
play.call_deferred(&'idle')
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 ascend() -> void:
play(&'ascend')
obtained = true
func play(key: StringName) -> void:
%AnimationPlayer.play(key)
func _on_hit_area_entered(area: Area2D) -> void:
player = area.owner as Player
func _on_area_entered(_area: Area2D) -> void:
if not obtained and player: ascend()
