commit a2164dca72c16eec8a1ef29483550178038bfacb Author: Rendo Date: Sat Oct 4 12:09:50 2025 +0500 Initial commit 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"] + +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gAAAACAAAAAAAJAAgAAAACAAAAAAAKAAgAAAACAAAAAAALAAgAAAACAAAAAAAMAAgAAAACAAAAAAAAAP//AAAAAAIAAAABAP//AAAAAAIAAAACAP//AAAAAAIAAAADAP//AAAAAAIAAAAEAP//AAAAAAIAAAAFAP//AAAAAAIAAAAGAP//AAAAAAIAAAAHAP//AAAAAAIAAAAIAP//AAAAAAIAAAAJAP//AAAAAAIAAAAKAP//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 0000000..ff75872 Binary files /dev/null and b/sprites/atlasses/Lorpeka.png differ 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 0000000..f319e01 Binary files /dev/null and b/sprites/atlasses/Popekko.png differ 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