diff --git a/Assets/Textures/color_cube.png b/Assets/Textures/color_cube.png new file mode 100644 index 0000000..6b90195 Binary files /dev/null and b/Assets/Textures/color_cube.png differ diff --git a/Assets/Textures/color_cube.png.import b/Assets/Textures/color_cube.png.import new file mode 100644 index 0000000..d56a0c7 --- /dev/null +++ b/Assets/Textures/color_cube.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dp4tdg3fxe5bf" +path="res://.godot/imported/color_cube.png-4881adb426dcdbd1db4cca9d44eddf4a.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Textures/color_cube.png" +dest_files=["res://.godot/imported/color_cube.png-4881adb426dcdbd1db4cca9d44eddf4a.ctex"] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/bptc_ldr=0 +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/Scenes/Test Scene.tscn b/Scenes/Test Scene.tscn index 6365dcc..f50882f 100644 --- a/Scenes/Test Scene.tscn +++ b/Scenes/Test Scene.tscn @@ -1,6 +1,11 @@ -[gd_scene load_steps=2 format=3 uid="uid://0m5qkeqoo62l"] +[gd_scene load_steps=5 format=3 uid="uid://0m5qkeqoo62l"] [ext_resource type="TileSet" uid="uid://bf1eb4aogv8ru" path="res://Assets/Tilesets/colony.tres" id="2"] +[ext_resource type="Texture2D" uid="uid://dp4tdg3fxe5bf" path="res://Assets/Textures/color_cube.png" id="2_0flm2"] +[ext_resource type="Script" path="res://Scripts/Player/PlayerMovement.gd" id="2_gw00d"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_bcrdl"] +radius = 3.0 [node name="Test Scene" type="Node2D"] @@ -9,4 +14,20 @@ position = Vector2(0, 1) tile_set = ExtResource("2") collision_visibility_mode = 1 format = 2 -layer_0/tile_data = PackedInt32Array(983064, 196608, 0, 1114138, 262144, 1, 1048602, 0, 1, 983066, 262144, 0, 1114137, 65536, 0, 1114136, 196608, 1, 1048600, 131072, 1, 1048603, 131072, 1, 1179675, 131072, 2, 1114139, 589824, 0, 983067, 131072, 1, 917531, 589824, 0, 1179674, 65536, 2, 917530, 262144, 2, 1179673, 65536, 2, 917529, 65536, 1, 1179672, 65536, 2, 917528, 65536, 1, 1179671, 0, 2, 1114135, 524288, 0, 1048599, 0, 1, 983063, 0, 1, 917527, 524288, 0, 851995, 131072, 0, 851994, 65536, 0, 851993, 196608, 1, 851992, 65536, 1, 851991, 0, 1, 917532, 327680, 2, 917533, 458752, 1, 983069, 327680, 1, 1048605, 327680, 1, 1114141, 458752, 2, 1114140, 327680, 2, 917526, 327680, 2, 917525, 393216, 1, 983061, 327680, 1, 1048597, 327680, 1, 1114133, 393216, 2, 1114134, 327680, 2, 983065, 65536, 2, 786456, 262144, 3, 786457, 131072, 1, 720921, 196608, 0, 720920, 65536, 1, 720919, 0, 1, 655383, 262144, 0, 655382, 0, 2, 589848, 65536, 1, 589849, 196608, 2, 655385, 65536, 1, 655384, 262144, 3, 655386, 196608, 0, 720922, 131072, 2, 589850, 65536, 1, 524313, 65536, 1, 524312, 196608, 2, 524311, 262144, 1, 524310, 65536, 0, 589846, 262144, 0, 589847, 65536, 1, 524314, 196608, 1, 655387, 131072, 2, 589851, 131072, 1, 458776, 65536, 0, 458777, 65536, 0, 458778, 131072, 0, 524315, 131072, 0, 458775, 0, 0, 720916, 851968, 1, 655380, 983040, 1, 589844, 917504, 1, 524308, 917504, 1, 458772, 983040, 0, 458771, 851968, 1, 524307, 1048576, 2, 589843, 851968, 1, 655379, 1048576, 3, 720915, 851968, 1, 589845, 0, 2, 524309, 0, 0, 524306, 786432, 1, 458770, 1048576, 0, 589842, 786432, 1, 655378, 1048576, 1, 655377, 851968, 0, 458769, 851968, 2, 720914, 851968, 1, 720913, 983040, 2, 655376, 851968, 0, 589839, 917504, 1, 655375, 983040, 1, 524303, 917504, 1, 524302, 786432, 1, 589838, 786432, 1, 458768, 851968, 2, 458767, 983040, 0, 393233, 1048576, 1, 393234, 983040, 2, 393235, 851968, 1, 393236, 983040, 3, 458773, 851968, 2, 720917, 983040, 1, 655381, 917504, 0, 393237, 851968, 1, 786452, 851968, 1, 786453, 851968, 1, 720918, 917504, 0, 786454, 917504, 1, 851990, 917504, 2, 851989, 851968, 2, 851988, 983040, 0, 851987, 983040, 2, 786451, 983040, 2, 458774, 917504, 2, 393238, 983040, 0, 393239, 851968, 2, 393240, 851968, 2, 393241, 851968, 2, 393242, 917504, 2, 327706, 917504, 0, 327705, 851968, 0, 327704, 851968, 0, 327703, 851968, 0, 327702, 851968, 0, 327701, 851968, 0, 327700, 851968, 0, 327699, 851968, 0, 327698, 983040, 1, 786455, 0, 1, 786450, 851968, 1, 917522, 786432, 2, 917524, 917504, 1, 917523, 1048576, 0, 1048596, 917504, 2, 983060, 1376256, 0, 983059, 786432, 1, 1048595, 786432, 2, 851986, 1048576, 0, 851985, 786432, 2, 786449, 1048576, 0, 786448, 786432, 2, 720912, 1048576, 0, 720911, 786432, 2, 655374, 786432, 2, 458766, 786432, 1, 393231, 851968, 0, 393232, 851968, 0, 327697, 786432, 1, 327694, 917504, 1, 327693, 1310720, 0, 262157, 786432, 1, 262158, 983040, 0, 393230, 1441792, 3, 393229, 786432, 2, 262159, 851968, 2, 262160, 851968, 2, 262161, 1048576, 0, 196625, 851968, 1, 196624, 1048576, 3, 196623, 851968, 1, 196622, 1048576, 1, 262162, 917504, 1, 196626, 983040, 0, 196627, 851968, 2, 196628, 851968, 2, 196629, 917504, 2, 131093, 917504, 0, 131092, 851968, 0, 131091, 851968, 0, 131090, 851968, 0, 131089, 851968, 0, 131088, 851968, 0, 131086, 786432, 0, 131087, 851968, 0, 196621, 786432, 0, 327692, 1114112, 2, 327691, 1114112, 2, 262154, 917504, 0, 327690, 1376256, 0, 393226, 917504, 2, 262153, 851968, 0, 327689, 851968, 1, 393225, 851968, 2, 393224, 786432, 2, 327688, 786432, 1, 262152, 786432, 0) +layer_0/tile_data = PackedInt32Array(983064, 196608, 0, 1114138, 262144, 1, 1048602, 0, 1, 983066, 262144, 0, 1114137, 65536, 0, 1114136, 196608, 1, 1048600, 131072, 1, 1048603, 131072, 1, 1179675, 131072, 2, 1114139, 589824, 0, 983067, 131072, 1, 917531, 589824, 0, 1179674, 65536, 2, 917530, 262144, 2, 1179673, 65536, 2, 917529, 65536, 1, 1179672, 65536, 2, 917528, 65536, 1, 1179671, 0, 2, 1114135, 524288, 0, 1048599, 0, 1, 983063, 0, 1, 917527, 524288, 0, 851995, 131072, 0, 851994, 65536, 0, 851993, 196608, 1, 851992, 65536, 1, 851991, 0, 1, 917532, 327680, 2, 917533, 458752, 1, 983069, 327680, 1, 1048605, 327680, 1, 1114141, 458752, 2, 1114140, 327680, 2, 917526, 327680, 2, 917525, 393216, 1, 983061, 327680, 1, 1048597, 327680, 1, 1114133, 393216, 2, 1114134, 327680, 2, 983065, 65536, 2, 786456, 262144, 3, 786457, 131072, 1, 720921, 196608, 0, 720920, 65536, 1, 720919, 0, 1, 655383, 262144, 0, 655382, 0, 2, 589848, 65536, 1, 589849, 196608, 2, 655385, 65536, 1, 655384, 262144, 3, 655386, 196608, 0, 720922, 131072, 2, 589850, 65536, 1, 524313, 65536, 1, 524312, 196608, 2, 524311, 262144, 1, 524310, 65536, 0, 589846, 262144, 0, 589847, 65536, 1, 524314, 196608, 1, 655387, 131072, 2, 589851, 131072, 1, 458776, 65536, 0, 458777, 65536, 0, 458778, 131072, 0, 524315, 131072, 0, 458775, 0, 0, 720916, 851968, 1, 655380, 983040, 1, 589844, 917504, 1, 524308, 917504, 1, 458772, 983040, 0, 458771, 851968, 1, 524307, 1048576, 2, 589843, 851968, 1, 655379, 1048576, 3, 720915, 851968, 1, 589845, 0, 2, 524309, 0, 0, 524306, 786432, 1, 458770, 1048576, 0, 589842, 786432, 1, 655378, 1048576, 1, 655377, 851968, 0, 458769, 851968, 2, 720914, 851968, 1, 720913, 983040, 2, 655376, 851968, 0, 589839, 917504, 1, 655375, 1441792, 3, 524303, 917504, 1, 524302, 786432, 1, 589838, 786432, 1, 458768, 851968, 2, 458767, 983040, 0, 393233, 1048576, 1, 393234, 983040, 2, 393235, 851968, 1, 393236, 983040, 3, 458773, 851968, 2, 720917, 983040, 1, 655381, 917504, 0, 393237, 851968, 1, 786452, 851968, 1, 786453, 851968, 1, 720918, 917504, 0, 786454, 917504, 1, 851990, 917504, 2, 851989, 851968, 2, 851988, 983040, 0, 851987, 983040, 2, 786451, 983040, 2, 458774, 917504, 2, 393238, 983040, 0, 393239, 851968, 2, 393240, 851968, 2, 393241, 851968, 2, 393242, 917504, 2, 327706, 917504, 0, 327705, 851968, 0, 327704, 851968, 0, 327703, 851968, 0, 327702, 851968, 0, 327701, 851968, 0, 327700, 851968, 0, 327699, 851968, 0, 327698, 983040, 1, 786455, 0, 1, 786450, 851968, 1, 917522, 786432, 2, 917524, 917504, 1, 917523, 1048576, 0, 1048596, 917504, 2, 983060, 1376256, 0, 983059, 786432, 1, 1048595, 786432, 2, 851986, 1048576, 0, 851985, 786432, 2, 786449, 1048576, 0, 786448, 786432, 2, 720912, 1048576, 0, 720911, 786432, 2, 655374, 786432, 2, 458766, 786432, 1, 393231, 851968, 0, 393232, 851968, 0, 327697, 786432, 1, 327694, 917504, 1, 327693, 1310720, 0, 262157, 786432, 1, 262158, 983040, 0, 393230, 1441792, 3, 393229, 786432, 2, 262159, 851968, 2, 262160, 851968, 2, 262161, 1048576, 0, 196625, 851968, 1, 196624, 1048576, 3, 196623, 851968, 1, 196622, 1048576, 1, 262162, 917504, 1, 196626, 983040, 0, 196627, 851968, 2, 196628, 851968, 2, 196629, 917504, 2, 131093, 917504, 0, 131092, 851968, 0, 131091, 851968, 0, 131090, 851968, 0, 131089, 851968, 0, 131088, 851968, 0, 131086, 786432, 0, 131087, 851968, 0, 196621, 786432, 0, 327692, 1114112, 2, 327691, 1114112, 2, 262154, 917504, 0, 327690, 1376256, 0, 393226, 917504, 2, 262153, 851968, 0, 327689, 851968, 1, 393225, 851968, 2, 393224, 786432, 2, 327688, 786432, 1, 262152, 786432, 0) + +[node name="Player" type="CharacterBody2D" parent="."] +script = ExtResource("2_gw00d") + +[node name="Sprite2D" type="Sprite2D" parent="Player"] +position = Vector2(149, 86) +texture = ExtResource("2_0flm2") + +[node name="Camera2D" type="Camera2D" parent="Player"] +position = Vector2(149, 86) +current = true +zoom = Vector2(8, 8) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Player"] +position = Vector2(149, 86) +shape = SubResource("CircleShape2D_bcrdl") diff --git a/Scripts/Player/PlayerMovement.gd b/Scripts/Player/PlayerMovement.gd new file mode 100644 index 0000000..e80a06a --- /dev/null +++ b/Scripts/Player/PlayerMovement.gd @@ -0,0 +1,18 @@ +extends CharacterBody2D + +@export var speed = 50 + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass # Replace with function body. + +func get_input(): + var input_direction = Input.get_vector("move_left", "move_right", "move_up", "move_down") + velocity = input_direction * speed + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _physics_process(delta): + get_input() + move_and_slide() + + diff --git a/project.godot b/project.godot index 549a833..2117cd1 100644 --- a/project.godot +++ b/project.godot @@ -11,8 +11,13 @@ config_version=5 [application] config/name="2d Hack And Slay" +run/main_scene="res://Scenes/Test Scene.tscn" config/features=PackedStringArray("4.0") +[display] + +window/stretch/aspect="ignore" + [editor] version_control_autoload_on_startup=true @@ -26,6 +31,33 @@ enabled=PackedStringArray() common/drop_mouse_on_gui_input_disabled=true +[input] + +move_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) +, 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":4194320,"key_label":0,"unicode":0,"echo":false,"script":null) +] +} +move_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) +, 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":4194322,"key_label":0,"unicode":0,"echo":false,"script":null) +] +} +move_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) +, 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":4194319,"key_label":0,"unicode":0,"echo":false,"script":null) +] +} +move_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) +, 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":4194321,"key_label":0,"unicode":0,"echo":false,"script":null) +] +} + [physics] common/enable_pause_aware_picking=true