commit 5c46c7e3a7a743971ea191c046076ca894b22845 Author: ObeseTermite Date: Sat Apr 26 13:36:09 2025 -0700 First 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/etc/Typodermic Desktop EULA 2023.pdf b/etc/Typodermic Desktop EULA 2023.pdf new file mode 100644 index 0000000..c5936fe Binary files /dev/null and b/etc/Typodermic Desktop EULA 2023.pdf differ diff --git a/etc/bulletinV1.ttf b/etc/bulletinV1.ttf new file mode 100644 index 0000000..6e2ff53 Binary files /dev/null and b/etc/bulletinV1.ttf differ diff --git a/etc/bulletinV1.ttf.import b/etc/bulletinV1.ttf.import new file mode 100644 index 0000000..91756de --- /dev/null +++ b/etc/bulletinV1.ttf.import @@ -0,0 +1,35 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://dxcsr8pfoj3c" +path="res://.godot/imported/bulletinV1.ttf-012ce5be515230bcc15efcf69b5d910d.fontdata" + +[deps] + +source_file="res://etc/bulletinV1.ttf" +dest_files=["res://.godot/imported/bulletinV1.ttf-012ce5be515230bcc15efcf69b5d910d.fontdata"] + +[params] + +Rendering=null +antialiasing=1 +generate_mipmaps=false +disable_embedded_bitmaps=true +multichannel_signed_distance_field=false +msdf_pixel_range=8 +msdf_size=48 +allow_system_fallback=true +force_autohinter=false +hinting=1 +subpixel_positioning=4 +keep_rounding_remainders=true +oversampling=0.0 +Fallbacks=null +fallbacks=[] +Compress=null +compress=true +preload=[] +language_support={} +script_support={} +opentype_features={} diff --git a/etc/joystix monospace.otf b/etc/joystix monospace.otf new file mode 100644 index 0000000..20a3100 Binary files /dev/null and b/etc/joystix monospace.otf differ diff --git a/etc/joystix monospace.otf.import b/etc/joystix monospace.otf.import new file mode 100644 index 0000000..bccff2b --- /dev/null +++ b/etc/joystix monospace.otf.import @@ -0,0 +1,35 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://bpyvehrtj64w4" +path="res://.godot/imported/joystix monospace.otf-b02854d0d16fd2029b5a8967d2302fca.fontdata" + +[deps] + +source_file="res://etc/joystix monospace.otf" +dest_files=["res://.godot/imported/joystix monospace.otf-b02854d0d16fd2029b5a8967d2302fca.fontdata"] + +[params] + +Rendering=null +antialiasing=1 +generate_mipmaps=false +disable_embedded_bitmaps=true +multichannel_signed_distance_field=false +msdf_pixel_range=8 +msdf_size=48 +allow_system_fallback=true +force_autohinter=false +hinting=1 +subpixel_positioning=4 +keep_rounding_remainders=true +oversampling=0.0 +Fallbacks=null +fallbacks=[] +Compress=null +compress=true +preload=[] +language_support={} +script_support={} +opentype_features={} diff --git a/etc/pixelated.ttf b/etc/pixelated.ttf new file mode 100644 index 0000000..29c265a Binary files /dev/null and b/etc/pixelated.ttf differ diff --git a/etc/pixelated.ttf.import b/etc/pixelated.ttf.import new file mode 100644 index 0000000..d3848f5 --- /dev/null +++ b/etc/pixelated.ttf.import @@ -0,0 +1,35 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://cukc34hue3c0h" +path="res://.godot/imported/pixelated.ttf-8108ecaf469dcb17762df1698b1a31d0.fontdata" + +[deps] + +source_file="res://etc/pixelated.ttf" +dest_files=["res://.godot/imported/pixelated.ttf-8108ecaf469dcb17762df1698b1a31d0.fontdata"] + +[params] + +Rendering=null +antialiasing=1 +generate_mipmaps=false +disable_embedded_bitmaps=true +multichannel_signed_distance_field=false +msdf_pixel_range=8 +msdf_size=48 +allow_system_fallback=true +force_autohinter=false +hinting=1 +subpixel_positioning=4 +keep_rounding_remainders=true +oversampling=0.0 +Fallbacks=null +fallbacks=[] +Compress=null +compress=true +preload=[] +language_support={} +script_support={} +opentype_features={} diff --git a/etc/slkscr.ttf b/etc/slkscr.ttf new file mode 100644 index 0000000..85a2037 Binary files /dev/null and b/etc/slkscr.ttf differ diff --git a/etc/slkscr.ttf.import b/etc/slkscr.ttf.import new file mode 100644 index 0000000..aaa4922 --- /dev/null +++ b/etc/slkscr.ttf.import @@ -0,0 +1,41 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://dj1hgg8vhug8j" +path="res://.godot/imported/slkscr.ttf-a34f04441fa3110ed0cb71386e727660.fontdata" + +[deps] + +source_file="res://etc/slkscr.ttf" +dest_files=["res://.godot/imported/slkscr.ttf-a34f04441fa3110ed0cb71386e727660.fontdata"] + +[params] + +Rendering=null +antialiasing=0 +generate_mipmaps=false +disable_embedded_bitmaps=true +multichannel_signed_distance_field=false +msdf_pixel_range=8 +msdf_size=48 +allow_system_fallback=true +force_autohinter=false +hinting=0 +subpixel_positioning=0 +keep_rounding_remainders=false +oversampling=0.0 +Fallbacks=null +fallbacks=[] +Compress=null +compress=true +preload=[{ +"chars": [], +"glyphs": [], +"name": "New Configuration", +"size": Vector2i(16, 0), +&"variation_embolden": 0.0 +}] +language_support={} +script_support={} +opentype_features={} diff --git a/etc/terminal-grotesque_open.otf b/etc/terminal-grotesque_open.otf new file mode 100644 index 0000000..41e3de6 Binary files /dev/null and b/etc/terminal-grotesque_open.otf differ diff --git a/etc/terminal-grotesque_open.otf.import b/etc/terminal-grotesque_open.otf.import new file mode 100644 index 0000000..12ae92a --- /dev/null +++ b/etc/terminal-grotesque_open.otf.import @@ -0,0 +1,35 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://bmnx5fijr0gl7" +path="res://.godot/imported/terminal-grotesque_open.otf-51b8af7114f8a494e7b060d9146a3267.fontdata" + +[deps] + +source_file="res://etc/terminal-grotesque_open.otf" +dest_files=["res://.godot/imported/terminal-grotesque_open.otf-51b8af7114f8a494e7b060d9146a3267.fontdata"] + +[params] + +Rendering=null +antialiasing=1 +generate_mipmaps=false +disable_embedded_bitmaps=true +multichannel_signed_distance_field=false +msdf_pixel_range=8 +msdf_size=48 +allow_system_fallback=true +force_autohinter=false +hinting=1 +subpixel_positioning=4 +keep_rounding_remainders=true +oversampling=0.0 +Fallbacks=null +fallbacks=[] +Compress=null +compress=true +preload=[] +language_support={} +script_support={} +opentype_features={} diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..9d8b7fa --- /dev/null +++ b/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icon.svg.import b/icon.svg.import new file mode 100644 index 0000000..8d8ee58 --- /dev/null +++ b/icon.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://0mxbnydfl7u3" +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..256d401 --- /dev/null +++ b/project.godot @@ -0,0 +1,56 @@ +; 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="Calculations" +run/main_scene="uid://dinanmpmnja1" +config/features=PackedStringArray("4.4", "GL Compatibility") +config/icon="res://icon.svg" + +[display] + +window/size/viewport_width=384 +window/size/viewport_height=256 +window/stretch/mode="viewport" + +[input] + +left={ +"deadzone": 0.2, +"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,"location":0,"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,"location":0,"echo":false,"script":null) +] +} +right={ +"deadzone": 0.2, +"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,"location":0,"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,"location":0,"echo":false,"script":null) +] +} +up={ +"deadzone": 0.2, +"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,"location":0,"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,"location":0,"echo":false,"script":null) +] +} +down={ +"deadzone": 0.2, +"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,"location":0,"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,"location":0,"echo":false,"script":null) +] +} + +[rendering] + +textures/canvas_textures/default_texture_filter=0 +renderer/rendering_method="gl_compatibility" +renderer/rendering_method.mobile="gl_compatibility" +environment/defaults/default_clear_color=Color(0.639216, 0.635294, 0.603922, 1) diff --git a/scenes/bullet/bullet.gd b/scenes/bullet/bullet.gd new file mode 100644 index 0000000..19ad82f --- /dev/null +++ b/scenes/bullet/bullet.gd @@ -0,0 +1,8 @@ +extends Node2D + +var speed = 100 +var base_speed = 10 +var direction = 0 + +func _physics_process(delta: float) -> void: + position += speed*delta*base_speed*direction diff --git a/scenes/bullet/bullet.gd.uid b/scenes/bullet/bullet.gd.uid new file mode 100644 index 0000000..592c359 --- /dev/null +++ b/scenes/bullet/bullet.gd.uid @@ -0,0 +1 @@ +uid://c6sk0p3b1ilbg diff --git a/scenes/bullet/bullet.tscn b/scenes/bullet/bullet.tscn new file mode 100644 index 0000000..635ff74 --- /dev/null +++ b/scenes/bullet/bullet.tscn @@ -0,0 +1,17 @@ +[gd_scene load_steps=3 format=3 uid="uid://dpdt7rbma7ugn"] + +[ext_resource type="Script" uid="uid://c6sk0p3b1ilbg" path="res://scenes/bullet/bullet.gd" id="1_7c8un"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_83itf"] +size = Vector2(1, 1) + +[node name="bullet" type="Area2D"] +script = ExtResource("1_7c8un") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2(0.5, 0.5) +shape = SubResource("RectangleShape2D_83itf") + +[node name="Polygon2D" type="Polygon2D" parent="."] +color = Color(0.772549, 0.411765, 0.505882, 1) +polygon = PackedVector2Array(1, 0, 0, 0, 0, 1, 1, 1) diff --git a/scenes/inventory/WindowPane.png b/scenes/inventory/WindowPane.png new file mode 100644 index 0000000..1c15394 Binary files /dev/null and b/scenes/inventory/WindowPane.png differ diff --git a/scenes/inventory/WindowPane.png.import b/scenes/inventory/WindowPane.png.import new file mode 100644 index 0000000..a6e7f9e --- /dev/null +++ b/scenes/inventory/WindowPane.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://wygld7k1t3ad" +path="res://.godot/imported/WindowPane.png-16caec9e087b4d5658a3cceb3821cd10.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://scenes/inventory/WindowPane.png" +dest_files=["res://.godot/imported/WindowPane.png-16caec9e087b4d5658a3cceb3821cd10.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/scenes/inventory/WindowPane.pxo b/scenes/inventory/WindowPane.pxo new file mode 100644 index 0000000..14bfad9 Binary files /dev/null and b/scenes/inventory/WindowPane.pxo differ diff --git a/scenes/inventory/bonus/bonus.gd b/scenes/inventory/bonus/bonus.gd new file mode 100644 index 0000000..bd76437 --- /dev/null +++ b/scenes/inventory/bonus/bonus.gd @@ -0,0 +1,15 @@ +extends Item + +class_name Bonus + +@export var _bonus : String = "mult" + +func _init(): + layer = 1 + +func set_value(new_value : String): + _bonus = new_value + +func calculate_bonus(total : int, value : int): + if _bonus == "mult": + return total*value diff --git a/scenes/inventory/bonus/bonus.gd.uid b/scenes/inventory/bonus/bonus.gd.uid new file mode 100644 index 0000000..4d9b20a --- /dev/null +++ b/scenes/inventory/bonus/bonus.gd.uid @@ -0,0 +1 @@ +uid://c0fihxu2e7fhi diff --git a/scenes/inventory/bonus/bonus.tscn b/scenes/inventory/bonus/bonus.tscn new file mode 100644 index 0000000..77bac5e --- /dev/null +++ b/scenes/inventory/bonus/bonus.tscn @@ -0,0 +1,12 @@ +[gd_scene load_steps=3 format=3 uid="uid://2o4sa1c2rd1a"] + +[ext_resource type="Script" uid="uid://c0fihxu2e7fhi" path="res://scenes/inventory/bonus/bonus.gd" id="1_ljvlk"] +[ext_resource type="Texture2D" uid="uid://en2he5ixrc8y" path="res://scenes/inventory/bonus/icons/mult.png" id="1_vlfj5"] + +[node name="Bonus" type="Node2D"] +script = ExtResource("1_ljvlk") + +[node name="Sprite2D" type="Sprite2D" parent="."] +z_index = -1 +position = Vector2(-0.5, 1.5) +texture = ExtResource("1_vlfj5") diff --git a/scenes/inventory/bonus/icons/mult.png b/scenes/inventory/bonus/icons/mult.png new file mode 100644 index 0000000..3a42e9a Binary files /dev/null and b/scenes/inventory/bonus/icons/mult.png differ diff --git a/scenes/inventory/bonus/icons/mult.png.import b/scenes/inventory/bonus/icons/mult.png.import new file mode 100644 index 0000000..ecce6d3 --- /dev/null +++ b/scenes/inventory/bonus/icons/mult.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://en2he5ixrc8y" +path="res://.godot/imported/mult.png-9193bf4c6e6fa797ae4ec496f528a243.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://scenes/inventory/bonus/icons/mult.png" +dest_files=["res://.godot/imported/mult.png-9193bf4c6e6fa797ae4ec496f528a243.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/scenes/inventory/bonus/icons/mult.pxo b/scenes/inventory/bonus/icons/mult.pxo new file mode 100644 index 0000000..2f91883 Binary files /dev/null and b/scenes/inventory/bonus/icons/mult.pxo differ diff --git a/scenes/inventory/inventory.gd b/scenes/inventory/inventory.gd new file mode 100644 index 0000000..a161840 --- /dev/null +++ b/scenes/inventory/inventory.gd @@ -0,0 +1,123 @@ +extends Control + +var items : Array[Array] + +@onready var positive_modifiers = [$Speed,$BulletSpeed,$Ammunition,$Damage] +@onready var negative_modifiers = [$IncomingDamage,$FiringDelay,$Size,$TaxRate] + +var item_offset : int = 26 + +@export var bonus_scene : PackedScene + +@export var item_scene : PackedScene +@export var items_start : Node2D + +@export var player : CharacterBody2D + +func _ready(): + items.append([]) + items.append([]) + for y in range(4): + items[0].append([]) + items[1].append([]) + for x in range(4): + + var new_item = item_scene.instantiate() + new_item.set_value(abs(y-x)+1) + new_item.position = items_start.position + Vector2(x*item_offset,y*item_offset) + new_item.last_position = Vector2i(x,y) + new_item.inventory = self + + items[0][y].append(new_item) + add_child(items[0][y][x]) + + if x == y: + var new_bonus = bonus_scene.instantiate() + new_bonus.position = items_start.position + Vector2(x*item_offset,y*item_offset) + new_bonus.last_position = Vector2i(x,y) + new_bonus.inventory = self + items[1][y].append(new_bonus) + add_child(items[1][y][x]) + else: + items[1][y].append(null) + + update_calculations() + +func update_calculations(): + for y in range(4): + var total = 0 + for x in range(4): + if items[0][y][x] != null and items[1][y][x] == null: + total += items[0][y][x]._value + if total == 0: + total = 1 + for x in range(4): + if items[1][y][x] != null: + total = items[1][y][x].calculate_bonus(total, items[0][y][x]._value) + match y: + 0: + player.speed = total + 1: + player.bullet_speed = total + 2: + player.ammunition = total + 3: + player.damage = total + positive_modifiers[y].text = '=' + str(total) + + for x in range(4): + var total = 0 + for y in range(4): + if items[0][y][x] != null and items[1][y][x] == null: + total += items[0][y][x]._value + if total == 0: + total = 1 + for y in range(4): + if items[1][y][x] != null: + total = items[1][y][x].calculate_bonus(total, items[0][y][x]._value) + match x: + 0: + player.incoming_damage = total + 1: + player.bullet_delay = total + 2: + player.size = total + 3: + player.tax = total + negative_modifiers[x].text = '=' + str(total) + +func inventory_to_global_coords(position : Vector2i) -> Vector2: + return items_start.global_position + Vector2(position.x*item_offset,position.y*item_offset) + +func global_to_inventory_coords(position : Vector2): + position -= (items_start.global_position-Vector2(item_offset/2,item_offset/2)) + position = Vector2i(position) + + + if position.x < 0 or position.y < 0: + return null + + position /= item_offset + + position = Vector2i(position) + + if position.x >= 4 or position.y >= 4: + return null + + return position + + +func _process(delta: float) -> void: + pass + +func _input(event): + if event is InputEventMouseButton: + var layer = 0 + if (event.button_index == MOUSE_BUTTON_LEFT or event.button_index == MOUSE_BUTTON_RIGHT) and event.pressed: + if(event.button_index == MOUSE_BUTTON_RIGHT): + layer = 1 + var inventory_position = global_to_inventory_coords(event.position) + if inventory_position != null and items[layer][inventory_position.y][inventory_position.x] != null: + items[layer][inventory_position.y][inventory_position.x].dragging = true + items[layer][inventory_position.y][inventory_position.x].last_position = Vector2i(inventory_position.x,inventory_position.y) + items[layer][inventory_position.y][inventory_position.x] = null diff --git a/scenes/inventory/inventory.gd.uid b/scenes/inventory/inventory.gd.uid new file mode 100644 index 0000000..39fe973 --- /dev/null +++ b/scenes/inventory/inventory.gd.uid @@ -0,0 +1 @@ +uid://466pugqribug diff --git a/scenes/inventory/inventory.tscn b/scenes/inventory/inventory.tscn new file mode 100644 index 0000000..69dbce6 --- /dev/null +++ b/scenes/inventory/inventory.tscn @@ -0,0 +1,124 @@ +[gd_scene load_steps=9 format=3 uid="uid://o6e5ybx262ig"] + +[ext_resource type="Script" uid="uid://466pugqribug" path="res://scenes/inventory/inventory.gd" id="1_el5y6"] +[ext_resource type="PackedScene" uid="uid://csdmile32lfyy" path="res://scenes/inventory/number/number.tscn" id="2_4axmw"] +[ext_resource type="Texture2D" uid="uid://wygld7k1t3ad" path="res://scenes/inventory/WindowPane.png" id="4_bxceu"] +[ext_resource type="FontFile" uid="uid://cukc34hue3c0h" path="res://etc/pixelated.ttf" id="4_tvok8"] +[ext_resource type="PackedScene" uid="uid://2o4sa1c2rd1a" path="res://scenes/inventory/bonus/bonus.tscn" id="5_bxceu"] + +[sub_resource type="LabelSettings" id="LabelSettings_bxceu"] +font = ExtResource("4_tvok8") +font_size = 8 +font_color = Color(0.772549, 0.411765, 0.505882, 1) + +[sub_resource type="LabelSettings" id="LabelSettings_kl7fi"] +font = ExtResource("4_tvok8") +font_size = 8 +font_color = Color(0.156863, 0.137255, 0.156863, 1) + +[sub_resource type="LabelSettings" id="LabelSettings_v8e04"] +font = ExtResource("4_tvok8") +font_size = 8 +font_color = Color(0.329412, 0.360784, 0.494118, 1) + +[node name="Inventory" type="Control" node_paths=PackedStringArray("items_start")] +layout_mode = 3 +anchors_preset = 6 +anchor_left = 1.0 +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 +grow_horizontal = 0 +grow_vertical = 2 +script = ExtResource("1_el5y6") +bonus_scene = ExtResource("5_bxceu") +item_scene = ExtResource("2_4axmw") +items_start = NodePath("InventoryStart") + +[node name="WindowPane" type="Sprite2D" parent="."] +z_index = -2 +texture_repeat = 3 +position = Vector2(-64, 0) +texture = ExtResource("4_bxceu") +region_rect = Rect2(0, 0, 134, 256) + +[node name="InventoryStart" type="Marker2D" parent="."] +position = Vector2(-110, -111) + +[node name="Speed" type="Label" parent="."] +layout_mode = 0 +offset_left = -20.0 +offset_top = -122.0 +offset_bottom = -99.0 +text = "=10" +label_settings = SubResource("LabelSettings_bxceu") + +[node name="RemainingAmmunition" type="Label" parent="."] +layout_mode = 0 +offset_left = -105.0 +offset_top = 26.0 +offset_right = -85.0 +offset_bottom = 49.0 +text = "- 100" +label_settings = SubResource("LabelSettings_kl7fi") + +[node name="BulletSpeed" type="Label" parent="."] +layout_mode = 0 +offset_left = -20.0 +offset_top = -96.0 +offset_right = -8.0 +offset_bottom = -87.0 +text = "=10" +label_settings = SubResource("LabelSettings_bxceu") + +[node name="Ammunition" type="Label" parent="."] +layout_mode = 0 +offset_left = -20.0 +offset_top = -70.0 +offset_bottom = -47.0 +text = "=10" +label_settings = SubResource("LabelSettings_bxceu") + +[node name="Damage" type="Label" parent="."] +layout_mode = 0 +offset_left = -20.0 +offset_top = -44.0 +offset_bottom = -21.0 +text = "=10" +label_settings = SubResource("LabelSettings_bxceu") + +[node name="Size" type="Label" parent="."] +offset_left = -71.0 +offset_top = -17.0 +offset_right = -46.0 +offset_bottom = 6.0 +text = "=10" +label_settings = SubResource("LabelSettings_v8e04") +horizontal_alignment = 1 + +[node name="TaxRate" type="Label" parent="."] +offset_left = -46.0 +offset_top = -17.0 +offset_right = -21.0 +offset_bottom = 6.0 +text = "=10" +label_settings = SubResource("LabelSettings_v8e04") +horizontal_alignment = 1 + +[node name="FiringDelay" type="Label" parent="."] +offset_left = -98.0 +offset_top = -17.0 +offset_right = -73.0 +offset_bottom = 6.0 +text = "=10" +label_settings = SubResource("LabelSettings_v8e04") +horizontal_alignment = 1 + +[node name="IncomingDamage" type="Label" parent="."] +offset_left = -124.0 +offset_top = -17.0 +offset_right = -99.0 +offset_bottom = 6.0 +text = "=10" +label_settings = SubResource("LabelSettings_v8e04") +horizontal_alignment = 1 diff --git a/scenes/inventory/item.gd b/scenes/inventory/item.gd new file mode 100644 index 0000000..47fd7d0 --- /dev/null +++ b/scenes/inventory/item.gd @@ -0,0 +1,35 @@ +extends Node2D + +class_name Item + +var inventory : Control + +var dragging = false + +var last_position = null + +var layer = 0 + +func _process(delta): + if not dragging: return + global_position = get_global_mouse_position() + +func _input(event): + if event is InputEventMouseButton: + if ((event.button_index == MOUSE_BUTTON_LEFT and layer == 0) or (event.button_index == MOUSE_BUTTON_RIGHT and layer == 1)) and not event.pressed : + dragging = false + var inventory_position = inventory.global_to_inventory_coords(global_position) + if inventory_position != null and last_position != Vector2i(inventory_position): + var temp = inventory.items[layer][inventory_position.y][inventory_position.x] + inventory.items[layer][inventory_position.y][inventory_position.x] = self + inventory.items[layer][last_position.y][last_position.x] = temp + global_position = inventory.inventory_to_global_coords(Vector2i(inventory_position.x,inventory_position.y)) + if last_position != null: + if temp != null: + inventory.items[layer][last_position.y][last_position.x].global_position = inventory.inventory_to_global_coords(Vector2i(last_position.x,last_position.y)) + inventory.items[layer][last_position.y][last_position.x].last_position = Vector2i(last_position.x,last_position.y) + last_position = Vector2i(inventory_position.x,inventory_position.y) + elif last_position != null and inventory.items[layer][last_position.y][last_position.x] == null: + inventory.items[layer][last_position.y][last_position.x] = self + global_position = inventory.inventory_to_global_coords(Vector2i(last_position.x,last_position.y)) + inventory.call_deferred("update_calculations") diff --git a/scenes/inventory/item.gd.uid b/scenes/inventory/item.gd.uid new file mode 100644 index 0000000..5a3e7cd --- /dev/null +++ b/scenes/inventory/item.gd.uid @@ -0,0 +1 @@ +uid://muf4bbw3c4na diff --git a/scenes/inventory/number/number.gd b/scenes/inventory/number/number.gd new file mode 100644 index 0000000..cf8552f --- /dev/null +++ b/scenes/inventory/number/number.gd @@ -0,0 +1,9 @@ +extends Item + +class_name Number +@export var label : Label +@export var _value : int = 1 + +func set_value(new_value : int): + _value = new_value + label.text = str(_value) diff --git a/scenes/inventory/number/number.gd.uid b/scenes/inventory/number/number.gd.uid new file mode 100644 index 0000000..2b2d8fa --- /dev/null +++ b/scenes/inventory/number/number.gd.uid @@ -0,0 +1 @@ +uid://doutbj4troo25 diff --git a/scenes/inventory/number/number.tscn b/scenes/inventory/number/number.tscn new file mode 100644 index 0000000..5894a4c --- /dev/null +++ b/scenes/inventory/number/number.tscn @@ -0,0 +1,30 @@ +[gd_scene load_steps=4 format=3 uid="uid://csdmile32lfyy"] + +[ext_resource type="Script" uid="uid://doutbj4troo25" path="res://scenes/inventory/number/number.gd" id="1_jg50s"] +[ext_resource type="FontFile" uid="uid://dxcsr8pfoj3c" path="res://etc/bulletinV1.ttf" id="1_wvpe8"] + +[sub_resource type="LabelSettings" id="LabelSettings_jg50s"] +font = ExtResource("1_wvpe8") +font_size = 19 +font_color = Color(0.156863, 0.137255, 0.156863, 1) + +[node name="Item" type="Node2D" node_paths=PackedStringArray("label")] +script = ExtResource("1_jg50s") +label = NodePath("Label") + +[node name="Label" type="Label" parent="."] +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -20.0 +offset_top = -13.0 +offset_right = 20.0 +offset_bottom = 13.0 +grow_horizontal = 2 +grow_vertical = 2 +text = "1" +label_settings = SubResource("LabelSettings_jg50s") +horizontal_alignment = 1 +vertical_alignment = 1 diff --git a/scenes/player/player.gd b/scenes/player/player.gd new file mode 100644 index 0000000..80715b5 --- /dev/null +++ b/scenes/player/player.gd @@ -0,0 +1,60 @@ +extends CharacterBody2D + +var base_speed = 100 + +var speed +var bullet_speed +var ammunition +var damage + +var incoming_damage +var bullet_delay +var size = 100 +var tax + +var remaining_bullets = 100 + +var bullet_timer = 0 + +@onready var sprite = $CollisionShape2D/Sprite2D +@onready var collision = $CollisionShape2D + +@export var inventory : Control + +@export var bullet_scene : PackedScene + +func _physics_process(delta): + bullet_timer -= delta + velocity = Vector2(0,0) + if Input.is_action_pressed("left"): + velocity.x += -1 + if Input.is_action_pressed("right"): + velocity.x += 1 + if Input.is_action_pressed("up"): + velocity.y += -1 + if Input.is_action_pressed("down"): + velocity.y += 1 + + if Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT): + spawn_bullet() + + velocity = velocity.normalized() * speed*base_speed*delta + + move_and_slide() + sprite.global_position = Vector2i(global_position) + + collision.scale = Vector2(0.3,0.3)*(pow(size,0.2)) + +func reload(): + pass + +func spawn_bullet(): + if bullet_timer > 0: return + var new_bullet = bullet_scene.instantiate() + new_bullet.direction = global_position.direction_to(get_global_mouse_position()) + new_bullet.position = position + new_bullet.speed = sqrt(bullet_speed) + + get_tree().root.add_child(new_bullet) + + bullet_timer = 0.1*pow(bullet_delay,0.4) diff --git a/scenes/player/player.gd.uid b/scenes/player/player.gd.uid new file mode 100644 index 0000000..5285b3e --- /dev/null +++ b/scenes/player/player.gd.uid @@ -0,0 +1 @@ +uid://cgfntug3512wn diff --git a/scenes/player/player.png b/scenes/player/player.png new file mode 100644 index 0000000..f27133d Binary files /dev/null and b/scenes/player/player.png differ diff --git a/scenes/player/player.png.import b/scenes/player/player.png.import new file mode 100644 index 0000000..7354efb --- /dev/null +++ b/scenes/player/player.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bhjcs3u6blng7" +path="res://.godot/imported/player.png-d340f81abf0a3162ec6e69b8e169a012.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://scenes/player/player.png" +dest_files=["res://.godot/imported/player.png-d340f81abf0a3162ec6e69b8e169a012.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/scenes/player/player.tscn b/scenes/player/player.tscn new file mode 100644 index 0000000..5ba5753 --- /dev/null +++ b/scenes/player/player.tscn @@ -0,0 +1,20 @@ +[gd_scene load_steps=5 format=3 uid="uid://citwevx7xvypn"] + +[ext_resource type="Texture2D" uid="uid://bhjcs3u6blng7" path="res://scenes/player/player.png" id="1_8afob"] +[ext_resource type="Script" uid="uid://cgfntug3512wn" path="res://scenes/player/player.gd" id="1_dovo2"] +[ext_resource type="PackedScene" uid="uid://dpdt7rbma7ugn" path="res://scenes/bullet/bullet.tscn" id="2_gmlin"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_dovo2"] +radius = 13.0 + +[node name="Player" type="CharacterBody2D"] +motion_mode = 1 +script = ExtResource("1_dovo2") +bullet_scene = ExtResource("2_gmlin") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +scale = Vector2(0.3, 0.3) +shape = SubResource("CircleShape2D_dovo2") + +[node name="Sprite2D" type="Sprite2D" parent="CollisionShape2D"] +texture = ExtResource("1_8afob") diff --git a/scenes/world/world.tscn b/scenes/world/world.tscn new file mode 100644 index 0000000..d987f67 --- /dev/null +++ b/scenes/world/world.tscn @@ -0,0 +1,15 @@ +[gd_scene load_steps=3 format=3 uid="uid://dinanmpmnja1"] + +[ext_resource type="PackedScene" uid="uid://o6e5ybx262ig" path="res://scenes/inventory/inventory.tscn" id="1_dphjl"] +[ext_resource type="PackedScene" uid="uid://citwevx7xvypn" path="res://scenes/player/player.tscn" id="2_sl2e5"] + +[node name="World" type="Node2D"] + +[node name="UI" type="CanvasLayer" parent="."] + +[node name="Inventory" parent="UI" node_paths=PackedStringArray("player") instance=ExtResource("1_dphjl")] +player = NodePath("../../Player") + +[node name="Player" parent="." node_paths=PackedStringArray("inventory") instance=ExtResource("2_sl2e5")] +position = Vector2(131, 131) +inventory = NodePath("../UI/Inventory")