From 70dd5fe5dc63d8d106c04450c3b2fb8f1154ff8b Mon Sep 17 00:00:00 2001 From: ObeseTermite Date: Sun, 27 Apr 2025 23:40:30 -0700 Subject: [PATCH] added a bunch of shit, game works, but barely, i think im done --- etc/bulletinV1.ttf.import | 15 +- etc/joystix monospace.otf.import | 15 +- etc/pixelated.ttf.import | 15 +- globals.gd | 7 + globals.gd.uid | 1 + project.godot | 14 +- scenes/bullet/bullet.gd | 12 +- scenes/enemies/enemy.gd | 41 ++++- scenes/enemies/grunt/attack.gd | 14 ++ scenes/enemies/grunt/attack.gd.uid | 1 + scenes/enemies/grunt/grunt.png | Bin 341 -> 244 bytes scenes/enemies/grunt/grunt.tscn | 43 +++++- scenes/enemies/shooter/gun.gd | 20 +++ scenes/enemies/shooter/gun.gd.uid | 1 + scenes/enemies/shooter/shooter.png | Bin 0 -> 244 bytes scenes/enemies/shooter/shooter.png.import | 34 ++++ scenes/enemies/shooter/shooter.tscn | 72 +++++++++ scenes/game_over.gd | 9 ++ scenes/game_over.gd.uid | 1 + scenes/game_over.tscn | 85 ++++++++++ scenes/inventory/inventory.gd | 18 ++- scenes/inventory/inventory.tscn | 132 +++++++++++++++- scenes/inventory/lock.png | Bin 0 -> 192 bytes scenes/inventory/lock.png.import | 34 ++++ scenes/inventory/tooltip/tooltip.gd | 32 ++++ scenes/inventory/tooltip/tooltip.gd.uid | 1 + scenes/inventory/tooltip/tooltip.tscn | 48 ++++++ scenes/inventory/tutorial_text.gd | 63 ++++++++ scenes/inventory/tutorial_text.gd.uid | 1 + scenes/inventory/upgrades/upgrade.tscn | 37 +++++ scenes/inventory/upgrades/upgrades.png | Bin 0 -> 178 bytes scenes/inventory/upgrades/upgrades.png.import | 34 ++++ scenes/inventory/upgrades/upgrades.pxo | Bin 0 -> 816 bytes scenes/player/player.gd | 20 ++- scenes/player/player.tscn | 4 +- scenes/world/blocked.png | Bin 0 -> 180 bytes scenes/world/blocked.png.import | 34 ++++ scenes/world/level.gd | 146 ++++++++++++++++++ scenes/world/level.gd.uid | 1 + scenes/world/shop.gd | 38 +++++ scenes/world/shop.gd.uid | 1 + scenes/world/shop.tscn | 21 +++ scenes/world/spawner.gd | 37 +++++ scenes/world/spawner.gd.uid | 1 + scenes/world/tilemap/tile_map.tres | 119 ++++++++++++++ scenes/world/tilemap/tilemap.png | Bin 0 -> 474 bytes scenes/world/tilemap/tilemap.png.import | 34 ++++ scenes/world/tilemap/tilemap.pxo | Bin 0 -> 1390 bytes scenes/world/tilemap/tilemapcornerless.pxo | Bin 0 -> 1067 bytes scenes/world/world.tscn | 145 +++++++++++++++-- upgrade.gd | 57 +++++++ upgrade.gd.uid | 1 + 52 files changed, 1408 insertions(+), 51 deletions(-) create mode 100644 globals.gd create mode 100644 globals.gd.uid create mode 100644 scenes/enemies/grunt/attack.gd create mode 100644 scenes/enemies/grunt/attack.gd.uid create mode 100644 scenes/enemies/shooter/gun.gd create mode 100644 scenes/enemies/shooter/gun.gd.uid create mode 100644 scenes/enemies/shooter/shooter.png create mode 100644 scenes/enemies/shooter/shooter.png.import create mode 100644 scenes/enemies/shooter/shooter.tscn create mode 100644 scenes/game_over.gd create mode 100644 scenes/game_over.gd.uid create mode 100644 scenes/game_over.tscn create mode 100644 scenes/inventory/lock.png create mode 100644 scenes/inventory/lock.png.import create mode 100644 scenes/inventory/tooltip/tooltip.gd create mode 100644 scenes/inventory/tooltip/tooltip.gd.uid create mode 100644 scenes/inventory/tooltip/tooltip.tscn create mode 100644 scenes/inventory/tutorial_text.gd create mode 100644 scenes/inventory/tutorial_text.gd.uid create mode 100644 scenes/inventory/upgrades/upgrade.tscn create mode 100644 scenes/inventory/upgrades/upgrades.png create mode 100644 scenes/inventory/upgrades/upgrades.png.import create mode 100644 scenes/inventory/upgrades/upgrades.pxo create mode 100644 scenes/world/blocked.png create mode 100644 scenes/world/blocked.png.import create mode 100644 scenes/world/level.gd create mode 100644 scenes/world/level.gd.uid create mode 100644 scenes/world/shop.gd create mode 100644 scenes/world/shop.gd.uid create mode 100644 scenes/world/shop.tscn create mode 100644 scenes/world/spawner.gd create mode 100644 scenes/world/spawner.gd.uid create mode 100644 scenes/world/tilemap/tile_map.tres create mode 100644 scenes/world/tilemap/tilemap.png create mode 100644 scenes/world/tilemap/tilemap.png.import create mode 100644 scenes/world/tilemap/tilemap.pxo create mode 100644 scenes/world/tilemap/tilemapcornerless.pxo create mode 100644 upgrade.gd create mode 100644 upgrade.gd.uid diff --git a/etc/bulletinV1.ttf.import b/etc/bulletinV1.ttf.import index 91756de..33f33d7 100644 --- a/etc/bulletinV1.ttf.import +++ b/etc/bulletinV1.ttf.import @@ -13,7 +13,7 @@ dest_files=["res://.godot/imported/bulletinV1.ttf-012ce5be515230bcc15efcf69b5d91 [params] Rendering=null -antialiasing=1 +antialiasing=0 generate_mipmaps=false disable_embedded_bitmaps=true multichannel_signed_distance_field=false @@ -21,15 +21,20 @@ msdf_pixel_range=8 msdf_size=48 allow_system_fallback=true force_autohinter=false -hinting=1 -subpixel_positioning=4 -keep_rounding_remainders=true +hinting=0 +subpixel_positioning=0 +keep_rounding_remainders=false oversampling=0.0 Fallbacks=null fallbacks=[] Compress=null compress=true -preload=[] +preload=[{ +"chars": [], +"glyphs": [], +"name": "New Configuration", +"size": Vector2i(16, 0) +}] language_support={} script_support={} opentype_features={} diff --git a/etc/joystix monospace.otf.import b/etc/joystix monospace.otf.import index bccff2b..b20c373 100644 --- a/etc/joystix monospace.otf.import +++ b/etc/joystix monospace.otf.import @@ -13,7 +13,7 @@ dest_files=["res://.godot/imported/joystix monospace.otf-b02854d0d16fd2029b5a896 [params] Rendering=null -antialiasing=1 +antialiasing=0 generate_mipmaps=false disable_embedded_bitmaps=true multichannel_signed_distance_field=false @@ -21,15 +21,20 @@ msdf_pixel_range=8 msdf_size=48 allow_system_fallback=true force_autohinter=false -hinting=1 -subpixel_positioning=4 -keep_rounding_remainders=true +hinting=0 +subpixel_positioning=0 +keep_rounding_remainders=false oversampling=0.0 Fallbacks=null fallbacks=[] Compress=null compress=true -preload=[] +preload=[{ +"chars": [], +"glyphs": [], +"name": "New Configuration", +"size": Vector2i(16, 0) +}] language_support={} script_support={} opentype_features={} diff --git a/etc/pixelated.ttf.import b/etc/pixelated.ttf.import index d3848f5..b071946 100644 --- a/etc/pixelated.ttf.import +++ b/etc/pixelated.ttf.import @@ -13,7 +13,7 @@ dest_files=["res://.godot/imported/pixelated.ttf-8108ecaf469dcb17762df1698b1a31d [params] Rendering=null -antialiasing=1 +antialiasing=0 generate_mipmaps=false disable_embedded_bitmaps=true multichannel_signed_distance_field=false @@ -21,15 +21,20 @@ msdf_pixel_range=8 msdf_size=48 allow_system_fallback=true force_autohinter=false -hinting=1 -subpixel_positioning=4 -keep_rounding_remainders=true +hinting=0 +subpixel_positioning=0 +keep_rounding_remainders=false oversampling=0.0 Fallbacks=null fallbacks=[] Compress=null compress=true -preload=[] +preload=[{ +"chars": [], +"glyphs": [], +"name": "New Configuration", +"size": Vector2i(16, 0) +}] language_support={} script_support={} opentype_features={} diff --git a/globals.gd b/globals.gd new file mode 100644 index 0000000..ffe0a7e --- /dev/null +++ b/globals.gd @@ -0,0 +1,7 @@ +extends Node + +enum Direction {UP,RIGHT,DOWN,LEFT} + +var mouse_dragging = false + +var score = 0 diff --git a/globals.gd.uid b/globals.gd.uid new file mode 100644 index 0000000..3738a23 --- /dev/null +++ b/globals.gd.uid @@ -0,0 +1 @@ +uid://wv6h57d03ecn diff --git a/project.godot b/project.godot index a4164ea..0f16e84 100644 --- a/project.godot +++ b/project.godot @@ -15,6 +15,10 @@ run/main_scene="uid://dinanmpmnja1" config/features=PackedStringArray("4.4", "GL Compatibility") config/icon="res://icon.svg" +[autoload] + +Globals="*res://globals.gd" + [display] window/size/viewport_width=384 @@ -24,6 +28,10 @@ window/stretch/mode="viewport" [global_group] damageable="" +terrain="" +player="" +enemy="" +upgrades="" [input] @@ -51,10 +59,14 @@ down={ , 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) ] } +reload={ +"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":82,"key_label":0,"unicode":114,"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 index 75592f0..3c4cc2d 100644 --- a/scenes/bullet/bullet.gd +++ b/scenes/bullet/bullet.gd @@ -9,6 +9,10 @@ var hostile = false @onready var polygon = $Polygon2D +func _ready() -> void: + if hostile: + polygon.color = Color(0.772,0.412,0.506,1) + func _physics_process(delta: float) -> void: position += speed*delta*base_speed*direction @@ -17,7 +21,13 @@ func _physics_process(delta: float) -> void: func _on_body_entered(body: Node2D) -> void: - if body.is_in_group("damageable"): + if body.is_in_group("player") and hostile: + body.health -= damage + body.inventory.update_stats() + queue_free() + elif body.is_in_group("enemy") and not hostile: damage = body.damage(damage) if damage <= 0: queue_free() + elif body.is_in_group("terrain"): + queue_free() diff --git a/scenes/enemies/enemy.gd b/scenes/enemies/enemy.gd index 64a249d..26d8c07 100644 --- a/scenes/enemies/enemy.gd +++ b/scenes/enemies/enemy.gd @@ -1,28 +1,53 @@ -extends Node2D +extends CharacterBody2D -var speed = 10 +class_name Enemy -var health = 30 -var total_health = 30 +@export var speed = 1000 -var dead = false +@export var value = 10 + +var health = 0 +@export var total_health := 30 + + + +@export var difficulty := 1 @export var player : CharacterBody2D @onready var navigation : NavigationAgent2D = $NavigationAgent2D @onready var health_bar : ProgressBar = $HealthBar +@onready var particles : CPUParticles2D = $CPUParticles2D + +func _init(): + health = total_health + func _physics_process(delta: float) -> void: + health_bar.value = (float(health)/total_health)*100 navigation.target_position = player.position - position = position.move_toward(navigation.get_next_path_position(), delta*speed) - if dead: + if not navigation.is_navigation_finished(): + navigation.velocity = ((navigation.get_next_path_position()-position).normalized()*speed*delta) + else: + navigation.velocity = Vector2(0,0) + + if health <= 0: + player.score += difficulty + player.money += int(value*100*(float(1)/(player.tax+100))) + player.inventory.update_stats() queue_free() + move_and_slide() func damage(damage : int): + particles.emitting = true health -= damage if health <= 0: - dead = true return -health return 0 + + +func _on_navigation_agent_2d_velocity_computed(safe_velocity: Vector2) -> void: + velocity = safe_velocity + diff --git a/scenes/enemies/grunt/attack.gd b/scenes/enemies/grunt/attack.gd new file mode 100644 index 0000000..f100846 --- /dev/null +++ b/scenes/enemies/grunt/attack.gd @@ -0,0 +1,14 @@ +extends Area2D + +@export var attack_cooldown : float = 1 +var attack_timer = 0 + + +func _process(delta): + attack_timer -= delta + var bodies = get_overlapping_bodies() + for body in bodies: + if body is Player and attack_timer < 0: + attack_timer = attack_cooldown + get_parent().damage(body.incoming_damage) + body.inflict_damage() diff --git a/scenes/enemies/grunt/attack.gd.uid b/scenes/enemies/grunt/attack.gd.uid new file mode 100644 index 0000000..55607a9 --- /dev/null +++ b/scenes/enemies/grunt/attack.gd.uid @@ -0,0 +1 @@ +uid://bdfcm448qt5uh diff --git a/scenes/enemies/grunt/grunt.png b/scenes/enemies/grunt/grunt.png index a88f2ab29061f07f74e6ae73889ee379ce2a63f5..6f410280d7017da1811c2e6dbee04547c3f6d738 100644 GIT binary patch delta 204 zcmV;-05kv90`vipFn<89NklRgt3L zPi&BQMXmxV@m=h5VxXbn299Ytk7+s6w void: + attack_timer -= delta + target_position = carrier.player.global_position-global_position + if not is_colliding() and attack_timer < 0: + var new_bullet = bullet_scene.instantiate() + new_bullet.hostile = true + new_bullet.direction = global_position.direction_to(carrier.player.global_position) + new_bullet.global_position = global_position + new_bullet.damage = carrier.player.incoming_damage + new_bullet.speed = 5 + get_tree().root.add_child(new_bullet) + attack_timer = attack_cooldown + diff --git a/scenes/enemies/shooter/gun.gd.uid b/scenes/enemies/shooter/gun.gd.uid new file mode 100644 index 0000000..0e9a3d9 --- /dev/null +++ b/scenes/enemies/shooter/gun.gd.uid @@ -0,0 +1 @@ +uid://cwasbbull03i8 diff --git a/scenes/enemies/shooter/shooter.png b/scenes/enemies/shooter/shooter.png new file mode 100644 index 0000000000000000000000000000000000000000..014a4cdc61b283a838b0eba16c9e157df358f531 GIT binary patch literal 244 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%Cx&(BWL^R}>pWc?Ln2z= zPCdxmpuppLaYv^(pUwd#o|j5`4;s5SzgWq+viDDzkbZ3^J7?znty2VKju-MAF^&7O zC3{-LWHZA}>*tB~Sw~M=9`j)DVHS(UDhq-<4|+VfVIJ6Zt$M$6DC4{a_2uOzJEI!B zm&C|T%~&cB!t`f#b<<(i01u{2mmhng*my57cbjP_mhNdiFFK(wnd65^Nbe(aK|Za7 rtV3}HXJZrEv void: + get_tree().change_scene_to_file(go_to_scene) diff --git a/scenes/game_over.gd.uid b/scenes/game_over.gd.uid new file mode 100644 index 0000000..ef02fe2 --- /dev/null +++ b/scenes/game_over.gd.uid @@ -0,0 +1 @@ +uid://ctox3n7f4j8wu diff --git a/scenes/game_over.tscn b/scenes/game_over.tscn new file mode 100644 index 0000000..6f62575 --- /dev/null +++ b/scenes/game_over.tscn @@ -0,0 +1,85 @@ +[gd_scene load_steps=10 format=4 uid="uid://kx6lu3rdhsjv"] + +[ext_resource type="Script" uid="uid://ctox3n7f4j8wu" path="res://scenes/game_over.gd" id="1_racf3"] +[ext_resource type="TileSet" uid="uid://bawet85hqjpku" path="res://scenes/world/tilemap/tile_map.tres" id="1_tbwuq"] +[ext_resource type="FontFile" uid="uid://dxcsr8pfoj3c" path="res://etc/bulletinV1.ttf" id="2_racf3"] +[ext_resource type="FontFile" uid="uid://dj1hgg8vhug8j" path="res://etc/slkscr.ttf" id="3_7m3ot"] + +[sub_resource type="LabelSettings" id="LabelSettings_v3hpu"] +font = ExtResource("2_racf3") +font_size = 19 +font_color = Color(0.156863, 0.137255, 0.156863, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_efxst"] +bg_color = Color(0.156863, 0.137255, 0.156863, 1) +border_width_left = 1 +border_width_top = 1 +border_width_right = 1 +border_width_bottom = 1 +border_color = Color(0.156863, 0.137255, 0.156863, 1) +corner_radius_top_left = 2 +corner_radius_top_right = 2 +corner_radius_bottom_right = 2 +corner_radius_bottom_left = 2 +anti_aliasing = false + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_l6cit"] +bg_color = Color(0.639216, 0.635294, 0.603922, 1) +border_width_left = 1 +border_width_top = 1 +border_width_right = 1 +border_width_bottom = 1 +border_color = Color(0.156863, 0.137255, 0.156863, 1) +corner_radius_top_left = 2 +corner_radius_top_right = 2 +corner_radius_bottom_right = 2 +corner_radius_bottom_left = 2 +anti_aliasing = false + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_g1nyl"] +bg_color = Color(0.639216, 0.635294, 0.603922, 1) + +[sub_resource type="Theme" id="Theme_irg28"] +default_font = ExtResource("3_7m3ot") +Button/colors/font_color = Color(0.156863, 0.137255, 0.156863, 1) +Button/colors/font_hover_color = Color(0.639216, 0.635294, 0.603922, 1) +Button/colors/font_hover_pressed_color = Color(0.156863, 0.137255, 0.156863, 1) +Button/colors/font_pressed_color = Color(0.156863, 0.137255, 0.156863, 1) +Button/font_sizes/font_size = 8 +Button/styles/hover = SubResource("StyleBoxFlat_efxst") +Button/styles/normal = SubResource("StyleBoxFlat_l6cit") +Button/styles/pressed = SubResource("StyleBoxFlat_g1nyl") + +[node name="Game Over" type="Node2D"] +script = ExtResource("1_racf3") + +[node name="TileMapLayer" type="TileMapLayer" parent="."] +tile_map_data = PackedByteArray("AAAAAAAAAgAEAAAAAAAAAAEAAgAEAAAAA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A0AAgAEAAAAAAATAAwAAgAEAAAAAAATAAsAAgAEAAAAAAATAAoAAgAEAAAAAAATAAkAAgAEAAAAAAATAAgAAgAEAAAAAAATAAcAAgAEAAAAAAATAAYAAgAEAAAAAAATAAUAAgAEAAAAAAATAAQAAgAEAAAAAAATAAMAAgAEAAAAAAATAAIAAgAEAAAAAAATAAEAAgAEAAAAAAAUAAEAAgAEAAAAAAAUAAIAAgAEAAAAAAAUAAMAAgAEAAAAAAAUAAQAAgAEAAAAAAAUAAUAAgAEAAAAAAAUAAYAAgAEAAAAAAAUAAcAAgAEAAAAAAAUAAgAAgAEAAAAAAAUAAkAAgAEAAAAAAAUAAoAAgAEAAAAAAAUAAsAAgAEAAAAAAAUAAwAAgAEAAAAAAAUAA0AAgAEAAAAAAAUAA4AAgAEAAAAAAAVAA4AAgAEAAAAAAAVAA0AAgAEAAAAAAAVAAwAAgAEAAAAAAAVAAsAAgAEAAAAAAAVAAoAAgAEAAAAAAAVAAkAAgAEAAAAAAAVAAgAAgAEAAAAAAAVAAcAAgAEAAAAAAAVAAYAAgAEAAAAAAAVAAUAAgAEAAAAAAAVAAQAAgAEAAAAAAAVAAMAAgAEAAAAAAAVAAIAAgAEAAAAAAAVAAEAAgAEAAAAAAAWAAEAAgAEAAAAAAAWAAIAAgAEAAAAAAAWAAMAAgAEAAAAAAAWAAQAAgAEAAAAAAAWAAUAAgAEAAAAAAAWAAYAAgAEAAAAAAAWAAcAAgAEAAAAAAAWAAgAAgAEAAAAAAAWAAkAAgAEAAAAAAAWAAoAAgAEAAAAAAAWAAsAAgAEAAAAAAAWAAwAAgAEAAAAAAAWAA0AAgAEAAAAAAAWAA4AAgAEAAAAAAA=") +tile_set = ExtResource("1_tbwuq") + +[node name="Label" type="Label" parent="."] +offset_left = 130.0 +offset_top = 78.0 +offset_right = 262.0 +offset_bottom = 133.0 +text = "Game Over +Play again?" +label_settings = SubResource("LabelSettings_v3hpu") + +[node name="Score" type="Label" parent="."] +offset_left = 116.0 +offset_top = 163.0 +offset_right = 248.0 +offset_bottom = 218.0 +text = "Score:" +label_settings = SubResource("LabelSettings_v3hpu") + +[node name="Button" type="Button" parent="."] +offset_left = 150.0 +offset_top = 153.0 +offset_right = 225.0 +offset_bottom = 164.0 +theme = SubResource("Theme_irg28") +text = "Play" + +[connection signal="pressed" from="Button" to="." method="_on_button_pressed"] diff --git a/scenes/inventory/inventory.gd b/scenes/inventory/inventory.gd index e1e7274..f63f2e8 100644 --- a/scenes/inventory/inventory.gd +++ b/scenes/inventory/inventory.gd @@ -10,13 +10,21 @@ var items : Array[Array] @onready var money = $Money @onready var score = $Score +@export var levels : Node2D + +var x_swaps = 0 + var item_offset : int = 26 +var in_shop = false + @export var bonus_scene : PackedScene @export var item_scene : PackedScene @export var items_start : Node2D +@onready var lock : Sprite2D = $Lock + @export var player : CharacterBody2D func _ready(): @@ -90,6 +98,7 @@ func update_calculations(): 3: player.tax = total negative_modifiers[x].text = '=' + str(total) + func update_stats(): remaining_ammunition.text = '- ' + str(player.remaining_bullets) health.text = '- ' + str(player.health) @@ -118,14 +127,19 @@ func global_to_inventory_coords(position : Vector2): func _process(delta: float) -> void: - pass + if in_shop: + lock.frame = 1 + else: + lock.frame = 0 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_LEFT or event.button_index == MOUSE_BUTTON_RIGHT) and event.pressed and in_shop: if(event.button_index == MOUSE_BUTTON_RIGHT): layer = 1 + if x_swaps <= 0: + return 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 diff --git a/scenes/inventory/inventory.tscn b/scenes/inventory/inventory.tscn index 8cee76e..c728c90 100644 --- a/scenes/inventory/inventory.tscn +++ b/scenes/inventory/inventory.tscn @@ -1,10 +1,14 @@ -[gd_scene load_steps=12 format=3 uid="uid://o6e5ybx262ig"] +[gd_scene load_steps=21 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"] +[ext_resource type="Texture2D" uid="uid://c8ptw6uydekn8" path="res://scenes/inventory/lock.png" id="6_v8e04"] +[ext_resource type="FontFile" uid="uid://dj1hgg8vhug8j" path="res://etc/slkscr.ttf" id="7_kl7fi"] +[ext_resource type="PackedScene" uid="uid://bsedu348niu4n" path="res://scenes/inventory/tooltip/tooltip.tscn" id="7_l6cit"] +[ext_resource type="Script" uid="uid://ca6rno5o2qeus" path="res://scenes/inventory/tutorial_text.gd" id="8_x4j3l"] [sub_resource type="LabelSettings" id="LabelSettings_bxceu"] font = ExtResource("4_tvok8") @@ -36,6 +40,51 @@ font = ExtResource("4_tvok8") font_size = 8 font_color = Color(0.329412, 0.360784, 0.494118, 1) +[sub_resource type="LabelSettings" id="LabelSettings_g1nyl"] +font = ExtResource("7_kl7fi") +font_size = 9 +font_color = Color(0.156863, 0.137255, 0.156863, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_efxst"] +bg_color = Color(0.156863, 0.137255, 0.156863, 1) +border_width_left = 1 +border_width_top = 1 +border_width_right = 1 +border_width_bottom = 1 +border_color = Color(0.156863, 0.137255, 0.156863, 1) +corner_radius_top_left = 2 +corner_radius_top_right = 2 +corner_radius_bottom_right = 2 +corner_radius_bottom_left = 2 +anti_aliasing = false + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_l6cit"] +bg_color = Color(0.639216, 0.635294, 0.603922, 1) +border_width_left = 1 +border_width_top = 1 +border_width_right = 1 +border_width_bottom = 1 +border_color = Color(0.156863, 0.137255, 0.156863, 1) +corner_radius_top_left = 2 +corner_radius_top_right = 2 +corner_radius_bottom_right = 2 +corner_radius_bottom_left = 2 +anti_aliasing = false + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_g1nyl"] +bg_color = Color(0.639216, 0.635294, 0.603922, 1) + +[sub_resource type="Theme" id="Theme_efxst"] +default_font = ExtResource("7_kl7fi") +Button/colors/font_color = Color(0.156863, 0.137255, 0.156863, 1) +Button/colors/font_hover_color = Color(0.639216, 0.635294, 0.603922, 1) +Button/colors/font_hover_pressed_color = Color(0.156863, 0.137255, 0.156863, 1) +Button/colors/font_pressed_color = Color(0.156863, 0.137255, 0.156863, 1) +Button/font_sizes/font_size = 8 +Button/styles/hover = SubResource("StyleBoxFlat_efxst") +Button/styles/normal = SubResource("StyleBoxFlat_l6cit") +Button/styles/pressed = SubResource("StyleBoxFlat_g1nyl") + [node name="Inventory" type="Control" node_paths=PackedStringArray("items_start")] layout_mode = 3 anchors_preset = 6 @@ -57,6 +106,11 @@ position = Vector2(-64, 0) texture = ExtResource("4_bxceu") region_rect = Rect2(0, 0, 134, 256) +[node name="Lock" type="Sprite2D" parent="."] +position = Vector2(-12, -8) +texture = ExtResource("6_v8e04") +hframes = 2 + [node name="InventoryStart" type="Marker2D" parent="."] position = Vector2(-110, -111) @@ -68,6 +122,10 @@ offset_bottom = -99.0 text = "=10" label_settings = SubResource("LabelSettings_bxceu") +[node name="Tooltip" parent="Speed" instance=ExtResource("7_l6cit")] +position = Vector2(8, 12) +tooltip_text = "Speed" + [node name="RemainingAmmunition" type="Label" parent="."] layout_mode = 0 offset_left = -105.0 @@ -92,7 +150,7 @@ offset_left = -105.0 offset_top = 48.0 offset_right = -85.0 offset_bottom = 71.0 -text = "- 0" +text = "- 100" label_settings = SubResource("LabelSettings_l6cit") [node name="Score" type="Label" parent="."] @@ -113,6 +171,10 @@ offset_bottom = -87.0 text = "=10" label_settings = SubResource("LabelSettings_bxceu") +[node name="Tooltip3" parent="BulletSpeed" instance=ExtResource("7_l6cit")] +position = Vector2(8, 13) +tooltip_text = "Bullet Speed" + [node name="Ammunition" type="Label" parent="."] layout_mode = 0 offset_left = -20.0 @@ -121,6 +183,10 @@ offset_bottom = -47.0 text = "=10" label_settings = SubResource("LabelSettings_bxceu") +[node name="Tooltip2" parent="Ammunition" instance=ExtResource("7_l6cit")] +position = Vector2(8, 13) +tooltip_text = "Magazine Size" + [node name="Damage" type="Label" parent="."] layout_mode = 0 offset_left = -20.0 @@ -129,6 +195,10 @@ offset_bottom = -21.0 text = "=10" label_settings = SubResource("LabelSettings_bxceu") +[node name="Tooltip3" parent="Damage" instance=ExtResource("7_l6cit")] +position = Vector2(8, 13) +tooltip_text = "Damage To Enemies" + [node name="Size" type="Label" parent="."] layout_mode = 0 offset_left = -71.0 @@ -139,6 +209,10 @@ text = "=10" label_settings = SubResource("LabelSettings_v8e04") horizontal_alignment = 1 +[node name="Tooltip7" parent="Size" instance=ExtResource("7_l6cit")] +position = Vector2(11, 21) +tooltip_text = "Size (Your hitbox is bigger)" + [node name="TaxRate" type="Label" parent="."] layout_mode = 0 offset_left = -46.0 @@ -149,6 +223,10 @@ text = "=10" label_settings = SubResource("LabelSettings_v8e04") horizontal_alignment = 1 +[node name="Tooltip5" parent="TaxRate" instance=ExtResource("7_l6cit")] +position = Vector2(12, 21) +tooltip_text = "Tax (Money Reduction From Enemies)" + [node name="FiringDelay" type="Label" parent="."] layout_mode = 0 offset_left = -98.0 @@ -159,6 +237,10 @@ text = "=10" label_settings = SubResource("LabelSettings_v8e04") horizontal_alignment = 1 +[node name="Tooltip6" parent="FiringDelay" instance=ExtResource("7_l6cit")] +position = Vector2(12, 21) +tooltip_text = "Delay Between Shots" + [node name="IncomingDamage" type="Label" parent="."] layout_mode = 0 offset_left = -124.0 @@ -168,3 +250,49 @@ offset_bottom = 6.0 text = "=10" label_settings = SubResource("LabelSettings_v8e04") horizontal_alignment = 1 + +[node name="Tooltip4" parent="IncomingDamage" instance=ExtResource("7_l6cit")] +position = Vector2(12, 21) +tooltip_text = "Damage From Enemies" + +[node name="TUTORIAL" type="Label" parent="."] +layout_mode = 0 +offset_left = -47.0 +offset_top = 33.0 +offset_right = 25.0 +offset_bottom = 141.0 +text = "TUTORIAL +↓ ↓ ↓ ↓" +label_settings = SubResource("LabelSettings_efxst") + +[node name="TutorialText" type="Label" parent="."] +layout_mode = 0 +offset_left = -127.0 +offset_top = 56.0 +offset_right = 3.0 +offset_bottom = 113.0 +label_settings = SubResource("LabelSettings_g1nyl") +script = ExtResource("8_x4j3l") + +[node name="Next" type="Button" parent="TutorialText"] +layout_mode = 0 +offset_left = 99.0 +offset_top = 58.0 +offset_right = 125.0 +offset_bottom = 69.0 +focus_mode = 0 +theme = SubResource("Theme_efxst") +text = "Next" + +[node name="Previous" type="Button" parent="TutorialText"] +layout_mode = 0 +offset_left = 71.0 +offset_top = 58.0 +offset_right = 97.0 +offset_bottom = 69.0 +focus_mode = 0 +theme = SubResource("Theme_efxst") +text = "Prev" + +[connection signal="pressed" from="TutorialText/Next" to="TutorialText" method="_on_next_pressed"] +[connection signal="pressed" from="TutorialText/Previous" to="TutorialText" method="_on_previous_pressed"] diff --git a/scenes/inventory/lock.png b/scenes/inventory/lock.png new file mode 100644 index 0000000000000000000000000000000000000000..f04b821f145fdb44b046906e045bf150ea014369 GIT binary patch literal 192 zcmeAS@N?(olHy`uVBq!ia0vp^3P3Et!3HGD8EPYe6k~CayA#8@b22Z1oGMQj#}JRs z 384: + panel.global_position.x = 384-panel.size.x + if panel.global_position.x < 0: + panel.global_position.x = 0 + + if panel.global_position.y + panel.size.y > 256: + panel.global_position.y = 256-panel.size.y + if panel.global_position.y < 0: + panel.global_position.y = 0 + else: + panel.hide() + +func _on_mouse_entered() -> void: + mouse_hovering = true + + +func _on_mouse_exited() -> void: + mouse_hovering = false diff --git a/scenes/inventory/tooltip/tooltip.gd.uid b/scenes/inventory/tooltip/tooltip.gd.uid new file mode 100644 index 0000000..af02fad --- /dev/null +++ b/scenes/inventory/tooltip/tooltip.gd.uid @@ -0,0 +1 @@ +uid://csb4bby01d4ph diff --git a/scenes/inventory/tooltip/tooltip.tscn b/scenes/inventory/tooltip/tooltip.tscn new file mode 100644 index 0000000..51e6013 --- /dev/null +++ b/scenes/inventory/tooltip/tooltip.tscn @@ -0,0 +1,48 @@ +[gd_scene load_steps=7 format=3 uid="uid://bsedu348niu4n"] + +[ext_resource type="Script" uid="uid://csb4bby01d4ph" path="res://scenes/inventory/tooltip/tooltip.gd" id="1_kaqjd"] +[ext_resource type="FontFile" uid="uid://dj1hgg8vhug8j" path="res://etc/slkscr.ttf" id="1_tthyn"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_0y2k0"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_yl77q"] +bg_color = Color(0.639216, 0.635294, 0.603922, 1) +border_width_left = 1 +border_width_top = 1 +border_width_right = 1 +border_width_bottom = 1 +border_color = Color(0.156863, 0.137255, 0.156863, 1) +corner_radius_top_left = 2 +corner_radius_top_right = 2 +corner_radius_bottom_right = 2 +corner_radius_bottom_left = 2 +anti_aliasing = false + +[sub_resource type="Theme" id="Theme_xjhe7"] +PanelContainer/styles/panel = SubResource("StyleBoxFlat_yl77q") + +[sub_resource type="LabelSettings" id="LabelSettings_kaqjd"] +font = ExtResource("1_tthyn") +font_size = 9 +font_color = Color(0.156863, 0.137255, 0.156863, 1) + +[node name="Tooltip" type="Area2D"] +script = ExtResource("1_kaqjd") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource("CircleShape2D_0y2k0") + +[node name="PanelContainer" type="PanelContainer" parent="."] +z_index = 10 +offset_right = 1.0 +offset_bottom = 10.0 +mouse_filter = 2 +theme = SubResource("Theme_xjhe7") + +[node name="Label" type="Label" parent="PanelContainer"] +layout_mode = 2 +text = "Testing Tooltip" +label_settings = SubResource("LabelSettings_kaqjd") + +[connection signal="mouse_entered" from="." to="." method="_on_mouse_entered"] +[connection signal="mouse_exited" from="." to="." method="_on_mouse_exited"] diff --git a/scenes/inventory/tutorial_text.gd b/scenes/inventory/tutorial_text.gd new file mode 100644 index 0000000..a87fe32 --- /dev/null +++ b/scenes/inventory/tutorial_text.gd @@ -0,0 +1,63 @@ +extends Label + +var tutorials = \ +["Welcome to Su-no-ku, +because it's not Sudoku. +Kill EVERYONE, ill tell +you more in a second.", +"You see those areas, +the ones that the +enemies came out of? +go there.", +"Top right are your +stats, hover over +each one to find +out what it does.", +"Your stats are +calculated by adding +all of the numbers in +the row or column...", +"Not counting the +number with the X on it, +that is a multiplier, +it's added at the end", +"Try messing around +with the values, you +can only do so in the +shop", +"You can also buy +upgrades in the shop, +try dragging one over +to your inventory", +"Your goal is to +survive as long as +possible, have fun!"] + +var tutorial_number = 0 + +@onready var inventory = get_parent() +@onready var next = $Next +@onready var previous = $Previous + +func _ready() -> void: + text = tutorials[0] + +func _process(delta: float) -> void: + text = tutorials[tutorial_number] + if tutorial_number <= 0: + previous.hide() + else: + previous.show() + + if tutorial_number >= len(tutorials)-1: + next.hide() + else: + next.show() + + +func _on_next_pressed() -> void: + tutorial_number += 1 + + +func _on_previous_pressed() -> void: + tutorial_number -= 1 diff --git a/scenes/inventory/tutorial_text.gd.uid b/scenes/inventory/tutorial_text.gd.uid new file mode 100644 index 0000000..95b7063 --- /dev/null +++ b/scenes/inventory/tutorial_text.gd.uid @@ -0,0 +1 @@ +uid://ca6rno5o2qeus diff --git a/scenes/inventory/upgrades/upgrade.tscn b/scenes/inventory/upgrades/upgrade.tscn new file mode 100644 index 0000000..2abcd64 --- /dev/null +++ b/scenes/inventory/upgrades/upgrade.tscn @@ -0,0 +1,37 @@ +[gd_scene load_steps=6 format=3 uid="uid://dsgvdus6pyld1"] + +[ext_resource type="Script" uid="uid://cratbhruo2vb" path="res://upgrade.gd" id="1_5bg6l"] +[ext_resource type="Texture2D" uid="uid://t7ilejqp6k1b" path="res://scenes/inventory/upgrades/upgrades.png" id="2_tfji8"] +[ext_resource type="FontFile" uid="uid://cukc34hue3c0h" path="res://etc/pixelated.ttf" id="3_pduvh"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_tfji8"] + +[sub_resource type="LabelSettings" id="LabelSettings_ax071"] +font = ExtResource("3_pduvh") +font_size = 8 +font_color = Color(0.156863, 0.137255, 0.156863, 1) + +[node name="upgrade" type="Area2D" groups=["upgrades"]] +script = ExtResource("1_5bg6l") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource("CircleShape2D_tfji8") + +[node name="CanvasLayer" type="CanvasLayer" parent="."] +layer = 2 + +[node name="Sprite2D" type="Sprite2D" parent="CanvasLayer"] +texture = ExtResource("2_tfji8") +hframes = 2 +vframes = 2 + +[node name="Label" type="Label" parent="."] +offset_left = -15.0 +offset_top = 10.0 +offset_right = 15.0 +offset_bottom = 24.0 +text = "$100" +label_settings = SubResource("LabelSettings_ax071") +horizontal_alignment = 1 + +[connection signal="input_event" from="." to="." method="_on_input_event"] diff --git a/scenes/inventory/upgrades/upgrades.png b/scenes/inventory/upgrades/upgrades.png new file mode 100644 index 0000000000000000000000000000000000000000..5ff4b5b7406e3a96fbd6a718f62e7d3395547b40 GIT binary patch literal 178 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%Cx&(BWL^R}Ii4<#ArY-_ zFB|e5P~cz<$f^<+e^)Oxecn;O`i!1HVS(9yw(mT_9{9xHB>U=`tDnwo3A(fCLlDFI zN0%9GTG@X{=tjN}s@my#OZD(ho2Q@n3XZW{czN#J!ye89=guXrN_hV|l7+9HNl8g* bQGtGNr<~0M_Sls`dl@`k{an^LB{Ts5zIQ`* literal 0 HcmV?d00001 diff --git a/scenes/inventory/upgrades/upgrades.png.import b/scenes/inventory/upgrades/upgrades.png.import new file mode 100644 index 0000000..795e83b --- /dev/null +++ b/scenes/inventory/upgrades/upgrades.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://t7ilejqp6k1b" +path="res://.godot/imported/upgrades.png-496415d7d1d0c7507c0d2ba4cda9f87f.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://scenes/inventory/upgrades/upgrades.png" +dest_files=["res://.godot/imported/upgrades.png-496415d7d1d0c7507c0d2ba4cda9f87f.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/upgrades/upgrades.pxo b/scenes/inventory/upgrades/upgrades.pxo new file mode 100644 index 0000000000000000000000000000000000000000..8d46fae96bb8738ae58d5dbd5f886836616cc1cc GIT binary patch literal 816 zcmWIWW@Zs#VBp|jaF{eZs%>dmKq4ap!zm^P22KVBhLpsTM7^xy{Jh-2i+P6(c>ah! zS?;UV!I#Vbx9#u27NyI(5+&AXmz*XU=@j5;$fT+zNT!H^;Ji*4%UV#7XmA)B%leviIS4*;D2(}mi>g`!iNPX!v9{~x%VGK z07^XgZ9HP*0t|l!0R{$XAeEV$n4TIBiVgj=qQu<#TmT&-lZCUpy>6-S+U+x}>x6@4g8$HLL!=d|Q?|_rHb&>*55F zo~A$pE;mL~Ml{QN-!ole23iVC2Mo$MEYHkK$xKcyj)ysd0cZvzFwx*nN literal 0 HcmV?d00001 diff --git a/scenes/player/player.gd b/scenes/player/player.gd index 61da654..18930fc 100644 --- a/scenes/player/player.gd +++ b/scenes/player/player.gd @@ -1,7 +1,11 @@ extends CharacterBody2D +class_name Player + var base_speed = 100 +var death_scene = "res://scenes/game_over.tscn" + var speed var bullet_speed var ammunition @@ -18,7 +22,7 @@ var remaining_bullets = 7 var health = 100 -var money = 0 +var money = 100 var score = 0 @@ -34,6 +38,9 @@ var bullet_timer = 0 @export var bullet_scene : PackedScene func _physics_process(delta): + if health < 0: + Globals.score = score + get_tree().change_scene_to_file(death_scene) bullet_timer -= delta velocity = Vector2(0,0) if Input.is_action_pressed("left"): @@ -44,8 +51,11 @@ func _physics_process(delta): velocity.y += -1 if Input.is_action_pressed("down"): velocity.y += 1 + + if Input.is_action_just_pressed("reload"): + reload() - if Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT): + if Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT) and get_global_mouse_position().x < 256 and Globals.mouse_dragging == false: spawn_bullet() velocity = velocity.normalized() * speed*base_speed*delta @@ -56,7 +66,8 @@ func _physics_process(delta): collision.scale = Vector2(0.3,0.3)*(pow(size,0.2)) if bullet_timer < 0 and reloading: - remaining_bullets += 1 + if remaining_bullets < ammunition: + remaining_bullets += 1 bullet_timer = reload_speed if remaining_bullets >= ammunition: reloading = false @@ -66,6 +77,9 @@ func _physics_process(delta): func reload(): reloading = true +func inflict_damage(): + health -= incoming_damage + inventory.update_stats() func spawn_bullet(): if bullet_timer > 0 or reloading: return diff --git a/scenes/player/player.tscn b/scenes/player/player.tscn index 5ba5753..84801ca 100644 --- a/scenes/player/player.tscn +++ b/scenes/player/player.tscn @@ -7,7 +7,9 @@ [sub_resource type="CircleShape2D" id="CircleShape2D_dovo2"] radius = 13.0 -[node name="Player" type="CharacterBody2D"] +[node name="Player" type="CharacterBody2D" groups=["damageable", "player"]] +collision_layer = 3 +collision_mask = 3 motion_mode = 1 script = ExtResource("1_dovo2") bullet_scene = ExtResource("2_gmlin") diff --git a/scenes/world/blocked.png b/scenes/world/blocked.png new file mode 100644 index 0000000000000000000000000000000000000000..7b3a30b848ea38e5d7d83c0def57750931dbdb32 GIT binary patch literal 180 zcmeAS@N?(olHy`uVBq!ia0vp^3P3Et!3HGD8EPYe6k~CayA#8@b22Z1oIFn##}JRs zWSdzxf6Qm(jPPHdp0YsEVSB$|Y(p5|!Bl=f_JGrhEoahI!W38XDPFVTapufC@?4_m z%cC!%nr(rPGMWy0^*nqM;j@MLL?Msn%hpa2_6tlr_cSCnxL73IEI7cmh*7_bJvP void: + for level in levels: + level.enabled = false + level.navigation_enabled = false + + var level = levels.pick_random() + level.enabled = true + level.navigation_enabled = true + + make_spawns() + +func _process(delta: float) -> void: + if Engine.get_process_frames() % 10 == 0: + if get_tree().get_nodes_in_group("enemy") != []: + enemies_alive = true + else: + var currently_alive = false + for spawn in spawn_points: + if spawn.spawns != []: + currently_alive = true + break + enemies_alive = currently_alive + + for i in range(4): + if not enemies_alive and last_direction != i: + borders[i].set_deferred("disabled",true) + else: + borders[i].set_deferred("disabled",false) + if last_direction == i: + areas[i].show() + else: + areas[i].hide() + +func make_spawns(): + for spawn_point in spawn_points: + spawn_point.spawns.clear() + + var difficulty_left = difficulty + while difficulty_left > 0: + var direction = randi_range(0,3) + while direction == last_direction: + direction = randi_range(0,3) + var enemy = enemies.pick_random().instantiate() + var delay = 100*(1/(difficulty+100)) + enemy.speed *= 1 + (difficulty/100) + enemy.health *= 1 + (difficulty/100) + spawn_points[direction].add_spawn(Spawn.new(delay,enemy)) + difficulty_left -= enemy.difficulty + +func change_level(): + if player.inventory.in_shop: + shop.stop() + player.inventory.in_shop = false + player.score += 20 + player.inventory.update_stats() + difficulty += 2 + for level in levels: + level.enabled = false + level.navigation_enabled = false + + levels_until_shop -= 1 + if levels_until_shop <= 0: + shop.start() + player.inventory.in_shop = true + levels_until_shop = 3 + return + + var level = levels.pick_random() + level.enabled = true + level.navigation_enabled = true + + make_spawns() + + + +func _on_top_body_entered(body: Node2D) -> void: + if not body is Player: + return + last_direction = 2 + print("top") + change_level() + player.position = Vector2(128,256-player.scale.x*32) + + + + +func _on_bottom_body_entered(body: Node2D) -> void: + if not body is Player: + return + last_direction = 0 + change_level() + print("bottom") + player.position = Vector2(128,0+player.scale.x*32) + + + +func _on_left_body_entered(body: Node2D) -> void: + if not body is Player: + return + last_direction = 1 + change_level() + print("left") + player.position = Vector2(256-player.scale.x*32,128) + + + + +func _on_right_body_entered(body: Node2D) -> void: + if not body is Player: + return + last_direction = 3 + change_level() + print("right") + player.position = Vector2(0+player.scale.x*32,128) + diff --git a/scenes/world/level.gd.uid b/scenes/world/level.gd.uid new file mode 100644 index 0000000..bf3e3a3 --- /dev/null +++ b/scenes/world/level.gd.uid @@ -0,0 +1 @@ +uid://c75kdxk3eemei diff --git a/scenes/world/shop.gd b/scenes/world/shop.gd new file mode 100644 index 0000000..1a79e17 --- /dev/null +++ b/scenes/world/shop.gd @@ -0,0 +1,38 @@ +extends TileMapLayer + +@export var upgrade : PackedScene + +@export var inventory : Control + +var upgrades : Array[Upgrade] + +@export var spawn_points : Array[Marker2D] + +var working = false + +func _process(delta): + if working: + if len(upgrades) < len(spawn_points): + add_upgrade() + +func start(): + working = true + enabled = true + +func stop(): + for upgrade in get_tree().get_nodes_in_group("upgrades"): + upgrade.queue_free() + upgrades.clear() + enabled = false + + working = false + +func add_upgrade(): + var new_upgrade = upgrade.instantiate() + var random_spawn_point : Marker2D = spawn_points.pick_random() + while random_spawn_point.get_children() != []: + random_spawn_point = spawn_points.pick_random() + #new_upgrade.global_position = random_spawn_point.global_position + new_upgrade.inventory = inventory + random_spawn_point.add_child(new_upgrade) + upgrades.append(new_upgrade) diff --git a/scenes/world/shop.gd.uid b/scenes/world/shop.gd.uid new file mode 100644 index 0000000..67d5a12 --- /dev/null +++ b/scenes/world/shop.gd.uid @@ -0,0 +1 @@ +uid://dl3s53elpx43k diff --git a/scenes/world/shop.tscn b/scenes/world/shop.tscn new file mode 100644 index 0000000..3fd6146 --- /dev/null +++ b/scenes/world/shop.tscn @@ -0,0 +1,21 @@ +[gd_scene load_steps=4 format=4 uid="uid://ck3pogpwo5gtx"] + +[ext_resource type="TileSet" uid="uid://bawet85hqjpku" path="res://scenes/world/tilemap/tile_map.tres" id="1_ndatx"] +[ext_resource type="Script" uid="uid://dl3s53elpx43k" path="res://scenes/world/shop.gd" id="2_vue3k"] +[ext_resource type="PackedScene" uid="uid://dsgvdus6pyld1" path="res://scenes/inventory/upgrades/upgrade.tscn" id="3_vue3k"] + +[node name="Shop" type="TileMapLayer" node_paths=PackedStringArray("spawn_points") groups=["terrain"]] +tile_map_data = PackedByteArray("AAAAAAAAAgAEAAAAAAABAAAAAgAEAAAAAAACAAAAAgAEAAAAAAACAAEAAgAEAAAAAAADAAEAAgAEAAAAAAAEAAEAAgAEAAAAAAAFAAEAAgAEAAAAAAAHAAEAAgAEAAAAAAAIAAEAAgAEAAAAAAAKAAEAAgAEAAAAAAALAAEAAgAEAAAAAAAMAAEAAgAEAAAAAAANAAEAAgAEAAAAAAANAAAAAgAEAAAAAAAOAAAAAgAEAAAAAAAPAAAAAgAEAAAAAAAAAAEAAgAEAAAAAAAAAAIAAgAEAAAAAAAAAAMAAgAEAAAAAAAAAAQAAgAEAAAAAAAAAAUAAgAEAAAAAAAAAAYAAgADAAIAAAAAAAcAAgAEAAAAAAAAAAgAAgAEAAAAAAAAAAkAAgADAAIAAAAAAAoAAgAEAAAAAAAAAAsAAgAEAAAAAAAAAAwAAgAEAAAAAAAAAA0AAgAEAAAAAAAAAA4AAgAEAAAAAAAAAA8AAgAEAAAAAAABAAEAAgAEAAAAAAABAAIAAgAEAAAAAAABAAMAAgAEAAAAAAABAAQAAgAEAAAAAAABAAUAAgAEAAAAAAABAAcAAgAEAAAAAAABAAgAAgAEAAAAAAABAAoAAgAEAAAAAAABAAsAAgAEAAAAAAABAAwAAgAEAAAAAAABAA0AAgAEAAAAAAABAA4AAgAEAAAAAAABAA8AAgAEAAAAAAACAAQAAgAEAAAAAAACAAUAAgAEAAAAAAACAAcAAgAEAAAAAAACAAgAAgAEAAAAAAACAAoAAgAEAAAAAAACAAsAAgAEAAAAAAACAA4AAgAEAAAAAAACAA8AAgAEAAAAAAADAAAAAgAEAAAA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AAOAA8AAgAEAAAAAAAPAAEAAgAEAAAAAAAPAAIAAgAEAAAAAAAPAAQAAgAEAAAAAAAPAAUAAgAEAAAAAAAPAAYAAgADAAAAAAAPAAcAAgAEAAAAAAAPAAgAAgAEAAAAAAAPAAkAAgADAAAAAAAPAAoAAgAEAAAAAAAPAAsAAgAEAAAAAAAPAAwAAgAEAAAAAAAPAA0AAgAEAAAAAAAPAA4AAgAEAAAAAAAPAA8AAgAEAAAAAAD/////AgAAAAAAAAD//wAAAgACAAEAAAD//wEAAgACAAEAAAD//wIAAgACAAEAAAD//wMAAgACAAEAAAD//wQAAgACAAEAAAD//wUAAgACAAEAAAD//wYAAgAAAAEAAAD//wkAAgAAAAAAAAD//woAAgACAAEAAAD//wsAAgACAAEAAAD//wwAAgACAAEAAAD//w0AAgACAAEAAAD//w4AAgACAAEAAAD//w8AAgACAAEAAAD//xAAAgAAAAEAAAAAABAAAgADAAEAAAABABAAAgADAAEAAAACABAAAgADAAEAAAADABAAAgADAAEAAAAEABAAAgADAAEAAAAFABAAAgADAAEAAAAGABAAAgABAAEAAAAJABAAAgAAAAEAAAAKABAAAgADAAEAAAALABAAAgADAAEAAAAMABAAAgADAAEAAAANABAAAgADAAEAAAAOABAAAgADAAEAAAAPABAAAgADAAEAAAAQABAAAgABAAEAAAAQAA8AAgACAAEAAAAQAA4AAgACAAEAAAAQAA0AAgACAAEAAAAQAAwAAgACAAEAAAAQAAsAAgACAAEAAAAQAAoAAgACAAEAAAAQAAkAAgABAAAAAAAQAAYAAgABAAEAAAAQAAUAAgACAAEAAAAQAAQAAgACAAEAAAAQAAMAAgACAAEAAAAQAAIAAgACAAEAAAAQAAEAAgACAAEAAAAQAAAAAgACAAEAAAAQAP//AgABAAAAAAAPAP//AgADAAEAAAAOAP//AgADAAEAAAANAP//AgADAAEAAAAMAP//AgADAAEAAAALAP//AgADAAEAAAAKAP//AgADAAEAAAAJAP//AgAAAAAAAAAGAP//AgABAAAAAAAFAP//AgADAAEAAAAEAP//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AAcAAgAEAAAAAAAGAAgAAgAEAAAAAAAGAAkAAgAEAAAAAAAGAAwAAgAEAAAAAAAHAAwAAgAEAAAAAAAIAAwAAgAEAAAAAAAJAAwAAgAEAAAAAAAMAAwAAgAEAAAAAAAMAAsAAgAEAAAAAAAMAA0AAgAEAAAAAAAJAAkAAgAEAAAAAAAMAAQAAgAEAAAAAAA=") +tile_set = ExtResource("1_ndatx") +script = ExtResource("2_vue3k") +upgrade = ExtResource("3_vue3k") +spawn_points = [NodePath("Marker2D"), NodePath("Marker2D2"), NodePath("Marker2D3")] + +[node name="Marker2D" type="Marker2D" parent="."] +position = Vector2(92, 132) + +[node name="Marker2D2" type="Marker2D" parent="."] +position = Vector2(126, 132) + +[node name="Marker2D3" type="Marker2D" parent="."] +position = Vector2(159, 132) diff --git a/scenes/world/spawner.gd b/scenes/world/spawner.gd new file mode 100644 index 0000000..228126d --- /dev/null +++ b/scenes/world/spawner.gd @@ -0,0 +1,37 @@ +extends Marker2D + +var spawns : Array[Level.Spawn] + + +var next_spawn : Level.Spawn + +var timer = 2 + +var spawning = false + +func _process(delta): + + if spawns == []: + spawning = false + + if spawning: + timer -= delta + if timer < 0: + spawn(next_spawn.enemy) + timer = next_spawn.delay + spawns.erase(next_spawn) + timer = 2 + if spawns != []: + next_spawn = spawns.pick_random() + +func spawn(enemy : CharacterBody2D): + enemy.player = get_tree().get_nodes_in_group("player")[0] + + enemy.global_position = global_position + get_parent().add_child(enemy) + +func add_spawn(spawn : Level.Spawn): + spawns.append(spawn) + next_spawn = spawn + spawning = true + diff --git a/scenes/world/spawner.gd.uid b/scenes/world/spawner.gd.uid new file mode 100644 index 0000000..dbff0f9 --- /dev/null +++ b/scenes/world/spawner.gd.uid @@ -0,0 +1 @@ +uid://c2lpqem5ubn4r diff --git a/scenes/world/tilemap/tile_map.tres b/scenes/world/tilemap/tile_map.tres new file mode 100644 index 0000000..e27143f --- /dev/null +++ b/scenes/world/tilemap/tile_map.tres @@ -0,0 +1,119 @@ +[gd_resource type="TileSet" load_steps=4 format=3 uid="uid://bawet85hqjpku"] + +[ext_resource type="Texture2D" uid="uid://fi7000wjcmkt" path="res://scenes/world/tilemap/tilemap.png" id="1_d21gp"] + +[sub_resource type="NavigationPolygon" id="NavigationPolygon_l616b"] +vertices = PackedVector2Array(8, 8, -8, 8, -8, -8, 8, -8) +polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2, 3)]) +outlines = Array[PackedVector2Array]([PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)]) +agent_radius = 0.0 + +[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_l616b"] +texture = ExtResource("1_d21gp") +0:0/0 = 0 +0:0/0/terrain_set = 0 +0:0/0/terrain = 0 +0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -4, -4, -8, 8, -8, 8, 8, -8, 8) +0:0/0/terrains_peering_bit/right_side = 0 +0:0/0/terrains_peering_bit/bottom_side = 0 +1:0/0 = 0 +1:0/0/terrain_set = 0 +1:0/0/terrain = 0 +1:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 4, -8, 8, -4, 8, 8, -8, 8) +1:0/0/terrains_peering_bit/bottom_side = 0 +1:0/0/terrains_peering_bit/left_side = 0 +2:0/0 = 0 +2:0/0/terrain_set = 0 +2:0/0/terrain = 0 +2:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-4, -8, 4, -8, 8, -4, 8, 8, -8, 8, -8, -4) +2:0/0/terrains_peering_bit/bottom_side = 0 +3:0/0 = 0 +3:0/0/terrain_set = 0 +3:0/0/terrain = 0 +3:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -4, -4, -8, 8, -8, 8, 8, -4, 8, -8, 4) +3:0/0/terrains_peering_bit/right_side = 0 +1:1/0 = 0 +1:1/0/terrain_set = 0 +1:1/0/terrain = 0 +1:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 4, 4, 8, -8, 8) +1:1/0/terrains_peering_bit/left_side = 0 +1:1/0/terrains_peering_bit/top_side = 0 +2:1/0 = 0 +2:1/0/terrain_set = 0 +2:1/0/terrain = 0 +2:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +2:1/0/terrains_peering_bit/bottom_side = 0 +2:1/0/terrains_peering_bit/top_side = 0 +3:1/0 = 0 +3:1/0/terrain_set = 0 +3:1/0/terrain = 0 +3:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +3:1/0/terrains_peering_bit/right_side = 0 +3:1/0/terrains_peering_bit/left_side = 0 +0:2/0 = 0 +0:2/0/terrain_set = 0 +0:2/0/terrain = 0 +0:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +0:2/0/terrains_peering_bit/right_side = 0 +0:2/0/terrains_peering_bit/bottom_side = 0 +0:2/0/terrains_peering_bit/left_side = 0 +0:2/0/terrains_peering_bit/top_side = 0 +1:2/0 = 0 +1:2/0/terrain_set = 0 +1:2/0/terrain = 0 +1:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-4, -8, 4, -8, 8, -4, 8, 4, 4, 8, -4, 8, -8, 4, -8, -4) +2:2/0 = 0 +2:2/0/terrain_set = 0 +2:2/0/terrain = 0 +2:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 4, 4, 8, -4, 8, -8, 4) +2:2/0/terrains_peering_bit/top_side = 0 +3:2/0 = 0 +3:2/0/terrain_set = 0 +3:2/0/terrain = 0 +3:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 4, -8, 8, -4, 8, 4, 4, 8, -8, 8) +3:2/0/terrains_peering_bit/left_side = 0 +0:3/0 = 0 +0:3/0/terrain_set = 0 +0:3/0/terrain = 0 +0:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +0:3/0/terrains_peering_bit/right_side = 0 +0:3/0/terrains_peering_bit/bottom_side = 0 +0:3/0/terrains_peering_bit/left_side = 0 +1:3/0 = 0 +1:3/0/terrain_set = 0 +1:3/0/terrain = 0 +1:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +1:3/0/terrains_peering_bit/right_side = 0 +1:3/0/terrains_peering_bit/bottom_side = 0 +1:3/0/terrains_peering_bit/top_side = 0 +2:3/0 = 0 +2:3/0/terrain_set = 0 +2:3/0/terrain = 0 +2:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +2:3/0/terrains_peering_bit/right_side = 0 +2:3/0/terrains_peering_bit/left_side = 0 +2:3/0/terrains_peering_bit/top_side = 0 +3:3/0 = 0 +3:3/0/terrain_set = 0 +3:3/0/terrain = 0 +3:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +3:3/0/terrains_peering_bit/bottom_side = 0 +3:3/0/terrains_peering_bit/left_side = 0 +3:3/0/terrains_peering_bit/top_side = 0 +4:0/0 = 0 +4:0/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_l616b") +0:1/0 = 0 +0:1/0/terrain_set = 0 +0:1/0/terrain = 0 +0:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -4, 8, -8, 4) +0:1/0/terrains_peering_bit/right_side = 0 +0:1/0/terrains_peering_bit/top_side = 0 + +[resource] +physics_layer_0/collision_layer = 5 +physics_layer_0/collision_mask = 5 +terrain_set_0/mode = 2 +terrain_set_0/terrain_0/name = "Wall" +terrain_set_0/terrain_0/color = Color(0.5, 0.34375, 0.25, 1) +navigation_layer_0/layers = 1 +sources/2 = SubResource("TileSetAtlasSource_l616b") diff --git a/scenes/world/tilemap/tilemap.png b/scenes/world/tilemap/tilemap.png new file mode 100644 index 0000000000000000000000000000000000000000..82b6be3b4e97f89d24a4ebbdcb550b760e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Z|C1+Ke+Mt&##exuJyU+PM=+8`+R=g`T0ll z*Z+QgE71Pg^XZFg$}aVr|MsbS^7^{J{ilDIpHH8+etzArm+rRvztjMY(|)-8%*K6lpjXA5IdHv<~uR7<-{`;(}-*P(d z$t|FJ_Wymm>s&moCJ^t_Cv{$#@ z`s33Ba>4X>)BpXA_Tjptv$uWuy}s)ImlwzT>fYcX{GPt~`|qqoa*yFL zB%*j(4Kr$@?S0R5i5Zw!fu#t8GLA%>nU|88oLU?YO}xnr3<2JZz=V#wAOac$HW5T4 y6-(&a&~pq#If(27x(84GK{p897YKu#S+E;~=BEH}RyL3(W+1!>q}zeo7#INIS)P6X literal 0 HcmV?d00001 diff --git a/scenes/world/tilemap/tilemapcornerless.pxo b/scenes/world/tilemap/tilemapcornerless.pxo new file mode 100644 index 0000000000000000000000000000000000000000..41e423e3c06e5b0d6c4333987c2df464691e77ba GIT binary patch literal 1067 zcmWIWW@Zs#VBp|jQ0bc;wTQVWGlh|X;Up6S11AFmLrP*vqFz>UeqL_i+q^>tJT;i>JDo({)+t!Klv*RZ?|3%I611Ex7g1CG1@K{ki%ZzUNv5H9X3m?wBe4 zdg?Y&$Bic&tkP>kOwE^My*72zxb``}IjTz0Ywblxwyl#RZ%^HFHEx5+4<=R9?M}f* zxRjj=ccvxCPLrwD_;jT{EJy2A%F)mzA#0DHxYqN)*zjQcwAG%a&9*;p|EYCeCdJFK zI_HL^8T(Sh8t1@dVUI7@O{W$r-TpLtm9?3;#jf8z++sU-7=KwjN%HE3%4KKgT6{@S zS)Dr1@y%Ud@6%Zw;m`K2S(FOFu zCAE25O1?FoWVF4i666)M=A*$=(H}luMgJoDx4yWy&+~5f%@@^Ab!IEh|K5Azc9%_} zt4+_Jk~fOUS6AAy@m=1q-@!hj{?B**L;L?Pp2Wg3%kK)?r&rUMm&~|OV6klVz0!B< z_6MLug`fS_J{w?EFa$6#NCTgOa@rWVB;zP(|{cgR4% z<>KKBPtHtvvfzT-G=UrUD$*v!?@<2sUDz?{`}NOz<*$9a;TKz79Jl*i-M;eu_2FOZ z_CEjeYsIhqrkdwvEbG5j{;~OUCH?%I^)=}q5A)mq`2Z#^|6KWg!kgy>?IruW_P%>} z{oT&2x~cEXcfWhLJgYq809c*=`nwAm!5a4O`L@dX%)Hs}mcLptD=ln4IqfVV&o#_5}EoOFSsI7(3RW)CGL4DP4Z6u%yn!=zq|;^=@eyn#Nn}-}yP0?RIu9A{AF3m5DI5 zUj5-W18Si6zGu3`3=C{gxGUob^vt}J%;ePKcxd1!17paW5tv_a=OUm%U=u+!Ql3KB yh92V}#UO_;FmwYcJn@fi5V|kGWq+LK^!T void: + if event is InputEventMouseButton: + if event.button_index == MOUSE_BUTTON_LEFT and event.pressed and inventory.player.money >= cost: + dragging = true + Globals.mouse_dragging = true diff --git a/upgrade.gd.uid b/upgrade.gd.uid new file mode 100644 index 0000000..43cb6e7 --- /dev/null +++ b/upgrade.gd.uid @@ -0,0 +1 @@ +uid://cratbhruo2vb