diff --git a/buildings/Building 1x2 fixed.png b/buildings/Building 1x2 fixed.png new file mode 100644 index 0000000..3b9345f Binary files /dev/null and b/buildings/Building 1x2 fixed.png differ diff --git a/buildings/Building 1x2 fixed.png.import b/buildings/Building 1x2 fixed.png.import new file mode 100644 index 0000000..0ac93ca --- /dev/null +++ b/buildings/Building 1x2 fixed.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://djir4ehm8kif" +path="res://.godot/imported/Building 1x2 fixed.png-e90afc0d25a8919ada570064ed667de1.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://buildings/Building 1x2 fixed.png" +dest_files=["res://.godot/imported/Building 1x2 fixed.png-e90afc0d25a8919ada570064ed667de1.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/buildings/Building 2x1 downside.png b/buildings/Building 2x1 downside.png new file mode 100644 index 0000000..ecab260 Binary files /dev/null and b/buildings/Building 2x1 downside.png differ diff --git a/buildings/Building 2x1 downside.png.import b/buildings/Building 2x1 downside.png.import new file mode 100644 index 0000000..52d9ce5 --- /dev/null +++ b/buildings/Building 2x1 downside.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://3weywjfsapax" +path="res://.godot/imported/Building 2x1 downside.png-4b432eb4152bab7dd594f2976783dfd3.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://buildings/Building 2x1 downside.png" +dest_files=["res://.godot/imported/Building 2x1 downside.png-4b432eb4152bab7dd594f2976783dfd3.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/buildings/Building 2x1 fixed.png b/buildings/Building 2x1 fixed.png new file mode 100644 index 0000000..bc86c15 Binary files /dev/null and b/buildings/Building 2x1 fixed.png differ diff --git a/buildings/Building 2x1 fixed.png.import b/buildings/Building 2x1 fixed.png.import new file mode 100644 index 0000000..a78eae3 --- /dev/null +++ b/buildings/Building 2x1 fixed.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dfy0gccqgggp2" +path="res://.godot/imported/Building 2x1 fixed.png-b02748fa52aebae62f987c8fd86c364f.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://buildings/Building 2x1 fixed.png" +dest_files=["res://.godot/imported/Building 2x1 fixed.png-b02748fa52aebae62f987c8fd86c364f.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/buildings/building.gd b/buildings/building.gd index 27a49fe..9bad536 100644 --- a/buildings/building.gd +++ b/buildings/building.gd @@ -1,6 +1,6 @@ class_name Building extends Node2D -var location : Vector2i # x is the angle, y is the height in the grid +@export var location : Vector2i # x is the angle, y is the height in the grid @export var dimension : Vector2i = Vector2(2, 1) # same as above @onready var grid : Grid = get_parent() diff --git a/buildings/building.gdshader b/buildings/building.gdshader index 81934b9..4176c28 100644 --- a/buildings/building.gdshader +++ b/buildings/building.gdshader @@ -28,6 +28,7 @@ void fragment() { float angle = atan(world_position.y, world_position.x); float sample_y = 1. - ((radius - ground_height) / cell_height - float( location.y)) / float(dimension.y); + sample_y = 1. - (1. - sample_y) * 0.97; float sample_x = mod(fract(angle / TAU + 1.) * float(num_cells) - float(location.x) + float(num_cells), float(num_cells)) / float(dimension.x); if(sample_y > 1. || sample_y < 0. || sample_x > 1. || sample_x < 0.) { diff --git a/buildings/building.tscn b/buildings/building.tscn index fad52e2..359abc8 100644 --- a/buildings/building.tscn +++ b/buildings/building.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=7 format=3 uid="uid://djawvtdwp423v"] +[gd_scene load_steps=8 format=3 uid="uid://djawvtdwp423v"] [ext_resource type="Script" uid="uid://b2ji03ekijjnn" path="res://buildings/building.gd" id="1_5j34s"] [ext_resource type="Shader" uid="uid://c7gb1nqwvkr37" path="res://buildings/building.gdshader" id="2_xx8ra"] -[ext_resource type="Texture2D" uid="uid://cy70quh6k3s1j" path="res://icon.svg" id="3_xr4t5"] +[ext_resource type="Texture2D" uid="uid://dfy0gccqgggp2" path="res://buildings/Building 2x1 fixed.png" id="3_xr4t5"] [ext_resource type="Script" uid="uid://dj7d4d2xs3nci" path="res://buildings/building_mesh.gd" id="4_xr4t5"] +[ext_resource type="Texture2D" uid="uid://3weywjfsapax" path="res://buildings/Building 2x1 downside.png" id="5_pfkkr"] [ext_resource type="PackedScene" uid="uid://dpv1w56yr1xue" path="res://traps/morning_star.tscn" id="5_xr4t5"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_pfkkr"] @@ -21,6 +22,13 @@ scale = Vector2(25, 25) texture = ExtResource("3_xr4t5") script = ExtResource("4_xr4t5") +[node name="Sprite2D2" type="Sprite2D" parent="."] +material = SubResource("ShaderMaterial_pfkkr") +scale = Vector2(25, 25) +texture = ExtResource("5_pfkkr") +script = ExtResource("4_xr4t5") +grid_offset = Vector2i(0, -1) + [node name="EnemyList" type="Node2D" parent="."] [node name="MorningStar" parent="EnemyList" instance=ExtResource("5_xr4t5")] diff --git a/buildings/building_mesh.gd b/buildings/building_mesh.gd index f7ddabf..9ba85bf 100644 --- a/buildings/building_mesh.gd +++ b/buildings/building_mesh.gd @@ -1,6 +1,8 @@ extends Sprite2D +@export var grid_offset : Vector2i = Vector2i.ZERO + func _ready() -> void: - var location = Vector2i(get_parent().location) + var location = Vector2i(get_parent().location) + grid_offset var dimension = Vector2i(get_parent().dimension) self_modulate = 2 * Color8(location.x, location.y, dimension.x, dimension.y) diff --git a/buildings/haunted_house.tscn b/buildings/haunted_house.tscn index c6d7e00..0e0aa2f 100644 --- a/buildings/haunted_house.tscn +++ b/buildings/haunted_house.tscn @@ -2,7 +2,7 @@ [ext_resource type="Script" uid="uid://b2ji03ekijjnn" path="res://buildings/building.gd" id="1_q3nfb"] [ext_resource type="Shader" uid="uid://c7gb1nqwvkr37" path="res://buildings/building.gdshader" id="2_uv7v8"] -[ext_resource type="Texture2D" uid="uid://cy70quh6k3s1j" path="res://icon.svg" id="3_e6j05"] +[ext_resource type="Texture2D" uid="uid://djir4ehm8kif" path="res://buildings/Building 1x2 fixed.png" id="3_uv7v8"] [ext_resource type="Script" uid="uid://dj7d4d2xs3nci" path="res://buildings/building_mesh.gd" id="4_bl5jt"] [ext_resource type="PackedScene" uid="uid://chu67ci7sl488" path="res://enemies/ghost.tscn" id="5_23fi7"] @@ -21,10 +21,10 @@ dimension = Vector2i(1, 2) self_modulate = Color(0.176471, 0, 0.00392157, 0.00392157) material = SubResource("ShaderMaterial_qnfc1") scale = Vector2(25, 25) -texture = ExtResource("3_e6j05") +texture = ExtResource("3_uv7v8") script = ExtResource("4_bl5jt") [node name="EnemyList" type="Node2D" parent="."] [node name="Ghost" parent="EnemyList" instance=ExtResource("5_23fi7")] -position = Vector2(115, -74.99999) +position = Vector2(115, -75) diff --git a/main.tscn b/main.tscn index 1a14173..b4d9fc4 100644 --- a/main.tscn +++ b/main.tscn @@ -1,10 +1,11 @@ -[gd_scene load_steps=8 format=3 uid="uid://cxo6bq26huau7"] +[gd_scene load_steps=9 format=3 uid="uid://cxo6bq26huau7"] [ext_resource type="PackedScene" uid="uid://cmaovvr15b3qk" path="res://player/player.tscn" id="2_1bvp3"] [ext_resource type="Script" uid="uid://vgxh2xdevat7" path="res://world/earth.gd" id="2_lquwl"] [ext_resource type="PackedScene" uid="uid://chu67ci7sl488" path="res://enemies/ghost.tscn" id="3_h2yge"] [ext_resource type="PackedScene" uid="uid://jjoyj1ldafkf" path="res://world/earth.tscn" id="3_lquwl"] [ext_resource type="Script" uid="uid://colvx6wq0e8n7" path="res://world/building_generator.gd" id="4_1bvp3"] +[ext_resource type="PackedScene" uid="uid://4l3elvxpghw8" path="res://platform.tscn" id="4_5vw27"] [ext_resource type="PackedScene" uid="uid://cjsrtswk4vgf2" path="res://healthbar/healthbar.tscn" id="6_7mycd"] [ext_resource type="PackedScene" uid="uid://dpv1w56yr1xue" path="res://traps/morning_star.tscn" id="7_272bh"] @@ -17,6 +18,9 @@ script = ExtResource("2_lquwl") [node name="Ghost" parent="." instance=ExtResource("3_h2yge")] position = Vector2(0, -3200) +[node name="Platform" parent="." instance=ExtResource("4_5vw27")] +position = Vector2(934, -2965) + [node name="Player" parent="." instance=ExtResource("2_1bvp3")] unique_name_in_owner = true position = Vector2(500, -3100) @@ -43,6 +47,7 @@ offset_bottom = 128.0 position = Vector2(989, -2939) [node name="Debug_Camera" type="Camera2D" parent="."] +position = Vector2(0.999969, 0) scale = Vector2(41.02, 41.02) zoom = Vector2(0.12, 0.12) diff --git a/platform.tscn b/platform.tscn new file mode 100644 index 0000000..1bd872f --- /dev/null +++ b/platform.tscn @@ -0,0 +1,22 @@ +[gd_scene load_steps=4 format=3 uid="uid://4l3elvxpghw8"] + +[ext_resource type="Texture2D" uid="uid://cy70quh6k3s1j" path="res://icon.svg" id="1_s8bxr"] +[ext_resource type="PackedScene" uid="uid://chs0u61f45nau" path="res://utils/earth_aligner.tscn" id="2_c1gtx"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_ry5bi"] +size = Vector2(56, 6) + +[node name="Platform" type="StaticBody2D"] +scale = Vector2(3, 3) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource("RectangleShape2D_ry5bi") +one_way_collision = true +one_way_collision_margin = 2.0 + +[node name="Sprite2D" type="Sprite2D" parent="."] +position = Vector2(-0.5, -1.90735e-06) +scale = Vector2(0.429688, 0.046875) +texture = ExtResource("1_s8bxr") + +[node name="EarthAligner" parent="." instance=ExtResource("2_c1gtx")] diff --git a/player/player.tscn b/player/player.tscn index a046132..12a3644 100644 --- a/player/player.tscn +++ b/player/player.tscn @@ -41,6 +41,7 @@ animations = [{ [node name="Player" type="CharacterBody2D"] z_index = 10 collision_layer = 5 +safe_margin = 1.0 script = ExtResource("1_4flbx") [node name="CollisionShape2D" type="CollisionShape2D" parent="."] diff --git a/world/earth.tscn b/world/earth.tscn index d0fe45a..1814f18 100644 --- a/world/earth.tscn +++ b/world/earth.tscn @@ -21,10 +21,13 @@ radius = 3000.0 [node name="Grid" type="Node2D" parent="."] unique_name_in_owner = true +position = Vector2(1, 0) script = ExtResource("3_2bhor") ground_radius = 3000.0 cell_height = 300.0 num_collumns = 60 -debug = true packed_buildings = Array[PackedScene]([ExtResource("3_nihcy"), ExtResource("4_ml5no")]) metadata/_custom_type_script = "uid://m3vyyfk8gnma" + +[node name="Building" parent="Grid" instance=ExtResource("3_nihcy")] +location = Vector2i(45, 1)