Fixed collission & movement

This commit is contained in:
theskywinds 2025-05-17 18:25:57 +02:00
parent 24f01f7128
commit 90ed8e33d5
5 changed files with 11 additions and 10 deletions

View File

@ -1,8 +1,8 @@
[gd_scene load_steps=5 format=3 uid="uid://bj1x4w8ek53u1"] [gd_scene load_steps=5 format=3 uid="uid://bj1x4w8ek53u1"]
[ext_resource type="Texture2D" uid="uid://yqukd7l5xsxg" path="res://Cat on news.PNG" id="1_5b7ti"] [ext_resource type="Texture2D" uid="uid://yqukd7l5xsxg" path="res://Cat on news.PNG" id="1_5b7ti"]
[ext_resource type="Script" path="res://start_game.gd" id="1_i5qic"] [ext_resource type="Script" uid="uid://dseq7dsrcpds6" path="res://start_game.gd" id="1_i5qic"]
[ext_resource type="Script" path="res://exit_game.gd" id="2_12kdf"] [ext_resource type="Script" uid="uid://br2tmqcmfkf7a" path="res://exit_game.gd" id="2_12kdf"]
[sub_resource type="SystemFont" id="SystemFont_7yr4w"] [sub_resource type="SystemFont" id="SystemFont_7yr4w"]

View File

@ -7,17 +7,14 @@ resource_name = "movementScript"
script/source = "extends CharacterBody2D script/source = "extends CharacterBody2D
const SPEED = 300.0 const SPEED = 10.0
const JUMP_VELOCITY = -400.0
func _physics_process(delta: float) -> void: func _physics_process(delta: float) -> void:
# Get the input direction and handle the movement/deceleration. # Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions. # As good practice, you should replace UI actions with custom gameplay actions.
var direction := Input.get_vector(\"moveLeft\", \"moveRight\", \"moveUp\", \"moveDown\") var direction := Input.get_vector(\"moveLeft\", \"moveRight\", \"moveUp\", \"moveDown\")
if direction: move_and_collide(direction * SPEED)
velocity = direction * SPEED
move_and_slide()
" "
[sub_resource type="SpriteFrames" id="SpriteFrames_onrkg"] [sub_resource type="SpriteFrames" id="SpriteFrames_onrkg"]
@ -32,9 +29,10 @@ animations = [{
}] }]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_i3pqv"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_i3pqv"]
size = Vector2(30, 28) size = Vector2(22, 22)
[node name="CharacterBody2D" type="CharacterBody2D"] [node name="CharacterBody2D" type="CharacterBody2D"]
collision_mask = 2
script = SubResource("GDScript_4flbx") script = SubResource("GDScript_4flbx")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]

View File

@ -11,7 +11,7 @@ config_version=5
[application] [application]
config/name="The crystaline adventure" config/name="The crystaline adventure"
run/main_scene="uid://bmvb0o7ohxcfd" run/main_scene="uid://bj1x4w8ek53u1"
config/features=PackedStringArray("4.4", "Forward Plus") config/features=PackedStringArray("4.4", "Forward Plus")
config/icon="res://icon.svg" config/icon="res://icon.svg"

File diff suppressed because one or more lines are too long

View File

@ -170,6 +170,7 @@ texture_region_size = Vector2i(32, 32)
3:19/0 = 0 3:19/0 = 0
4:19/0 = 0 4:19/0 = 0
5:19/0 = 0 5:19/0 = 0
5:19/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
8:19/0 = 0 8:19/0 = 0
9:19/0 = 0 9:19/0 = 0
10:19/0 = 0 10:19/0 = 0
@ -195,4 +196,6 @@ texture_region_size = Vector2i(32, 32)
[resource] [resource]
tile_size = Vector2i(32, 32) tile_size = Vector2i(32, 32)
uv_clipping = true uv_clipping = true
physics_layer_0/collision_layer = 2
physics_layer_0/collision_mask = 0
sources/1 = SubResource("TileSetAtlasSource_kjlji") sources/1 = SubResource("TileSetAtlasSource_kjlji")