Movement Implemented + Map

This commit is contained in:
Patrick_Pluto 2024-06-13 13:29:05 +02:00
parent bf0b325a81
commit d31d027b80
12 changed files with 227 additions and 0 deletions

BIN
assets/test/grass.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bgdgd23qgi52x"
path="res://.godot/imported/grass.png-bb6d7e2a4e3a4ad0eb76f57232766d96.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/test/grass.png"
dest_files=["res://.godot/imported/grass.png-bb6d7e2a4e3a4ad0eb76f57232766d96.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
assets/test/player.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dheqglouhkis6"
path="res://.godot/imported/player.png-40bc1da34d1da22b834e701c7257e718.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/test/player.png"
dest_files=["res://.godot/imported/player.png-40bc1da34d1da22b834e701c7257e718.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
assets/test/water.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://chgkgpiiy1yui"
path="res://.godot/imported/water.png-294f741d71b412e0a6039d5110937f78.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/test/water.png"
dest_files=["res://.godot/imported/water.png-294f741d71b412e0a6039d5110937f78.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View file

@ -11,10 +11,42 @@ config_version=5
[application]
config/name="openDND"
run/main_scene="res://scenes/menu/main.tscn"
config/features=PackedStringArray("4.2", "GL Compatibility")
config/icon="res://icon.svg"
[display]
window/size/viewport_width=800
window/size/viewport_height=500
window/stretch/mode="canvas_items"
window/stretch/aspect="expand"
[input]
left={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"echo":false,"script":null)
]
}
right={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"echo":false,"script":null)
]
}
up={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"echo":false,"script":null)
]
}
down={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"echo":false,"script":null)
]
}
[rendering]
textures/canvas_textures/default_texture_filter=0
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"

23
scenes/menu/main.tscn Normal file
View file

@ -0,0 +1,23 @@
[gd_scene load_steps=2 format=3 uid="uid://0eb22uw5jthn"]
[ext_resource type="Script" path="res://scripts/menu.gd" id="1_xc6y7"]
[node name="Control" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="Button" type="Button" parent="."]
layout_mode = 0
offset_left = 3.05176e-05
offset_top = 1.52588e-05
offset_right = 90.0
offset_bottom = 32.0
scale = Vector2(5, 5)
text = "Test"
script = ExtResource("1_xc6y7")
[connection signal="pressed" from="Button" to="Button" method="_on_pressed"]

37
scenes/test/map.tscn Normal file

File diff suppressed because one or more lines are too long

18
scenes/test/player.tscn Normal file
View file

@ -0,0 +1,18 @@
[gd_scene load_steps=4 format=3 uid="uid://dv67vdgb4h44q"]
[ext_resource type="Texture2D" uid="uid://dheqglouhkis6" path="res://assets/test/player.png" id="1_cujcj"]
[ext_resource type="Script" path="res://scripts/player.gd" id="1_oik63"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_kf6qt"]
size = Vector2(20, 18)
[node name="CharacterBody2D" type="CharacterBody2D"]
script = ExtResource("1_oik63")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_cujcj")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_kf6qt")
[node name="Camera2D" type="Camera2D" parent="."]

4
scripts/menu.gd Normal file
View file

@ -0,0 +1,4 @@
extends Node
func _on_pressed():
get_tree().change_scene_to_file("res://scenes/test/map.tscn")

11
scripts/player.gd Normal file
View file

@ -0,0 +1,11 @@
extends CharacterBody2D
@export var speed = 200
func get_input():
var input_direction = Input.get_vector("left", "right", "up", "down")
velocity = input_direction * speed
func _physics_process(delta):
get_input()
move_and_slide()