Initial Commit

This commit is contained in:
2024-09-17 07:45:51 -04:00
commit c9cb61faa7
28 changed files with 1360 additions and 0 deletions

28
scenes/MC.gd Normal file
View File

@@ -0,0 +1,28 @@
extends CharacterBody2D
const SPEED = 300.0
const JUMP_VELOCITY = -400.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.
var direction = Input.get_axis("ui_left", "ui_right")
if direction:
velocity.x = direction * SPEED
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
move_and_slide()

18
scenes/MC.tscn Normal file
View File

@@ -0,0 +1,18 @@
[gd_scene load_steps=3 format=3 uid="uid://bcuo3byxygxyi"]
[ext_resource type="Texture2D" uid="uid://q4fvqt4hhr86" path="res://Jump (32x32).png" id="1_ul47s"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_yoddx"]
size = Vector2(33, 52)
[node name="CharacterBody2D" type="CharacterBody2D"]
[node name="Sprite2D" type="Sprite2D" parent="."]
texture_filter = 1
position = Vector2(49.5, 593.5)
scale = Vector2(1.46875, 1.90625)
texture = ExtResource("1_ul47s")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(48.5, 597)
shape = SubResource("RectangleShape2D_yoddx")