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/Player/player.gd b/Player/player.gd new file mode 100644 index 0000000..456500e --- /dev/null +++ b/Player/player.gd @@ -0,0 +1,25 @@ +extends CharacterBody2D + + +const SPEED = 100 + +func _physics_process(delta): + var direction_x = Input.get_axis("Left", "Right") + var direction_y = Input.get_axis("Up", "Down") + if direction_x: + velocity.x = direction_x * SPEED + velocity.y = 0 + elif direction_y: + velocity.y = direction_y * SPEED + velocity.x = 0 + if !direction_x: + velocity.x = move_toward(velocity.x, 0, SPEED) + if !direction_y: + velocity.y = move_toward(velocity.y, 0, SPEED) + var collision = move_and_collide(velocity * delta) + if collision and collision.get_collider() is TileMap: + var tilemap = collision.get_collider() + var pos = tilemap.local_to_map(collision.get_position()) + tilemap.erase_cell(0,pos) + + diff --git a/Player/player.tscn b/Player/player.tscn new file mode 100644 index 0000000..1dce928 --- /dev/null +++ b/Player/player.tscn @@ -0,0 +1,17 @@ +[gd_scene load_steps=4 format=3 uid="uid://dxgyw2gl5mrt3"] + +[ext_resource type="Script" path="res://Player/player.gd" id="1_y7tub"] +[ext_resource type="Texture2D" uid="uid://b2rejig7whdt2" path="res://icon.svg" id="2_5ysy7"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_pvp4b"] +radius = 16.0 + +[node name="Player" type="CharacterBody2D"] +script = ExtResource("1_y7tub") + +[node name="Sprite2D" type="Sprite2D" parent="."] +scale = Vector2(0.25, 0.25) +texture = ExtResource("2_5ysy7") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource("CircleShape2D_pvp4b") diff --git a/Sprites/pixil-frame-0.png b/Sprites/pixil-frame-0.png new file mode 100644 index 0000000..3e9df0c Binary files /dev/null and b/Sprites/pixil-frame-0.png differ diff --git a/Sprites/pixil-frame-0.png.import b/Sprites/pixil-frame-0.png.import new file mode 100644 index 0000000..2d3ea72 --- /dev/null +++ b/Sprites/pixil-frame-0.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bhokt5kekyjmt" +path="res://.godot/imported/pixil-frame-0.png-244d461681bf687a4ae24cf8dcfc6490.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Sprites/pixil-frame-0.png" +dest_files=["res://.godot/imported/pixil-frame-0.png-244d461681bf687a4ae24cf8dcfc6490.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/World/world.tscn b/World/world.tscn new file mode 100644 index 0000000..77e1618 --- /dev/null +++ b/World/world.tscn @@ -0,0 +1,30 @@ +[gd_scene load_steps=6 format=3 uid="uid://c0sna7behoynp"] + +[ext_resource type="Texture2D" uid="uid://bhokt5kekyjmt" path="res://Sprites/pixil-frame-0.png" id="1_tx6b7"] +[ext_resource type="PackedScene" uid="uid://dxgyw2gl5mrt3" path="res://Player/player.tscn" id="1_yd6rp"] + +[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_doxqc"] + +[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_hru0s"] +texture = ExtResource("1_tx6b7") +texture_region_size = Vector2i(8, 8) +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(-3.5, -3.375, 3.375, -3.4375, 3.4375, 3.5, -3.4375, 3.4375) + +[sub_resource type="TileSet" id="TileSet_1p3wg"] +tile_size = Vector2i(8, 8) +physics_layer_0/collision_layer = 1 +physics_layer_0/physics_material = SubResource("PhysicsMaterial_doxqc") +sources/0 = SubResource("TileSetAtlasSource_hru0s") + +[node name="World" type="Node2D"] + +[node name="Player" parent="." instance=ExtResource("1_yd6rp")] +position = Vector2(216, 103) + +[node name="TileMap" type="TileMap" parent="."] +tile_set = SubResource("TileSet_1p3wg") +format = 2 +layer_0/tile_data = PackedInt32Array(1048599, 0, 0, 1048600, 0, 0, 1048601, 0, 0, 1048602, 0, 0, 1048603, 0, 0, 1048604, 0, 0, 1048605, 0, 0, 1048606, 0, 0, 1048607, 0, 0, 1048608, 0, 0, 1114143, 0, 0, 1114142, 0, 0, 1114141, 0, 0, 1114140, 0, 0, 1114139, 0, 0, 1114138, 0, 0, 1114137, 0, 0, 1114136, 0, 0, 1114135, 0, 0, 1114144, 0, 0, 1179679, 0, 0, 1179678, 0, 0, 1179680, 0, 0, 1179677, 0, 0, 1179676, 0, 0, 1179675, 0, 0, 1179674, 0, 0, 1245209, 0, 0, 1245208, 0, 0, 1245207, 0, 0, 1179671, 0, 0, 1179672, 0, 0, 1179673, 0, 0, 1245211, 0, 0, 1245212, 0, 0, 1245213, 0, 0, 1245214, 0, 0, 1245215, 0, 0, 1245216, 0, 0, 1245217, 0, 0, 1245210, 0, 0, 1310746, 0, 0, 1310745, 0, 0, 1310744, 0, 0, 1310743, 0, 0, 1310742, 0, 0, 1376278, 0, 0, 1376280, 0, 0, 1310747, 0, 0, 1376282, 0, 0, 1376281, 0, 0, 1376279, 0, 0, 1310748, 0, 0, 1310749, 0, 0, 1376284, 0, 0, 1376283, 0, 0, 1441818, 0, 0, 1441817, 0, 0, 1441816, 0, 0, 1376285, 0, 0, 1376286, 0, 0, 1376287, 0, 0, 1376288, 0, 0, 1441821, 0, 0, 1441820, 0, 0, 1441819, 0, 0, 1310750, 0, 0, 1310751, 0, 0, 1310752, 0, 0, 1376289, 0, 0, 1441824, 0, 0, 1441823, 0, 0, 1310753, 0, 0, 1179681, 0, 0, 1114145, 0, 0, 1048609, 0, 0, 1048598, 0, 0, 1114134, 0, 0, 1179670, 0, 0, 1245206, 0, 0, 1441814, 0, 0, 1441815, 0, 0, 1441822, 0, 0, 1441825, 0, 0, 1507361, 0, 0, 1572897, 0, 0, 1638433, 0, 0, 1703969, 0, 0, 1769505, 0, 0, 1769504, 0, 0, 1769503, 0, 0, 1769502, 0, 0, 1769501, 0, 0, 1769500, 0, 0, 1769499, 0, 0, 1769498, 0, 0, 1769497, 0, 0, 1769496, 0, 0, 1769495, 0, 0, 1769494, 0, 0, 1703958, 0, 0, 1638422, 0, 0, 1572886, 0, 0, 1507350, 0, 0, 1507351, 0, 0, 1572887, 0, 0, 1703959, 0, 0, 1638423, 0, 0, 1703960, 0, 0, 1638424, 0, 0, 1572888, 0, 0, 1507352, 0, 0, 1703961, 0, 0, 1638425, 0, 0, 1572889, 0, 0, 1507353, 0, 0, 1638426, 0, 0, 1572890, 0, 0, 1507354, 0, 0, 1507355, 0, 0, 1572891, 0, 0, 1638427, 0, 0, 1703963, 0, 0, 1703962, 0, 0, 1572892, 0, 0, 1507356, 0, 0, 1638428, 0, 0, 1703964, 0, 0, 1638429, 0, 0, 1572893, 0, 0, 1507357, 0, 0, 1703965, 0, 0, 1572894, 0, 0, 1507358, 0, 0, 1638430, 0, 0, 1703966, 0, 0, 1638431, 0, 0, 1572895, 0, 0, 1507359, 0, 0, 1703967, 0, 0, 1638432, 0, 0, 1572896, 0, 0, 1507360, 0, 0, 1703968, 0, 0, 1835030, 0, 0, 1835031, 0, 0, 1835032, 0, 0, 1835033, 0, 0, 1835034, 0, 0, 1835035, 0, 0, 1835036, 0, 0, 1835037, 0, 0, 1835038, 0, 0, 1835039, 0, 0, 1835040, 0, 0, 1835041, 0, 0, 1900577, 0, 0, 1900576, 0, 0, 1900575, 0, 0, 1900574, 0, 0, 1900573, 0, 0, 1900572, 0, 0, 1900571, 0, 0, 1900570, 0, 0, 1900569, 0, 0, 1900568, 0, 0, 1900567, 0, 0, 1900566, 0, 0, 1900565, 0, 0, 1835029, 0, 0, 1769493, 0, 0, 1703957, 0, 0, 1638421, 0, 0, 1572885, 0, 0, 1507349, 0, 0, 1441813, 0, 0, 1376277, 0, 0, 1310741, 0, 0, 1048597, 0, 0, 1114133, 0, 0, 1179669, 0, 0, 1245205, 0, 0, 1966101, 0, 0, 2031637, 0, 0, 2097173, 0, 0, 2162709, 0, 0, 2228245, 0, 0, 2293781, 0, 0, 2359317, 0, 0, 2424853, 0, 0, 2490389, 0, 0, 2490390, 0, 0, 2490391, 0, 0, 2490392, 0, 0, 2490393, 0, 0, 2490394, 0, 0, 2490395, 0, 0, 2490396, 0, 0, 2490397, 0, 0, 2490398, 0, 0, 2490399, 0, 0, 2490400, 0, 0, 2424864, 0, 0, 2359328, 0, 0, 2359329, 0, 0, 2293793, 0, 0, 2228257, 0, 0, 2162721, 0, 0, 2097185, 0, 0, 2031649, 0, 0, 1966113, 0, 0, 2424865, 0, 0, 2490401, 0, 0, 2424863, 0, 0, 2424862, 0, 0, 2424861, 0, 0, 2424860, 0, 0, 2424859, 0, 0, 2424858, 0, 0, 2424857, 0, 0, 2424856, 0, 0, 2424855, 0, 0, 2424854, 0, 0, 2359318, 0, 0, 2293782, 0, 0, 2228246, 0, 0, 2162710, 0, 0, 2097174, 0, 0, 2031639, 0, 0, 1966103, 0, 0, 2031638, 0, 0, 1966102, 0, 0, 2097175, 0, 0, 2162711, 0, 0, 2228247, 0, 0, 2293783, 0, 0, 2359319, 0, 0, 2293784, 0, 0, 2228248, 0, 0, 2162712, 0, 0, 2097176, 0, 0, 2031640, 0, 0, 1966104, 0, 0, 2031641, 0, 0, 2097177, 0, 0, 2162713, 0, 0, 2228249, 0, 0, 2293785, 0, 0, 2359321, 0, 0, 1966105, 0, 0, 2359320, 0, 0, 2359322, 0, 0, 2293786, 0, 0, 2228250, 0, 0, 2162714, 0, 0, 2097178, 0, 0, 2031642, 0, 0, 1966106, 0, 0, 2031643, 0, 0, 1966107, 0, 0, 2097179, 0, 0, 2162715, 0, 0, 2228251, 0, 0, 2293787, 0, 0, 2359323, 0, 0, 2359324, 0, 0, 2293788, 0, 0, 2228252, 0, 0, 2162716, 0, 0, 2097180, 0, 0, 2031644, 0, 0, 1966108, 0, 0, 2031645, 0, 0, 2097181, 0, 0, 2162717, 0, 0, 2228253, 0, 0, 2293789, 0, 0, 2359325, 0, 0, 1966110, 0, 0, 2031646, 0, 0, 2097182, 0, 0, 2162718, 0, 0, 2228254, 0, 0, 2293790, 0, 0, 2359326, 0, 0, 1966109, 0, 0, 2293791, 0, 0, 2228255, 0, 0, 2162719, 0, 0, 2097183, 0, 0, 2031647, 0, 0, 1966111, 0, 0, 2359327, 0, 0, 2293792, 0, 0, 2228256, 0, 0, 2162720, 0, 0, 2097184, 0, 0, 2031648, 0, 0, 1966112, 0, 0, 2490402, 0, 0, 2424866, 0, 0, 2359330, 0, 0, 2293794, 0, 0, 2228258, 0, 0, 2162722, 0, 0, 2097186, 0, 0, 2031650, 0, 0, 1966114, 0, 0, 1900578, 0, 0, 1835042, 0, 0, 1769506, 0, 0, 1703970, 0, 0, 1638434, 0, 0, 1572898, 0, 0, 1507362, 0, 0, 1048610, 0, 0, 1114146, 0, 0, 1179682, 0, 0, 1245218, 0, 0, 1310754, 0, 0, 1376290, 0, 0, 1441826, 0, 0, 1048596, 0, 0, 1114132, 0, 0, 1179668, 0, 0, 1245204, 0, 0, 1310740, 0, 0, 1376276, 0, 0, 1441812, 0, 0, 1507348, 0, 0, 1572884, 0, 0, 1638420, 0, 0, 1703956, 0, 0, 1769492, 0, 0, 1835028, 0, 0, 1900564, 0, 0, 1966100, 0, 0, 2031636, 0, 0, 2097172, 0, 0, 2162708, 0, 0, 2228244, 0, 0, 2293780, 0, 0, 2359316, 0, 0, 2424852, 0, 0, 2490388, 0, 0) 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..48e2c81 --- /dev/null +++ b/icon.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b2rejig7whdt2" +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/project.godot b/project.godot new file mode 100644 index 0000000..66fcf82 --- /dev/null +++ b/project.godot @@ -0,0 +1,39 @@ +; 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="Mining Game" +run/main_scene="res://World/world.tscn" +config/features=PackedStringArray("4.2", "Forward Plus") +config/icon="res://icon.svg" + +[input] + +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) +] +} +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) +] +}