mirror of
https://github.com/SEISYUNLie/Platform-Jump.git
synced 2026-10-26 02:41:10 +08:00
Initial commit
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
extends Area2D
|
||||
|
||||
var ok = true
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
body_entered.connect(_in)
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
func _in(body):
|
||||
if body.is_in_group("player") and body.velocity.y > 0 and ok :
|
||||
body.velocity.y = -300
|
||||
body.reset_jump()
|
||||
ok = false
|
||||
get_tree().create_timer(0.2).timeout.connect(reset)
|
||||
|
||||
func reset():
|
||||
ok = true
|
||||
@@ -0,0 +1 @@
|
||||
uid://dffa4gfegesjp
|
||||
@@ -0,0 +1,20 @@
|
||||
[gd_scene format=3 uid="uid://jbye06it1ov5"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dffa4gfegesjp" path="res://scenes/prefabs/interactables/spring_red.gd" id="1_i3l3r"]
|
||||
[ext_resource type="Texture2D" uid="uid://b7wkoed3ty7em" path="res://assets/game/interactables/spring_red.png" id="1_texture"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="Shape_spring"]
|
||||
size = Vector2(14, 6)
|
||||
|
||||
[node name="SpringRed" type="Area2D" unique_id=742449581 groups=["spring"]]
|
||||
collision_layer = 8
|
||||
collision_mask = 2
|
||||
script = ExtResource("1_i3l3r")
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="." unique_id=183929814]
|
||||
texture_filter = 1
|
||||
texture = ExtResource("1_texture")
|
||||
|
||||
[node name="ActivationArea" type="CollisionShape2D" parent="." unique_id=716768850]
|
||||
position = Vector2(0, -2)
|
||||
shape = SubResource("Shape_spring")
|
||||
Reference in New Issue
Block a user