From a2164dca72c16eec8a1ef29483550178038bfacb Mon Sep 17 00:00:00 2001 From: Rendo Date: Sat, 4 Oct 2025 12:09:50 +0500 Subject: [PATCH] Initial commit --- .editorconfig | 4 ++ .gitattributes | 2 + .gitignore | 3 ++ generic/platform.tres | 32 ++++++++++++++++ icon.svg | 1 + icon.svg.import | 43 +++++++++++++++++++++ node_2d.gd | 1 + node_2d.gd.uid | 1 + project.godot | 32 ++++++++++++++++ scenes/2d_world.tscn | 10 +++++ scenes/mounted_gun.tscn | 13 +++++++ scenes/player_platform.tscn | 12 ++++++ scripts/build_zone.gd | 57 ++++++++++++++++++++++++++++ scripts/build_zone.gd.uid | 1 + scripts/player_state.gd | 1 + scripts/player_state.gd.uid | 1 + sprites/atlasses/Lorpeka.png | Bin 0 -> 919 bytes sprites/atlasses/Lorpeka.png.import | 40 +++++++++++++++++++ sprites/atlasses/Popekko.png | Bin 0 -> 823 bytes sprites/atlasses/Popekko.png.import | 40 +++++++++++++++++++ 20 files changed, 294 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 generic/platform.tres create mode 100644 icon.svg create mode 100644 icon.svg.import create mode 100644 node_2d.gd create mode 100644 node_2d.gd.uid create mode 100644 project.godot create mode 100644 scenes/2d_world.tscn create mode 100644 scenes/mounted_gun.tscn create mode 100644 scenes/player_platform.tscn create mode 100644 scripts/build_zone.gd create mode 100644 scripts/build_zone.gd.uid create mode 100644 scripts/player_state.gd create mode 100644 scripts/player_state.gd.uid create mode 100644 sprites/atlasses/Lorpeka.png create mode 100644 sprites/atlasses/Lorpeka.png.import create mode 100644 sprites/atlasses/Popekko.png create mode 100644 sprites/atlasses/Popekko.png.import diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..f28239b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,4 @@ +root = true + +[*] +charset = utf-8 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..0af181c --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Godot 4+ specific ignores +.godot/ +/android/ diff --git a/generic/platform.tres b/generic/platform.tres new file mode 100644 index 0000000..7196177 --- /dev/null +++ b/generic/platform.tres @@ -0,0 +1,32 @@ +[gd_resource type="TileSet" load_steps=3 format=3 uid="uid://bv75bu0af04vs"] + +[ext_resource type="Texture2D" uid="uid://5a173ko7iowk" path="res://sprites/atlasses/Lorpeka.png" id="1_eak7k"] + +[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_vxqge"] +texture = ExtResource("1_eak7k") +0:0/0 = 0 +0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +1:0/0 = 0 +0:1/0 = 0 +0:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +1:1/0 = 0 +0:2/0 = 0 +1:2/0 = 0 +2:2/0 = 0 +2:1/0 = 0 +2:0/0 = 0 +3:0/0 = 0 +3:1/0 = 0 +3:2/0 = 0 +4:1/0 = 0 +4:2/0 = 0 +5:2/0 = 0 +5:1/0 = 0 +4:0/0 = 0 +5:0/0 = 0 +6:0/0 = 0 +6:1/0 = 0 + +[resource] +physics_layer_0/collision_layer = 1 +sources/0 = SubResource("TileSetAtlasSource_vxqge") diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..c6bbb7d --- /dev/null +++ b/icon.svg @@ -0,0 +1 @@ + diff --git a/icon.svg.import b/icon.svg.import new file mode 100644 index 0000000..8d97407 --- /dev/null +++ b/icon.svg.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ugbe4qcmgfw0" +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/uastc_level=0 +compress/rdo_quality_loss=0.0 +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/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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/node_2d.gd b/node_2d.gd new file mode 100644 index 0000000..e251cf8 --- /dev/null +++ b/node_2d.gd @@ -0,0 +1 @@ +extends Node2D diff --git a/node_2d.gd.uid b/node_2d.gd.uid new file mode 100644 index 0000000..cbbc17e --- /dev/null +++ b/node_2d.gd.uid @@ -0,0 +1 @@ +uid://6q6yvdigdloo diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..ab11115 --- /dev/null +++ b/project.godot @@ -0,0 +1,32 @@ +; 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="Delurbelako" +run/main_scene="uid://u7thalwj5742" +config/features=PackedStringArray("4.5", "GL Compatibility") +config/icon="res://icon.svg" + +[display] + +window/size/viewport_width=512 +window/size/viewport_height=288 +window/stretch/mode="canvas_items" + +[layer_names] + +2d_physics/layer_1="Platform" + +[rendering] + +textures/canvas_textures/default_texture_filter=0 +renderer/rendering_method="gl_compatibility" +renderer/rendering_method.mobile="gl_compatibility" diff --git a/scenes/2d_world.tscn b/scenes/2d_world.tscn new file mode 100644 index 0000000..9836907 --- /dev/null +++ b/scenes/2d_world.tscn @@ -0,0 +1,10 @@ +[gd_scene load_steps=2 format=3 uid="uid://u7thalwj5742"] + +[ext_resource type="PackedScene" uid="uid://b7du4vul4bmpq" path="res://scenes/player_platform.tscn" id="1_4ia00"] + +[node name="2D World" type="Node2D"] + +[node name="PlayerPlatform" parent="." instance=ExtResource("1_4ia00")] +position = Vector2(17, 17) +use_kinematic_bodies = true +navigation_enabled = false diff --git a/scenes/mounted_gun.tscn b/scenes/mounted_gun.tscn new file mode 100644 index 0000000..1772239 --- /dev/null +++ b/scenes/mounted_gun.tscn @@ -0,0 +1,13 @@ +[gd_scene load_steps=3 format=3 uid="uid://buklkcwb0k2rc"] + +[ext_resource type="Texture2D" uid="uid://416h8gs1f7x0" path="res://sprites/atlasses/Popekko.png" id="1_ligff"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_qfuiw"] +atlas = ExtResource("1_ligff") +region = Rect2(0, 0, 5, 5) + +[node name="MountedGun" type="Node2D"] + +[node name="Sprite2D" type="Sprite2D" parent="."] +position = Vector2(-2.5, 2.5) +texture = SubResource("AtlasTexture_qfuiw") diff --git a/scenes/player_platform.tscn b/scenes/player_platform.tscn new file mode 100644 index 0000000..15970ff --- /dev/null +++ b/scenes/player_platform.tscn @@ -0,0 +1,12 @@ +[gd_scene load_steps=3 format=4 uid="uid://b7du4vul4bmpq"] + +[ext_resource type="TileSet" uid="uid://bv75bu0af04vs" path="res://generic/platform.tres" id="1_khkq2"] +[ext_resource type="Script" uid="uid://lw1ya3iu14uf" path="res://scripts/build_zone.gd" id="2_wpmwa"] + +[node name="PlayerPlatform" type="TileMapLayer"] +tile_map_data = PackedByteArray("AAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAACAAAAAAAAAAAAAAADAAAAAAAAAAEAAAAEAAAAAAAAAAEAAAAFAAAAAAAAAAEAAAAGAAAAAAAAAAAAAAAGAAEAAAAAAAAAAAAHAAEAAAAAAAAAAAAHAAIAAAAAAAAAAAAGAAIAAAAAAAEAAA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AAAKAP//AAAAAAIAAAALAP//AAAAAAIAAAAMAP//AAAAAAIAAAD/////AAACAAIAAAANAP//AAADAAIAAAA=") +tile_set = ExtResource("1_khkq2") + +[node name="BuildRect" type="Marker2D" parent="."] +script = ExtResource("2_wpmwa") +building_rect = Rect2(0, 0, 208, 128) diff --git a/scripts/build_zone.gd b/scripts/build_zone.gd new file mode 100644 index 0000000..334ebac --- /dev/null +++ b/scripts/build_zone.gd @@ -0,0 +1,57 @@ +@tool +@warning_ignore_start("integer_division") + +## Class that helps to manage construction sites +extends Marker2D + +class_name BuildZone + +const GRID_SIZE : Vector2 = Vector2(16,16) + +## Rect that used for bounds check and conversions +@export var building_rect : Rect2: + set(value): + building_rect = value + if Engine.is_editor_hint(): + queue_redraw() + get: + return building_rect + +func _draw() -> void: + if Engine.is_editor_hint() and EditorInterface.get_inspector().get_edited_object() == self: + draw_rect(building_rect,Color.CYAN,false,1) + +## Returns true if point (local coordinates) in rect, else return false +func is_point_in_zone(point : Vector2) -> bool: + return building_rect.has_point(point) + +## Returns true if point (global coordinates) in rect, else return false +func is_global_point_in_zone(point: Vector2) -> bool: + return is_point_in_zone(to_local(point)) + +## Returns index of point (local coordinates) to be used in array +func indexify_point(point : Vector2) -> int: + if is_point_in_zone(point) == false: + return -1 + return int(point.x) / int(GRID_SIZE.x) + int(building_rect.size.x/GRID_SIZE.x)*(int(point.y) / int(GRID_SIZE.y)) + +## Returns index of point (global coordinates) to be used in array +func indexify_global_point(point : Vector2) -> int: + return indexify_point(to_local(point)) + +## Inverses indexification of point, returning snapped position +func inverse_index(index: int) -> Vector2: + return to_global(Vector2(index%int(building_rect.size.x/GRID_SIZE.x)*GRID_SIZE.x,index / int(building_rect.size.x/GRID_SIZE.x) * GRID_SIZE.y)) + +## Returns snapped position of point (global coordinates). +## Equivalent of [code] +## inverse_index(indexify_global_point(point)) +## [/code] +func get_placement_position(point : Vector2) -> Vector2: + if is_global_point_in_zone(point) == false: + return Vector2.ZERO + return to_global((to_local(point) / GRID_SIZE).floor()*GRID_SIZE + GRID_SIZE/2.0) + +## Returns capacity of building zone to be used in the array +func get_capacity() -> int: + return int(building_rect.size.x/GRID_SIZE.x)*int(building_rect.size.y/GRID_SIZE.y) diff --git a/scripts/build_zone.gd.uid b/scripts/build_zone.gd.uid new file mode 100644 index 0000000..76b0a4a --- /dev/null +++ b/scripts/build_zone.gd.uid @@ -0,0 +1 @@ +uid://lw1ya3iu14uf diff --git a/scripts/player_state.gd b/scripts/player_state.gd new file mode 100644 index 0000000..61510e1 --- /dev/null +++ b/scripts/player_state.gd @@ -0,0 +1 @@ +extends Node diff --git a/scripts/player_state.gd.uid b/scripts/player_state.gd.uid new file mode 100644 index 0000000..8cdbccd --- /dev/null +++ b/scripts/player_state.gd.uid @@ -0,0 +1 @@ +uid://b004eslxx7ylv diff --git a/sprites/atlasses/Lorpeka.png b/sprites/atlasses/Lorpeka.png new file mode 100644 index 0000000000000000000000000000000000000000..ff758720a95504c0da98923614ff7378d437c6b6 GIT binary patch literal 919 zcmV;I18Dq-P)(7Gx9w|A0G?a}MJJ+voc1`u!FYAK}h?{_gJGJ5zZ5vh4uC(ZL=7U^Je9 zv9rD5zV@E~@%s+|;KRqu0zz`Q-*5oHp3cJl>k_7Q9jbm-H($S@m)!EfO+WPYM5({o z>tJX-0swZ)o9LchM5@0C0JVyN(Ri{T5}rg8ov&34*=tdTJ)Pn9!GxigVCW^>KA5rG zOhM}gfbQ7^cFUU!;zenLCL=@~BJy{C6ih4J`v*7uLbY6Xw)E$=v)BLHeR%3IOl$5$ zCY(&&MNz@sy&bWM;bC`P)MHrYU*dDu>-{?k__oWqU-O>eg}b}A6X`0M3!@yvI*=y` z$BAH0l*JV=NyqW1{1X2MiclyXA&)x?<*8MSKwT#vW)Nyvn#AzJWjR#H3$B19RyJ91 zph!f~80ii0iR2N+fea=df22uIdRQwU4+)n(RthK*jK<6KP+a9IKcV<@7mF0=0jlB@KE-mAqXY|RK=4Qu t{}`0$J%iJJ=sLZ<#{5?Y8%`db_!r~1xcUZEZ*c$s002ovPDHLkV1iM!v#tOD literal 0 HcmV?d00001 diff --git a/sprites/atlasses/Lorpeka.png.import b/sprites/atlasses/Lorpeka.png.import new file mode 100644 index 0000000..9518bf0 --- /dev/null +++ b/sprites/atlasses/Lorpeka.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://5a173ko7iowk" +path="res://.godot/imported/Lorpeka.png-f43a0d85fcb09484172c72994d520a0f.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://sprites/atlasses/Lorpeka.png" +dest_files=["res://.godot/imported/Lorpeka.png-f43a0d85fcb09484172c72994d520a0f.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +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/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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/sprites/atlasses/Popekko.png b/sprites/atlasses/Popekko.png new file mode 100644 index 0000000000000000000000000000000000000000..f319e01e93e56bc9ab6271732efde198d0c2204a GIT binary patch literal 823 zcmeAS@N?(olHy`uVBq!ia0y~yU;;836*$;{)FGSGfk1(Oo-U3d6?5L+QuJdE6k)w^ zJCZ?p)m?UQ%LW!3&)nS5)aDFxgBdfI9ZcZxy{r{oC#^pHI&TI4*1yIK1$(-_H2;0~%D2S^2ef$1>_8-@eF*F?hxl@9JL1yRm<>Jn=4Cj0%s$4$l!@9kvr#Y_ e0z`#C-!=1kHHV2EAu6B@!QkoY=d#Wzp$PyD>~yXG literal 0 HcmV?d00001 diff --git a/sprites/atlasses/Popekko.png.import b/sprites/atlasses/Popekko.png.import new file mode 100644 index 0000000..b8d9bec --- /dev/null +++ b/sprites/atlasses/Popekko.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://416h8gs1f7x0" +path="res://.godot/imported/Popekko.png-5c34a5f2a8c85fcf59453310fa6553d9.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://sprites/atlasses/Popekko.png" +dest_files=["res://.godot/imported/Popekko.png-5c34a5f2a8c85fcf59453310fa6553d9.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +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/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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