commit 0758d3663b1fd0423e0f7d348da48ed2c128f958 Author: Eric Date: Sat Feb 10 08:00:06 2024 -0600 basic map / player movement diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..8ad74f7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Normalize EOL for all files that Git considers text files. +* text=auto eol=lf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4709183 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Godot 4+ specific ignores +.godot/ diff --git a/assets/maze.png b/assets/maze.png new file mode 100644 index 0000000..a014515 Binary files /dev/null and b/assets/maze.png differ diff --git a/assets/maze.png.import b/assets/maze.png.import new file mode 100644 index 0000000..023b562 --- /dev/null +++ b/assets/maze.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bsrmtons1ov7x" +path="res://.godot/imported/maze.png-2fc0057eba05e14df9cac887d42e4bf6.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/maze.png" +dest_files=["res://.godot/imported/maze.png-2fc0057eba05e14df9cac887d42e4bf6.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 diff --git a/assets/maze_atlas.tres b/assets/maze_atlas.tres new file mode 100644 index 0000000..108f4e3 --- /dev/null +++ b/assets/maze_atlas.tres @@ -0,0 +1,7 @@ +[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://cd6t48adfftea"] + +[ext_resource type="Texture2D" uid="uid://bsrmtons1ov7x" path="res://assets/maze.png" id="1_fwnxy"] + +[resource] +atlas = ExtResource("1_fwnxy") +region = Rect2(16, 16, 16, 16) diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..b370ceb --- /dev/null +++ b/icon.svg @@ -0,0 +1 @@ + diff --git a/icon.svg.import b/icon.svg.import new file mode 100644 index 0000000..bdb327b --- /dev/null +++ b/icon.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://drqjbqwslcsg0" +path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.svg" +dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.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 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/player.gd b/player.gd new file mode 100644 index 0000000..730337a --- /dev/null +++ b/player.gd @@ -0,0 +1,17 @@ +extends CharacterBody2D +class_name Player + +@export var speed = 100 + +func _physics_process(delta: float) -> void: + velocity = Vector2.ZERO + if Input.is_action_pressed("ui_down"): + velocity += Vector2.DOWN + if Input.is_action_pressed("ui_up"): + velocity += Vector2.UP + if Input.is_action_pressed("ui_left"): + velocity += Vector2.LEFT + if Input.is_action_pressed("ui_right"): + velocity += Vector2.RIGHT + velocity = velocity.normalized() * speed + move_and_slide() diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..d8c606d --- /dev/null +++ b/project.godot @@ -0,0 +1,63 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + +config_version=5 + +[application] + +config/name="rgb" +config/features=PackedStringArray("4.2", "GL Compatibility") +config/icon="res://icon.svg" + +[aseprite_importers] + +aseprite_executable_path="C:/Program Files/aseprite/build/bin/aseprite.exe" + +[editor_plugins] + +enabled=PackedStringArray("res://addons/nklbdev.aseprite_importers/plugin.cfg") + +[input] + +ui_left={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194319,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null) +, 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) +] +} +ui_right={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194321,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null) +, 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) +] +} +ui_up={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194320,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null) +, 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) +] +} +ui_down={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194322,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null) +, 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] + +renderer/rendering_method="gl_compatibility" +renderer/rendering_method.mobile="gl_compatibility" diff --git a/scene/maze_1.tscn b/scene/maze_1.tscn new file mode 100644 index 0000000..3110f75 --- /dev/null +++ b/scene/maze_1.tscn @@ -0,0 +1,89 @@ +[gd_scene load_steps=6 format=3 uid="uid://b2amoasy4e08i"] + +[ext_resource type="Texture2D" uid="uid://bsrmtons1ov7x" path="res://assets/maze.png" id="1_jp5wf"] +[ext_resource type="PackedScene" uid="uid://cd57rr2jffwqu" path="res://scene/player.tscn" id="2_s6cts"] + +[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_e47fw"] +texture = ExtResource("1_jp5wf") +0:0/0 = 0 +0:0/0/physics_layer_0/linear_velocity = Vector2(0, 0) +0:0/0/physics_layer_0/angular_velocity = 0.0 +0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(8, -8, 8, -6, -6, -6, -6, 8, -8, 8, -8, -8) +1:0/0 = 0 +1:0/0/physics_layer_0/linear_velocity = Vector2(0, 0) +1:0/0/physics_layer_0/angular_velocity = 0.0 +1:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(8, -8, 8, -6, -8, -6, -8, -8) +2:0/0 = 0 +2:0/0/physics_layer_0/linear_velocity = Vector2(0, 0) +2:0/0/physics_layer_0/angular_velocity = 0.0 +2:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(8, 8, 6, 8, 6, -6, -8, -6, -8, -8, 8, -8) +3:0/0 = 0 +3:0/0/physics_layer_0/linear_velocity = Vector2(0, 0) +3:0/0/physics_layer_0/angular_velocity = 0.0 +0:1/0 = 0 +0:1/0/physics_layer_0/linear_velocity = Vector2(0, 0) +0:1/0/physics_layer_0/angular_velocity = 0.0 +0:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, -6, -8, -6, 8, -8, 8) +1:1/0 = 0 +1:1/0/physics_layer_0/linear_velocity = Vector2(0, 0) +1:1/0/physics_layer_0/angular_velocity = 0.0 +2:1/0 = 0 +2:1/0/physics_layer_0/linear_velocity = Vector2(0, 0) +2:1/0/physics_layer_0/angular_velocity = 0.0 +2:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(8, -8, 6, -8, 6, 8, 8, 8) +0:2/0 = 0 +0:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) +0:2/0/physics_layer_0/angular_velocity = 0.0 +0:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, -6, -8, -6, 6, 8, 6, 8, 8, -8, 8) +1:2/0 = 0 +1:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) +1:2/0/physics_layer_0/angular_velocity = 0.0 +1:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(8, 8, 8, 6, -8, 6, -8, 8) +2:2/0 = 0 +2:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) +2:2/0/physics_layer_0/angular_velocity = 0.0 +2:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, 8, -8, 6, 6, 6, 6, -8, 8, -8, 8, 8) + +[sub_resource type="TileSet" id="TileSet_dy2x8"] +physics_layer_0/collision_layer = 1 +physics_layer_0/collision_mask = 0 +sources/0 = SubResource("TileSetAtlasSource_e47fw") + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_hodhv"] +size = Vector2(32, 32) + +[node name="maze_1" type="Node2D"] + +[node name="TileMap" type="TileMap" parent="."] +tile_set = SubResource("TileSet_dy2x8") +format = 2 +layer_0/tile_data = PackedInt32Array(0, 0, 0, 65536, 0, 1, 131072, 0, 1, 196608, 0, 1, 262144, 0, 1, 327680, 0, 1, 393216, 0, 1, 458752, 0, 1, 524288, 0, 1, 589824, 0, 1, 655360, 0, 1, 720896, 0, 1, 786432, 0, 1, 851968, 0, 1, 917504, 0, 1, 983040, 0, 2, 983041, 65536, 2, 983042, 65536, 2, 983043, 65536, 2, 983044, 65536, 2, 983045, 65536, 2, 983046, 65536, 2, 983047, 65536, 2, 983048, 65536, 2, 983049, 65536, 2, 983050, 65536, 2, 983051, 65536, 2, 983052, 65536, 2, 983053, 65536, 2, 983054, 65536, 2, 983055, 65536, 2, 983056, 65536, 2, 983057, 131072, 2, 917521, 131072, 1, 851985, 131072, 1, 786449, 131072, 1, 720913, 131072, 1, 655377, 131072, 1, 589841, 131072, 1, 524305, 131072, 1, 458769, 131072, 1, 393233, 131072, 1, 327697, 131072, 1, 262161, 131072, 1, 196625, 131072, 1, 131089, 131072, 1, 65553, 131072, 1, 17, 131072, 0, 16, 65536, 0, 15, 65536, 0, 14, 65536, 0, 13, 65536, 0, 12, 65536, 0, 11, 65536, 0, 10, 65536, 0, 9, 65536, 0, 8, 65536, 0, 7, 65536, 0, 6, 65536, 0, 5, 65536, 0, 4, 65536, 0, 3, 65536, 0, 2, 65536, 0, 1, 65536, 0, 65537, 65536, 1, 65538, 65536, 1, 65539, 65536, 1, 65540, 65536, 1, 65541, 65536, 1, 65542, 65536, 1, 65543, 65536, 1, 65544, 65536, 1, 65545, 65536, 1, 65546, 65536, 1, 65547, 65536, 1, 65548, 65536, 1, 65549, 65536, 1, 65550, 65536, 1, 65551, 65536, 1, 65552, 65536, 1, 131088, 65536, 1, 131087, 65536, 1, 131086, 65536, 1, 131085, 65536, 1, 131084, 65536, 1, 131083, 65536, 1, 131082, 65536, 1, 131078, 65536, 1, 131077, 65536, 1, 131076, 65536, 1, 131075, 65536, 1, 131074, 65536, 1, 131073, 65536, 1, 196609, 65536, 1, 196610, 65536, 1, 196611, 65536, 1, 196612, 65536, 1, 196613, 65536, 1, 196614, 65536, 1, 196615, 65536, 1, 196616, 65536, 1, 196617, 65536, 1, 131081, 65536, 1, 131080, 65536, 1, 131079, 65536, 1, 196618, 65536, 1, 196619, 65536, 1, 196620, 65536, 1, 196621, 65536, 1, 196622, 65536, 1, 196623, 65536, 1, 196624, 65536, 1, 262160, 65536, 1, 262159, 65536, 1, 262158, 65536, 1, 262157, 65536, 1, 262156, 65536, 1, 262155, 65536, 1, 262154, 65536, 1, 262153, 65536, 1, 262152, 65536, 1, 262151, 65536, 1, 262150, 65536, 1, 262149, 65536, 1, 262148, 65536, 1, 262147, 65536, 1, 262146, 65536, 1, 262145, 65536, 1, 327681, 65536, 1, 327682, 65536, 1, 327683, 65536, 1, 327684, 65536, 1, 327685, 65536, 1, 327686, 65536, 1, 327687, 65536, 1, 327688, 65536, 1, 327689, 65536, 1, 327690, 65536, 1, 327691, 65536, 1, 327692, 65536, 1, 327693, 65536, 1, 327694, 65536, 1, 327695, 65536, 1, 327696, 65536, 1, 524298, 65536, 1, 458762, 65536, 1, 393226, 65536, 1, 393225, 65536, 1, 393224, 65536, 1, 393223, 65536, 1, 393222, 65536, 1, 393221, 65536, 1, 393220, 65536, 1, 393219, 65536, 1, 393218, 65536, 1, 393217, 65536, 1, 458753, 65536, 1, 524289, 65536, 1, 589825, 65536, 1, 655361, 65536, 1, 720897, 65536, 1, 786433, 65536, 1, 851969, 65536, 1, 917505, 65536, 1, 917506, 65536, 1, 851970, 65536, 1, 786434, 65536, 1, 720898, 65536, 1, 655362, 65536, 1, 589826, 65536, 1, 524290, 65536, 1, 458754, 65536, 1, 458755, 65536, 1, 524291, 65536, 1, 589827, 65536, 1, 655363, 65536, 1, 720899, 65536, 1, 786435, 65536, 1, 851971, 65536, 1, 917507, 65536, 1, 917508, 65536, 1, 851972, 65536, 1, 786436, 65536, 1, 720900, 65536, 1, 655364, 65536, 1, 589828, 65536, 1, 524292, 65536, 1, 458756, 65536, 1, 458757, 65536, 1, 524293, 65536, 1, 589829, 65536, 1, 655365, 65536, 1, 720901, 65536, 1, 786437, 65536, 1, 851973, 65536, 1, 917509, 65536, 1, 917510, 65536, 1, 851974, 65536, 1, 786438, 65536, 1, 720902, 65536, 1, 655366, 65536, 1, 589830, 65536, 1, 524294, 65536, 1, 458758, 65536, 1, 458759, 65536, 1, 524295, 65536, 1, 589831, 65536, 1, 655367, 65536, 1, 720903, 65536, 1, 786439, 65536, 1, 851975, 65536, 1, 917511, 65536, 1, 917512, 65536, 1, 851976, 65536, 1, 786440, 65536, 1, 720904, 65536, 1, 655368, 65536, 1, 589832, 65536, 1, 524296, 65536, 1, 458760, 65536, 1, 458761, 65536, 1, 524297, 65536, 1, 589833, 65536, 1, 655369, 65536, 1, 720905, 65536, 1, 786441, 65536, 1, 851977, 65536, 1, 917513, 65536, 1, 917514, 65536, 1, 851978, 65536, 1, 786442, 65536, 1, 720906, 65536, 1, 655370, 65536, 1, 589834, 65536, 1, 589835, 65536, 1, 524299, 65536, 1, 458763, 65536, 1, 393227, 65536, 1, 393228, 65536, 1, 458764, 65536, 1, 524300, 65536, 1, 589836, 65536, 1, 655372, 65536, 1, 655371, 65536, 1, 720907, 65536, 1, 786443, 65536, 1, 851979, 65536, 1, 917515, 65536, 1, 917516, 65536, 1, 851980, 65536, 1, 786444, 65536, 1, 720908, 65536, 1, 720909, 65536, 1, 655373, 65536, 1, 589837, 65536, 1, 524301, 65536, 1, 458765, 65536, 1, 393229, 65536, 1, 393230, 65536, 1, 458766, 65536, 1, 524302, 65536, 1, 589838, 65536, 1, 655374, 65536, 1, 720910, 65536, 1, 786446, 65536, 1, 786445, 65536, 1, 851981, 65536, 1, 917517, 65536, 1, 917518, 65536, 1, 851982, 65536, 1, 851983, 65536, 1, 786447, 65536, 1, 720911, 65536, 1, 655375, 65536, 1, 589839, 65536, 1, 524303, 65536, 1, 458767, 65536, 1, 393231, 65536, 1, 393232, 65536, 1, 458768, 65536, 1, 524304, 65536, 1, 589840, 65536, 1, 655376, 65536, 1, 720912, 65536, 1, 786448, 65536, 1, 851984, 65536, 1, 917520, 65536, 1, 917519, 65536, 1) + +[node name="SpawnZones" type="Node2D" parent="."] + +[node name="SpawnZone1" type="Area2D" parent="SpawnZones"] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="SpawnZones/SpawnZone1"] +position = Vector2(32, 32) +shape = SubResource("RectangleShape2D_hodhv") + +[node name="SpawnZone2" type="Area2D" parent="SpawnZones"] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="SpawnZones/SpawnZone2"] +position = Vector2(256, 32) +shape = SubResource("RectangleShape2D_hodhv") + +[node name="SpawnZone3" type="Area2D" parent="SpawnZones"] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="SpawnZones/SpawnZone3"] +position = Vector2(256, 224) +shape = SubResource("RectangleShape2D_hodhv") + +[node name="SpawnZone4" type="Area2D" parent="SpawnZones"] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="SpawnZones/SpawnZone4"] +position = Vector2(32, 224) +shape = SubResource("RectangleShape2D_hodhv") + +[node name="Player" parent="." instance=ExtResource("2_s6cts")] +position = Vector2(144, 128) diff --git a/scene/player.tscn b/scene/player.tscn new file mode 100644 index 0000000..0304098 --- /dev/null +++ b/scene/player.tscn @@ -0,0 +1,25 @@ +[gd_scene load_steps=5 format=3 uid="uid://cd57rr2jffwqu"] + +[ext_resource type="Script" path="res://player.gd" id="1_yhpqp"] +[ext_resource type="Texture2D" uid="uid://bsrmtons1ov7x" path="res://assets/maze.png" id="2_1jodf"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_75d0y"] +atlas = ExtResource("2_1jodf") +region = Rect2(48, 0, 16, 16) + +[sub_resource type="CircleShape2D" id="CircleShape2D_c7wcn"] +radius = 6.0 + +[node name="Player" type="CharacterBody2D"] +script = ExtResource("1_yhpqp") + +[node name="Sprite2D" type="Sprite2D" parent="."] +texture = SubResource("AtlasTexture_75d0y") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource("CircleShape2D_c7wcn") + +[node name="Camera2D" type="Camera2D" parent="."] +zoom = Vector2(6, 6) +position_smoothing_enabled = true +position_smoothing_speed = 16.0