[gd_scene load_steps=4 format=3 uid="uid://l0lnby3rm6fj"] [ext_resource type="Texture2D" uid="uid://d1gf8ked7ik4l" path="res://assets/images/white.png" id="2"] [sub_resource type="GDScript" id="GDScript_mix1s"] script/source = "extends CharacterBody2D const JUMP_VELOCITY = -500.0 # Get the gravity from the project settings to be synced with RigidBody nodes. var gravity = ProjectSettings.get_setting(\"physics/2d/default_gravity\") func _physics_process(delta): # Add the gravity. if not is_on_floor(): velocity.y += gravity * delta # Handle Jump. if Input.is_action_just_pressed(\"ui_accept\") and is_on_floor(): velocity.y = JUMP_VELOCITY # Get the input direction and handle the movement/deceleration. # As good practice, you should replace UI actions with custom gameplay actions. velocity.x = 1 * Stats.initspeed move_and_slide() if Stats.playerdead == true: queue_free() " [sub_resource type="RectangleShape2D" id="1"] size = Vector2(16, 16) [node name="Player" type="CharacterBody2D"] position = Vector2(50, 600) script = SubResource("GDScript_mix1s") [node name="Sprite2D" type="Sprite2D" parent="."] texture = ExtResource("2") [node name="CollisionShape2D" type="CollisionShape2D" parent="."] shape = SubResource("1") [node name="Camera2D" type="Camera2D" parent="."] zoom = Vector2(1.5, 1.5) limit_left = 0 limit_top = 0 position_smoothing_enabled = true position_smoothing_speed = 6.0