added game root node and player scene. also created assets, scenes and scripts folder
parent
a4435d1de6
commit
a0c72f8fae
|
Before Width: | Height: | Size: 995 B After Width: | Height: | Size: 995 B |
|
|
@ -3,15 +3,15 @@
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="CompressedTexture2D"
|
type="CompressedTexture2D"
|
||||||
uid="uid://db6gtr4tljfh2"
|
uid="uid://db6gtr4tljfh2"
|
||||||
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
|
path="res://.godot/imported/icon.svg-56083ea2a1f1a4f1e49773bdc6d7826c.ctex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://icon.svg"
|
source_file="res://assets/icon.svg"
|
||||||
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
|
dest_files=["res://.godot/imported/icon.svg-56083ea2a1f1a4f1e49773bdc6d7826c.ctex"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
|
|
@ -11,8 +11,9 @@ config_version=5
|
||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="gae_wild_jam"
|
config/name="gae_wild_jam"
|
||||||
|
run/main_scene="uid://lq8e5h6fjrnq"
|
||||||
config/features=PackedStringArray("4.6", "GL Compatibility")
|
config/features=PackedStringArray("4.6", "GL Compatibility")
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://assets/icon.svg"
|
||||||
|
|
||||||
[physics]
|
[physics]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
[gd_scene format=3 uid="uid://lq8e5h6fjrnq"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://cw8jnr0mscanx" path="res://scenes/player.tscn" id="1_uwrxv"]
|
||||||
|
|
||||||
|
[node name="Game" type="Node2D" unique_id=1188224334]
|
||||||
|
|
||||||
|
[node name="Player" parent="." unique_id=804585690 instance=ExtResource("1_uwrxv")]
|
||||||
|
|
||||||
|
[node name="Camera2D" type="Camera2D" parent="Player" unique_id=866207293]
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
[gd_scene format=3 uid="uid://cw8jnr0mscanx"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://cb378ofiodjbg" path="res://scripts/player.gd" id="1_3vyb7"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://db6gtr4tljfh2" path="res://assets/icon.svg" id="2_g2els"]
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_u8vuu"]
|
||||||
|
|
||||||
|
[node name="Player" type="CharacterBody2D" unique_id=804585690]
|
||||||
|
script = ExtResource("1_3vyb7")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=896441301]
|
||||||
|
shape = SubResource("CapsuleShape2D_u8vuu")
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=723284336]
|
||||||
|
texture = ExtResource("2_g2els")
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
extends CharacterBody2D
|
||||||
|
|
||||||
|
|
||||||
|
const SPEED = 300.0
|
||||||
|
const JUMP_VELOCITY = -400.0
|
||||||
|
|
||||||
|
|
||||||
|
func _physics_process(delta: float) -> void:
|
||||||
|
# Add the gravity.
|
||||||
|
if not is_on_floor():
|
||||||
|
velocity += get_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()
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://cb378ofiodjbg
|
||||||
Loading…
Reference in New Issue