Creating campus scene, adding simple player node for testing
This commit is contained in:
18
entities/player/player.gd
Normal file
18
entities/player/player.gd
Normal file
@@ -0,0 +1,18 @@
|
||||
extends CharacterBody2D
|
||||
|
||||
@export var speed = 400
|
||||
|
||||
func _physics_process(_delta):
|
||||
velocity.x = 0
|
||||
velocity.y = 0
|
||||
|
||||
if Input.is_action_pressed("move_down"):
|
||||
velocity.y = speed
|
||||
elif Input.is_action_pressed("move_up"):
|
||||
velocity.y = -speed
|
||||
elif Input.is_action_pressed("move_right"):
|
||||
velocity.x = speed
|
||||
elif Input.is_action_pressed("move_left"):
|
||||
velocity.x = -speed
|
||||
|
||||
move_and_slide()
|
||||
1
entities/player/player.gd.uid
Normal file
1
entities/player/player.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://ca1l8qdrmuipp
|
||||
23
entities/player/player.tscn
Normal file
23
entities/player/player.tscn
Normal file
@@ -0,0 +1,23 @@
|
||||
[gd_scene format=3 uid="uid://cl5do1d8xo23f"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://ca1l8qdrmuipp" path="res://entities/player/player.gd" id="1_abrql"]
|
||||
[ext_resource type="Texture2D" uid="uid://hd02b3ch1028" path="res://icon.svg" id="1_symyc"]
|
||||
|
||||
[sub_resource type="CanvasTexture" id="CanvasTexture_abrql"]
|
||||
diffuse_texture = ExtResource("1_symyc")
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_sglur"]
|
||||
|
||||
[node name="Player" type="CharacterBody2D" unique_id=1917739264]
|
||||
script = ExtResource("1_abrql")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=2131439963]
|
||||
texture_filter = 1
|
||||
scale = Vector2(0.15, 0.15)
|
||||
texture = SubResource("CanvasTexture_abrql")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=421255955]
|
||||
shape = SubResource("RectangleShape2D_sglur")
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="." unique_id=1926523444]
|
||||
zoom = Vector2(6, 6)
|
||||
Reference in New Issue
Block a user