added a bunch of shit, game works, but barely, i think im done
|
@ -13,7 +13,7 @@ dest_files=["res://.godot/imported/bulletinV1.ttf-012ce5be515230bcc15efcf69b5d91
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
Rendering=null
|
Rendering=null
|
||||||
antialiasing=1
|
antialiasing=0
|
||||||
generate_mipmaps=false
|
generate_mipmaps=false
|
||||||
disable_embedded_bitmaps=true
|
disable_embedded_bitmaps=true
|
||||||
multichannel_signed_distance_field=false
|
multichannel_signed_distance_field=false
|
||||||
|
@ -21,15 +21,20 @@ msdf_pixel_range=8
|
||||||
msdf_size=48
|
msdf_size=48
|
||||||
allow_system_fallback=true
|
allow_system_fallback=true
|
||||||
force_autohinter=false
|
force_autohinter=false
|
||||||
hinting=1
|
hinting=0
|
||||||
subpixel_positioning=4
|
subpixel_positioning=0
|
||||||
keep_rounding_remainders=true
|
keep_rounding_remainders=false
|
||||||
oversampling=0.0
|
oversampling=0.0
|
||||||
Fallbacks=null
|
Fallbacks=null
|
||||||
fallbacks=[]
|
fallbacks=[]
|
||||||
Compress=null
|
Compress=null
|
||||||
compress=true
|
compress=true
|
||||||
preload=[]
|
preload=[{
|
||||||
|
"chars": [],
|
||||||
|
"glyphs": [],
|
||||||
|
"name": "New Configuration",
|
||||||
|
"size": Vector2i(16, 0)
|
||||||
|
}]
|
||||||
language_support={}
|
language_support={}
|
||||||
script_support={}
|
script_support={}
|
||||||
opentype_features={}
|
opentype_features={}
|
||||||
|
|
|
@ -13,7 +13,7 @@ dest_files=["res://.godot/imported/joystix monospace.otf-b02854d0d16fd2029b5a896
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
Rendering=null
|
Rendering=null
|
||||||
antialiasing=1
|
antialiasing=0
|
||||||
generate_mipmaps=false
|
generate_mipmaps=false
|
||||||
disable_embedded_bitmaps=true
|
disable_embedded_bitmaps=true
|
||||||
multichannel_signed_distance_field=false
|
multichannel_signed_distance_field=false
|
||||||
|
@ -21,15 +21,20 @@ msdf_pixel_range=8
|
||||||
msdf_size=48
|
msdf_size=48
|
||||||
allow_system_fallback=true
|
allow_system_fallback=true
|
||||||
force_autohinter=false
|
force_autohinter=false
|
||||||
hinting=1
|
hinting=0
|
||||||
subpixel_positioning=4
|
subpixel_positioning=0
|
||||||
keep_rounding_remainders=true
|
keep_rounding_remainders=false
|
||||||
oversampling=0.0
|
oversampling=0.0
|
||||||
Fallbacks=null
|
Fallbacks=null
|
||||||
fallbacks=[]
|
fallbacks=[]
|
||||||
Compress=null
|
Compress=null
|
||||||
compress=true
|
compress=true
|
||||||
preload=[]
|
preload=[{
|
||||||
|
"chars": [],
|
||||||
|
"glyphs": [],
|
||||||
|
"name": "New Configuration",
|
||||||
|
"size": Vector2i(16, 0)
|
||||||
|
}]
|
||||||
language_support={}
|
language_support={}
|
||||||
script_support={}
|
script_support={}
|
||||||
opentype_features={}
|
opentype_features={}
|
||||||
|
|
|
@ -13,7 +13,7 @@ dest_files=["res://.godot/imported/pixelated.ttf-8108ecaf469dcb17762df1698b1a31d
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
Rendering=null
|
Rendering=null
|
||||||
antialiasing=1
|
antialiasing=0
|
||||||
generate_mipmaps=false
|
generate_mipmaps=false
|
||||||
disable_embedded_bitmaps=true
|
disable_embedded_bitmaps=true
|
||||||
multichannel_signed_distance_field=false
|
multichannel_signed_distance_field=false
|
||||||
|
@ -21,15 +21,20 @@ msdf_pixel_range=8
|
||||||
msdf_size=48
|
msdf_size=48
|
||||||
allow_system_fallback=true
|
allow_system_fallback=true
|
||||||
force_autohinter=false
|
force_autohinter=false
|
||||||
hinting=1
|
hinting=0
|
||||||
subpixel_positioning=4
|
subpixel_positioning=0
|
||||||
keep_rounding_remainders=true
|
keep_rounding_remainders=false
|
||||||
oversampling=0.0
|
oversampling=0.0
|
||||||
Fallbacks=null
|
Fallbacks=null
|
||||||
fallbacks=[]
|
fallbacks=[]
|
||||||
Compress=null
|
Compress=null
|
||||||
compress=true
|
compress=true
|
||||||
preload=[]
|
preload=[{
|
||||||
|
"chars": [],
|
||||||
|
"glyphs": [],
|
||||||
|
"name": "New Configuration",
|
||||||
|
"size": Vector2i(16, 0)
|
||||||
|
}]
|
||||||
language_support={}
|
language_support={}
|
||||||
script_support={}
|
script_support={}
|
||||||
opentype_features={}
|
opentype_features={}
|
||||||
|
|
7
globals.gd
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
enum Direction {UP,RIGHT,DOWN,LEFT}
|
||||||
|
|
||||||
|
var mouse_dragging = false
|
||||||
|
|
||||||
|
var score = 0
|
1
globals.gd.uid
Normal file
|
@ -0,0 +1 @@
|
||||||
|
uid://wv6h57d03ecn
|
|
@ -15,6 +15,10 @@ run/main_scene="uid://dinanmpmnja1"
|
||||||
config/features=PackedStringArray("4.4", "GL Compatibility")
|
config/features=PackedStringArray("4.4", "GL Compatibility")
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
[autoload]
|
||||||
|
|
||||||
|
Globals="*res://globals.gd"
|
||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
||||||
window/size/viewport_width=384
|
window/size/viewport_width=384
|
||||||
|
@ -24,6 +28,10 @@ window/stretch/mode="viewport"
|
||||||
[global_group]
|
[global_group]
|
||||||
|
|
||||||
damageable=""
|
damageable=""
|
||||||
|
terrain=""
|
||||||
|
player=""
|
||||||
|
enemy=""
|
||||||
|
upgrades=""
|
||||||
|
|
||||||
[input]
|
[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)
|
, 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]
|
[rendering]
|
||||||
|
|
||||||
textures/canvas_textures/default_texture_filter=0
|
textures/canvas_textures/default_texture_filter=0
|
||||||
renderer/rendering_method="gl_compatibility"
|
renderer/rendering_method="gl_compatibility"
|
||||||
renderer/rendering_method.mobile="gl_compatibility"
|
renderer/rendering_method.mobile="gl_compatibility"
|
||||||
environment/defaults/default_clear_color=Color(0.639216, 0.635294, 0.603922, 1)
|
|
||||||
|
|
|
@ -9,6 +9,10 @@ var hostile = false
|
||||||
|
|
||||||
@onready var polygon = $Polygon2D
|
@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:
|
func _physics_process(delta: float) -> void:
|
||||||
position += speed*delta*base_speed*direction
|
position += speed*delta*base_speed*direction
|
||||||
|
|
||||||
|
@ -17,7 +21,13 @@ func _physics_process(delta: float) -> void:
|
||||||
|
|
||||||
|
|
||||||
func _on_body_entered(body: Node2D) -> 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)
|
damage = body.damage(damage)
|
||||||
if damage <= 0:
|
if damage <= 0:
|
||||||
queue_free()
|
queue_free()
|
||||||
|
elif body.is_in_group("terrain"):
|
||||||
|
queue_free()
|
||||||
|
|
|
@ -1,28 +1,53 @@
|
||||||
extends Node2D
|
extends CharacterBody2D
|
||||||
|
|
||||||
var speed = 10
|
class_name Enemy
|
||||||
|
|
||||||
var health = 30
|
@export var speed = 1000
|
||||||
var total_health = 30
|
|
||||||
|
|
||||||
var dead = false
|
@export var value = 10
|
||||||
|
|
||||||
|
var health = 0
|
||||||
|
@export var total_health := 30
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@export var difficulty := 1
|
||||||
|
|
||||||
@export var player : CharacterBody2D
|
@export var player : CharacterBody2D
|
||||||
|
|
||||||
@onready var navigation : NavigationAgent2D = $NavigationAgent2D
|
@onready var navigation : NavigationAgent2D = $NavigationAgent2D
|
||||||
@onready var health_bar : ProgressBar = $HealthBar
|
@onready var health_bar : ProgressBar = $HealthBar
|
||||||
|
|
||||||
|
@onready var particles : CPUParticles2D = $CPUParticles2D
|
||||||
|
|
||||||
|
func _init():
|
||||||
|
health = total_health
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
|
|
||||||
health_bar.value = (float(health)/total_health)*100
|
health_bar.value = (float(health)/total_health)*100
|
||||||
navigation.target_position = player.position
|
navigation.target_position = player.position
|
||||||
position = position.move_toward(navigation.get_next_path_position(), delta*speed)
|
if not navigation.is_navigation_finished():
|
||||||
if dead:
|
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()
|
queue_free()
|
||||||
|
move_and_slide()
|
||||||
|
|
||||||
func damage(damage : int):
|
func damage(damage : int):
|
||||||
|
particles.emitting = true
|
||||||
health -= damage
|
health -= damage
|
||||||
if health <= 0:
|
if health <= 0:
|
||||||
dead = true
|
|
||||||
return -health
|
return -health
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
func _on_navigation_agent_2d_velocity_computed(safe_velocity: Vector2) -> void:
|
||||||
|
velocity = safe_velocity
|
||||||
|
|
||||||
|
|
14
scenes/enemies/grunt/attack.gd
Normal file
|
@ -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()
|
1
scenes/enemies/grunt/attack.gd.uid
Normal file
|
@ -0,0 +1 @@
|
||||||
|
uid://bdfcm448qt5uh
|
Before Width: | Height: | Size: 341 B After Width: | Height: | Size: 244 B |
|
@ -1,11 +1,14 @@
|
||||||
[gd_scene load_steps=7 format=3 uid="uid://bnufqnypubedj"]
|
[gd_scene load_steps=9 format=3 uid="uid://bnufqnypubedj"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://do2o6v238umse" path="res://scenes/enemies/enemy.gd" id="1_y73h6"]
|
[ext_resource type="Script" uid="uid://do2o6v238umse" path="res://scenes/enemies/enemy.gd" id="1_y73h6"]
|
||||||
[ext_resource type="Texture2D" uid="uid://nj5tjjv0a6v8" path="res://scenes/enemies/grunt/grunt.png" id="2_668pk"]
|
[ext_resource type="Texture2D" uid="uid://nj5tjjv0a6v8" path="res://scenes/enemies/grunt/grunt.png" id="2_668pk"]
|
||||||
|
[ext_resource type="Script" uid="uid://bdfcm448qt5uh" path="res://scenes/enemies/grunt/attack.gd" id="3_668pk"]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_cahuy"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_cahuy"]
|
||||||
|
radius = 7.07107
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_y73h6"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_y73h6"]
|
||||||
|
bg_color = Color(0.639216, 0.635294, 0.603922, 0)
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_668pk"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_668pk"]
|
||||||
bg_color = Color(0.772549, 0.411765, 0.505882, 1)
|
bg_color = Color(0.772549, 0.411765, 0.505882, 1)
|
||||||
|
@ -14,12 +17,17 @@ bg_color = Color(0.772549, 0.411765, 0.505882, 1)
|
||||||
ProgressBar/styles/background = SubResource("StyleBoxFlat_y73h6")
|
ProgressBar/styles/background = SubResource("StyleBoxFlat_y73h6")
|
||||||
ProgressBar/styles/fill = SubResource("StyleBoxFlat_668pk")
|
ProgressBar/styles/fill = SubResource("StyleBoxFlat_668pk")
|
||||||
|
|
||||||
[node name="Grunt" type="AnimatableBody2D" groups=["damageable"]]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_y73h6"]
|
||||||
|
radius = 12.0
|
||||||
|
|
||||||
|
[node name="Grunt" type="CharacterBody2D" groups=["damageable", "enemy"]]
|
||||||
|
motion_mode = 1
|
||||||
script = ExtResource("1_y73h6")
|
script = ExtResource("1_y73h6")
|
||||||
|
|
||||||
[node name="NavigationAgent2D" type="NavigationAgent2D" parent="."]
|
[node name="NavigationAgent2D" type="NavigationAgent2D" parent="."]
|
||||||
|
path_postprocessing = 1
|
||||||
avoidance_enabled = true
|
avoidance_enabled = true
|
||||||
max_speed = 50.0
|
max_speed = 20.0
|
||||||
|
|
||||||
[node name="Grunt" type="Sprite2D" parent="."]
|
[node name="Grunt" type="Sprite2D" parent="."]
|
||||||
texture = ExtResource("2_668pk")
|
texture = ExtResource("2_668pk")
|
||||||
|
@ -27,10 +35,6 @@ texture = ExtResource("2_668pk")
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
shape = SubResource("CircleShape2D_cahuy")
|
shape = SubResource("CircleShape2D_cahuy")
|
||||||
|
|
||||||
[node name="NavigationObstacle2D" type="NavigationObstacle2D" parent="."]
|
|
||||||
radius = 10.0
|
|
||||||
avoidance_enabled = false
|
|
||||||
|
|
||||||
[node name="HealthBar" type="ProgressBar" parent="."]
|
[node name="HealthBar" type="ProgressBar" parent="."]
|
||||||
offset_left = -10.0
|
offset_left = -10.0
|
||||||
offset_top = -17.0
|
offset_top = -17.0
|
||||||
|
@ -39,3 +43,28 @@ offset_bottom = -15.0
|
||||||
theme = SubResource("Theme_cahuy")
|
theme = SubResource("Theme_cahuy")
|
||||||
value = 100.0
|
value = 100.0
|
||||||
show_percentage = false
|
show_percentage = false
|
||||||
|
|
||||||
|
[node name="NavigationObstacle2D" type="NavigationObstacle2D" parent="."]
|
||||||
|
vertices = PackedVector2Array(0, -7, 5, -5, 7, 0, 5, 5, 0, 7, -5, 5, -7, 0, -5, -5)
|
||||||
|
avoidance_enabled = false
|
||||||
|
|
||||||
|
[node name="Attack" type="Area2D" parent="."]
|
||||||
|
script = ExtResource("3_668pk")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Attack"]
|
||||||
|
shape = SubResource("CircleShape2D_y73h6")
|
||||||
|
|
||||||
|
[node name="CPUParticles2D" type="CPUParticles2D" parent="."]
|
||||||
|
emitting = false
|
||||||
|
lifetime = 0.16
|
||||||
|
one_shot = true
|
||||||
|
explosiveness = 1.0
|
||||||
|
spread = 180.0
|
||||||
|
gravity = Vector2(0, 0)
|
||||||
|
initial_velocity_min = 104.4
|
||||||
|
initial_velocity_max = 104.4
|
||||||
|
damping_min = 100.0
|
||||||
|
damping_max = 100.0
|
||||||
|
color = Color(0.772549, 0.411765, 0.505882, 1)
|
||||||
|
|
||||||
|
[connection signal="velocity_computed" from="NavigationAgent2D" to="." method="_on_navigation_agent_2d_velocity_computed"]
|
||||||
|
|
20
scenes/enemies/shooter/gun.gd
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
extends RayCast2D
|
||||||
|
|
||||||
|
@onready var carrier = get_parent()
|
||||||
|
@export var attack_cooldown : float = 1
|
||||||
|
@export var bullet_scene : PackedScene
|
||||||
|
var attack_timer = 0
|
||||||
|
|
||||||
|
func _process(delta: float) -> 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
|
||||||
|
|
1
scenes/enemies/shooter/gun.gd.uid
Normal file
|
@ -0,0 +1 @@
|
||||||
|
uid://cwasbbull03i8
|
BIN
scenes/enemies/shooter/shooter.png
Normal file
After Width: | Height: | Size: 244 B |
34
scenes/enemies/shooter/shooter.png.import
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://c7fka8ygr5xfq"
|
||||||
|
path="res://.godot/imported/shooter.png-6d734d2019013d45497c35334fed4769.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://scenes/enemies/shooter/shooter.png"
|
||||||
|
dest_files=["res://.godot/imported/shooter.png-6d734d2019013d45497c35334fed4769.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
|
72
scenes/enemies/shooter/shooter.tscn
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
[gd_scene load_steps=9 format=3 uid="uid://b6lmouoh2607b"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://do2o6v238umse" path="res://scenes/enemies/enemy.gd" id="1_3kmpx"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://c7fka8ygr5xfq" path="res://scenes/enemies/shooter/shooter.png" id="2_d8kji"]
|
||||||
|
[ext_resource type="Script" uid="uid://cwasbbull03i8" path="res://scenes/enemies/shooter/gun.gd" id="3_d8kji"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dpdt7rbma7ugn" path="res://scenes/bullet/bullet.tscn" id="4_0as4b"]
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_cahuy"]
|
||||||
|
radius = 7.07107
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_y73h6"]
|
||||||
|
bg_color = Color(0.639216, 0.635294, 0.603922, 0)
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_668pk"]
|
||||||
|
bg_color = Color(0.772549, 0.411765, 0.505882, 1)
|
||||||
|
|
||||||
|
[sub_resource type="Theme" id="Theme_cahuy"]
|
||||||
|
ProgressBar/styles/background = SubResource("StyleBoxFlat_y73h6")
|
||||||
|
ProgressBar/styles/fill = SubResource("StyleBoxFlat_668pk")
|
||||||
|
|
||||||
|
[node name="Shooter" type="CharacterBody2D" groups=["damageable", "enemy"]]
|
||||||
|
motion_mode = 1
|
||||||
|
script = ExtResource("1_3kmpx")
|
||||||
|
speed = 800
|
||||||
|
value = 15
|
||||||
|
total_health = 20
|
||||||
|
difficulty = 5
|
||||||
|
|
||||||
|
[node name="NavigationAgent2D" type="NavigationAgent2D" parent="."]
|
||||||
|
target_desired_distance = 60.0
|
||||||
|
path_postprocessing = 1
|
||||||
|
avoidance_enabled = true
|
||||||
|
max_speed = 20.0
|
||||||
|
|
||||||
|
[node name="Grunt" type="Sprite2D" parent="."]
|
||||||
|
texture = ExtResource("2_d8kji")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("CircleShape2D_cahuy")
|
||||||
|
|
||||||
|
[node name="HealthBar" type="ProgressBar" parent="."]
|
||||||
|
offset_left = -10.0
|
||||||
|
offset_top = -17.0
|
||||||
|
offset_right = 11.0
|
||||||
|
offset_bottom = -15.0
|
||||||
|
theme = SubResource("Theme_cahuy")
|
||||||
|
value = 100.0
|
||||||
|
show_percentage = false
|
||||||
|
|
||||||
|
[node name="NavigationObstacle2D" type="NavigationObstacle2D" parent="."]
|
||||||
|
vertices = PackedVector2Array(0, -7, 5, -5, 7, 0, 5, 5, 0, 7, -5, 5, -7, 0, -5, -5)
|
||||||
|
avoidance_enabled = false
|
||||||
|
|
||||||
|
[node name="CPUParticles2D" type="CPUParticles2D" parent="."]
|
||||||
|
emitting = false
|
||||||
|
lifetime = 0.16
|
||||||
|
one_shot = true
|
||||||
|
explosiveness = 1.0
|
||||||
|
spread = 180.0
|
||||||
|
gravity = Vector2(0, 0)
|
||||||
|
initial_velocity_min = 104.4
|
||||||
|
initial_velocity_max = 104.4
|
||||||
|
damping_min = 100.0
|
||||||
|
damping_max = 100.0
|
||||||
|
color = Color(0.329412, 0.360784, 0.494118, 1)
|
||||||
|
|
||||||
|
[node name="Gun" type="RayCast2D" parent="."]
|
||||||
|
collision_mask = 4
|
||||||
|
script = ExtResource("3_d8kji")
|
||||||
|
bullet_scene = ExtResource("4_0as4b")
|
||||||
|
|
||||||
|
[connection signal="velocity_computed" from="NavigationAgent2D" to="." method="_on_navigation_agent_2d_velocity_computed"]
|
9
scenes/game_over.gd
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
extends Node2D
|
||||||
|
|
||||||
|
var go_to_scene = "res://scenes/world/world.tscn"
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
$Score.text = "Score: " + str(Globals.score)
|
||||||
|
|
||||||
|
func _on_button_pressed() -> void:
|
||||||
|
get_tree().change_scene_to_file(go_to_scene)
|
1
scenes/game_over.gd.uid
Normal file
|
@ -0,0 +1 @@
|
||||||
|
uid://ctox3n7f4j8wu
|
85
scenes/game_over.tscn
Normal file
|
@ -10,13 +10,21 @@ var items : Array[Array]
|
||||||
@onready var money = $Money
|
@onready var money = $Money
|
||||||
@onready var score = $Score
|
@onready var score = $Score
|
||||||
|
|
||||||
|
@export var levels : Node2D
|
||||||
|
|
||||||
|
var x_swaps = 0
|
||||||
|
|
||||||
var item_offset : int = 26
|
var item_offset : int = 26
|
||||||
|
|
||||||
|
var in_shop = false
|
||||||
|
|
||||||
@export var bonus_scene : PackedScene
|
@export var bonus_scene : PackedScene
|
||||||
|
|
||||||
@export var item_scene : PackedScene
|
@export var item_scene : PackedScene
|
||||||
@export var items_start : Node2D
|
@export var items_start : Node2D
|
||||||
|
|
||||||
|
@onready var lock : Sprite2D = $Lock
|
||||||
|
|
||||||
@export var player : CharacterBody2D
|
@export var player : CharacterBody2D
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
|
@ -90,6 +98,7 @@ func update_calculations():
|
||||||
3:
|
3:
|
||||||
player.tax = total
|
player.tax = total
|
||||||
negative_modifiers[x].text = '=' + str(total)
|
negative_modifiers[x].text = '=' + str(total)
|
||||||
|
|
||||||
func update_stats():
|
func update_stats():
|
||||||
remaining_ammunition.text = '- ' + str(player.remaining_bullets)
|
remaining_ammunition.text = '- ' + str(player.remaining_bullets)
|
||||||
health.text = '- ' + str(player.health)
|
health.text = '- ' + str(player.health)
|
||||||
|
@ -118,14 +127,19 @@ func global_to_inventory_coords(position : Vector2):
|
||||||
|
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
pass
|
if in_shop:
|
||||||
|
lock.frame = 1
|
||||||
|
else:
|
||||||
|
lock.frame = 0
|
||||||
|
|
||||||
func _input(event):
|
func _input(event):
|
||||||
if event is InputEventMouseButton:
|
if event is InputEventMouseButton:
|
||||||
var layer = 0
|
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):
|
if(event.button_index == MOUSE_BUTTON_RIGHT):
|
||||||
layer = 1
|
layer = 1
|
||||||
|
if x_swaps <= 0:
|
||||||
|
return
|
||||||
var inventory_position = global_to_inventory_coords(event.position)
|
var inventory_position = global_to_inventory_coords(event.position)
|
||||||
if inventory_position != null and items[layer][inventory_position.y][inventory_position.x] != null:
|
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].dragging = true
|
||||||
|
|
|
@ -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="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="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="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="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="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"]
|
[sub_resource type="LabelSettings" id="LabelSettings_bxceu"]
|
||||||
font = ExtResource("4_tvok8")
|
font = ExtResource("4_tvok8")
|
||||||
|
@ -36,6 +40,51 @@ font = ExtResource("4_tvok8")
|
||||||
font_size = 8
|
font_size = 8
|
||||||
font_color = Color(0.329412, 0.360784, 0.494118, 1)
|
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")]
|
[node name="Inventory" type="Control" node_paths=PackedStringArray("items_start")]
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
anchors_preset = 6
|
anchors_preset = 6
|
||||||
|
@ -57,6 +106,11 @@ position = Vector2(-64, 0)
|
||||||
texture = ExtResource("4_bxceu")
|
texture = ExtResource("4_bxceu")
|
||||||
region_rect = Rect2(0, 0, 134, 256)
|
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="."]
|
[node name="InventoryStart" type="Marker2D" parent="."]
|
||||||
position = Vector2(-110, -111)
|
position = Vector2(-110, -111)
|
||||||
|
|
||||||
|
@ -68,6 +122,10 @@ offset_bottom = -99.0
|
||||||
text = "=10"
|
text = "=10"
|
||||||
label_settings = SubResource("LabelSettings_bxceu")
|
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="."]
|
[node name="RemainingAmmunition" type="Label" parent="."]
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
offset_left = -105.0
|
offset_left = -105.0
|
||||||
|
@ -92,7 +150,7 @@ offset_left = -105.0
|
||||||
offset_top = 48.0
|
offset_top = 48.0
|
||||||
offset_right = -85.0
|
offset_right = -85.0
|
||||||
offset_bottom = 71.0
|
offset_bottom = 71.0
|
||||||
text = "- 0"
|
text = "- 100"
|
||||||
label_settings = SubResource("LabelSettings_l6cit")
|
label_settings = SubResource("LabelSettings_l6cit")
|
||||||
|
|
||||||
[node name="Score" type="Label" parent="."]
|
[node name="Score" type="Label" parent="."]
|
||||||
|
@ -113,6 +171,10 @@ offset_bottom = -87.0
|
||||||
text = "=10"
|
text = "=10"
|
||||||
label_settings = SubResource("LabelSettings_bxceu")
|
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="."]
|
[node name="Ammunition" type="Label" parent="."]
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
offset_left = -20.0
|
offset_left = -20.0
|
||||||
|
@ -121,6 +183,10 @@ offset_bottom = -47.0
|
||||||
text = "=10"
|
text = "=10"
|
||||||
label_settings = SubResource("LabelSettings_bxceu")
|
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="."]
|
[node name="Damage" type="Label" parent="."]
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
offset_left = -20.0
|
offset_left = -20.0
|
||||||
|
@ -129,6 +195,10 @@ offset_bottom = -21.0
|
||||||
text = "=10"
|
text = "=10"
|
||||||
label_settings = SubResource("LabelSettings_bxceu")
|
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="."]
|
[node name="Size" type="Label" parent="."]
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
offset_left = -71.0
|
offset_left = -71.0
|
||||||
|
@ -139,6 +209,10 @@ text = "=10"
|
||||||
label_settings = SubResource("LabelSettings_v8e04")
|
label_settings = SubResource("LabelSettings_v8e04")
|
||||||
horizontal_alignment = 1
|
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="."]
|
[node name="TaxRate" type="Label" parent="."]
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
offset_left = -46.0
|
offset_left = -46.0
|
||||||
|
@ -149,6 +223,10 @@ text = "=10"
|
||||||
label_settings = SubResource("LabelSettings_v8e04")
|
label_settings = SubResource("LabelSettings_v8e04")
|
||||||
horizontal_alignment = 1
|
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="."]
|
[node name="FiringDelay" type="Label" parent="."]
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
offset_left = -98.0
|
offset_left = -98.0
|
||||||
|
@ -159,6 +237,10 @@ text = "=10"
|
||||||
label_settings = SubResource("LabelSettings_v8e04")
|
label_settings = SubResource("LabelSettings_v8e04")
|
||||||
horizontal_alignment = 1
|
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="."]
|
[node name="IncomingDamage" type="Label" parent="."]
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
offset_left = -124.0
|
offset_left = -124.0
|
||||||
|
@ -168,3 +250,49 @@ offset_bottom = 6.0
|
||||||
text = "=10"
|
text = "=10"
|
||||||
label_settings = SubResource("LabelSettings_v8e04")
|
label_settings = SubResource("LabelSettings_v8e04")
|
||||||
horizontal_alignment = 1
|
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"]
|
||||||
|
|
BIN
scenes/inventory/lock.png
Normal file
After Width: | Height: | Size: 192 B |
34
scenes/inventory/lock.png.import
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://c8ptw6uydekn8"
|
||||||
|
path="res://.godot/imported/lock.png-740d6b4da3e23cd5b4cc36ef9cd0e2df.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://scenes/inventory/lock.png"
|
||||||
|
dest_files=["res://.godot/imported/lock.png-740d6b4da3e23cd5b4cc36ef9cd0e2df.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
|
32
scenes/inventory/tooltip/tooltip.gd
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
extends Area2D
|
||||||
|
|
||||||
|
var mouse_hovering = false
|
||||||
|
|
||||||
|
@export var tooltip_text : String
|
||||||
|
|
||||||
|
@onready var panel = $PanelContainer
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
$PanelContainer/Label.text = tooltip_text
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
if mouse_hovering:
|
||||||
|
panel.show()
|
||||||
|
if panel.global_position.x + panel.size.x > 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
|
1
scenes/inventory/tooltip/tooltip.gd.uid
Normal file
|
@ -0,0 +1 @@
|
||||||
|
uid://csb4bby01d4ph
|
48
scenes/inventory/tooltip/tooltip.tscn
Normal file
|
@ -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"]
|
63
scenes/inventory/tutorial_text.gd
Normal file
|
@ -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
|
1
scenes/inventory/tutorial_text.gd.uid
Normal file
|
@ -0,0 +1 @@
|
||||||
|
uid://ca6rno5o2qeus
|
37
scenes/inventory/upgrades/upgrade.tscn
Normal file
|
@ -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"]
|
BIN
scenes/inventory/upgrades/upgrades.png
Normal file
After Width: | Height: | Size: 178 B |
34
scenes/inventory/upgrades/upgrades.png.import
Normal file
|
@ -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
|
BIN
scenes/inventory/upgrades/upgrades.pxo
Normal file
|
@ -1,7 +1,11 @@
|
||||||
extends CharacterBody2D
|
extends CharacterBody2D
|
||||||
|
|
||||||
|
class_name Player
|
||||||
|
|
||||||
var base_speed = 100
|
var base_speed = 100
|
||||||
|
|
||||||
|
var death_scene = "res://scenes/game_over.tscn"
|
||||||
|
|
||||||
var speed
|
var speed
|
||||||
var bullet_speed
|
var bullet_speed
|
||||||
var ammunition
|
var ammunition
|
||||||
|
@ -18,7 +22,7 @@ var remaining_bullets = 7
|
||||||
|
|
||||||
var health = 100
|
var health = 100
|
||||||
|
|
||||||
var money = 0
|
var money = 100
|
||||||
|
|
||||||
var score = 0
|
var score = 0
|
||||||
|
|
||||||
|
@ -34,6 +38,9 @@ var bullet_timer = 0
|
||||||
@export var bullet_scene : PackedScene
|
@export var bullet_scene : PackedScene
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
|
if health < 0:
|
||||||
|
Globals.score = score
|
||||||
|
get_tree().change_scene_to_file(death_scene)
|
||||||
bullet_timer -= delta
|
bullet_timer -= delta
|
||||||
velocity = Vector2(0,0)
|
velocity = Vector2(0,0)
|
||||||
if Input.is_action_pressed("left"):
|
if Input.is_action_pressed("left"):
|
||||||
|
@ -45,7 +52,10 @@ func _physics_process(delta):
|
||||||
if Input.is_action_pressed("down"):
|
if Input.is_action_pressed("down"):
|
||||||
velocity.y += 1
|
velocity.y += 1
|
||||||
|
|
||||||
if Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT):
|
if Input.is_action_just_pressed("reload"):
|
||||||
|
reload()
|
||||||
|
|
||||||
|
if Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT) and get_global_mouse_position().x < 256 and Globals.mouse_dragging == false:
|
||||||
spawn_bullet()
|
spawn_bullet()
|
||||||
|
|
||||||
velocity = velocity.normalized() * speed*base_speed*delta
|
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))
|
collision.scale = Vector2(0.3,0.3)*(pow(size,0.2))
|
||||||
|
|
||||||
if bullet_timer < 0 and reloading:
|
if bullet_timer < 0 and reloading:
|
||||||
remaining_bullets += 1
|
if remaining_bullets < ammunition:
|
||||||
|
remaining_bullets += 1
|
||||||
bullet_timer = reload_speed
|
bullet_timer = reload_speed
|
||||||
if remaining_bullets >= ammunition:
|
if remaining_bullets >= ammunition:
|
||||||
reloading = false
|
reloading = false
|
||||||
|
@ -66,6 +77,9 @@ func _physics_process(delta):
|
||||||
func reload():
|
func reload():
|
||||||
reloading = true
|
reloading = true
|
||||||
|
|
||||||
|
func inflict_damage():
|
||||||
|
health -= incoming_damage
|
||||||
|
inventory.update_stats()
|
||||||
|
|
||||||
func spawn_bullet():
|
func spawn_bullet():
|
||||||
if bullet_timer > 0 or reloading: return
|
if bullet_timer > 0 or reloading: return
|
||||||
|
|
|
@ -7,7 +7,9 @@
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_dovo2"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_dovo2"]
|
||||||
radius = 13.0
|
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
|
motion_mode = 1
|
||||||
script = ExtResource("1_dovo2")
|
script = ExtResource("1_dovo2")
|
||||||
bullet_scene = ExtResource("2_gmlin")
|
bullet_scene = ExtResource("2_gmlin")
|
||||||
|
|
BIN
scenes/world/blocked.png
Normal file
After Width: | Height: | Size: 180 B |
34
scenes/world/blocked.png.import
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://bobe81o0a80s1"
|
||||||
|
path="res://.godot/imported/blocked.png-651eb5de53223053b640e89f3d952ae3.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://scenes/world/blocked.png"
|
||||||
|
dest_files=["res://.godot/imported/blocked.png-651eb5de53223053b640e89f3d952ae3.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
|
146
scenes/world/level.gd
Normal file
|
@ -0,0 +1,146 @@
|
||||||
|
extends Node2D
|
||||||
|
|
||||||
|
class_name Level
|
||||||
|
|
||||||
|
class Spawn:
|
||||||
|
var delay : float
|
||||||
|
var enemy : Enemy
|
||||||
|
func _init(delay : float, enemy : Enemy):
|
||||||
|
self.delay = delay
|
||||||
|
self.enemy = enemy
|
||||||
|
|
||||||
|
@export var spawn_points : Array[Marker2D]
|
||||||
|
@export var levels : Array[TileMapLayer]
|
||||||
|
@export var enemies : Array[PackedScene]
|
||||||
|
|
||||||
|
@onready var areas = [$Top,$Right,$Bottom,$Left]
|
||||||
|
|
||||||
|
@onready var borders = [$"World Border/Top",$"World Border/Right",$"World Border/Bottom",$"World Border/Left"]
|
||||||
|
|
||||||
|
@export var player : CharacterBody2D
|
||||||
|
|
||||||
|
@onready var shop = $Shop
|
||||||
|
|
||||||
|
var difficulty = 4
|
||||||
|
|
||||||
|
var levels_until_shop = 1
|
||||||
|
|
||||||
|
var last_direction = null
|
||||||
|
|
||||||
|
var enemies_alive = true
|
||||||
|
|
||||||
|
func _ready() -> 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)
|
||||||
|
|
1
scenes/world/level.gd.uid
Normal file
|
@ -0,0 +1 @@
|
||||||
|
uid://c75kdxk3eemei
|
38
scenes/world/shop.gd
Normal file
|
@ -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)
|
1
scenes/world/shop.gd.uid
Normal file
|
@ -0,0 +1 @@
|
||||||
|
uid://dl3s53elpx43k
|
21
scenes/world/shop.tscn
Normal file
37
scenes/world/spawner.gd
Normal file
|
@ -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
|
||||||
|
|
1
scenes/world/spawner.gd.uid
Normal file
|
@ -0,0 +1 @@
|
||||||
|
uid://c2lpqem5ubn4r
|
119
scenes/world/tilemap/tile_map.tres
Normal file
|
@ -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")
|
BIN
scenes/world/tilemap/tilemap.png
Normal file
After Width: | Height: | Size: 474 B |
34
scenes/world/tilemap/tilemap.png.import
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://fi7000wjcmkt"
|
||||||
|
path="res://.godot/imported/tilemap.png-92e6ed1179a7af7b48568bdbdb705400.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://scenes/world/tilemap/tilemap.png"
|
||||||
|
dest_files=["res://.godot/imported/tilemap.png-92e6ed1179a7af7b48568bdbdb705400.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
|
BIN
scenes/world/tilemap/tilemap.pxo
Normal file
BIN
scenes/world/tilemap/tilemapcornerless.pxo
Normal file
57
upgrade.gd
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
extends Area2D
|
||||||
|
|
||||||
|
class_name Upgrade
|
||||||
|
|
||||||
|
@export var inventory : Control
|
||||||
|
|
||||||
|
@onready var sprite = $CanvasLayer/Sprite2D
|
||||||
|
|
||||||
|
var dragging = false
|
||||||
|
|
||||||
|
var last_position
|
||||||
|
|
||||||
|
var layer = 0
|
||||||
|
|
||||||
|
var cost = 100
|
||||||
|
|
||||||
|
enum UpgradeTypes{PLUS,MINUS}
|
||||||
|
var upgrade : UpgradeTypes = UpgradeTypes.PLUS
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
|
||||||
|
sprite.global_position = global_position
|
||||||
|
last_position = sprite.position
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
if not dragging: return
|
||||||
|
sprite.global_position = get_global_mouse_position()
|
||||||
|
|
||||||
|
|
||||||
|
func _input(event):
|
||||||
|
if event is InputEventMouseButton:
|
||||||
|
if event.button_index == MOUSE_BUTTON_LEFT and not event.pressed:
|
||||||
|
inventory.call_deferred("update_calculations")
|
||||||
|
dragging = false
|
||||||
|
Globals.mouse_dragging = false
|
||||||
|
var inventory_position = inventory.global_to_inventory_coords(sprite.global_position)
|
||||||
|
if inventory_position != null:
|
||||||
|
inventory.player.money -= cost
|
||||||
|
match upgrade:
|
||||||
|
UpgradeTypes.PLUS:
|
||||||
|
add_value(inventory_position)
|
||||||
|
|
||||||
|
inventory.update_stats()
|
||||||
|
queue_free()
|
||||||
|
else:
|
||||||
|
sprite.position = last_position
|
||||||
|
|
||||||
|
|
||||||
|
func add_value(inventory_position : Vector2i):
|
||||||
|
inventory.items[0][inventory_position.y][inventory_position.x].set_value(inventory.items[0][inventory_position.y][inventory_position.x]._value+1)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_input_event(viewport: Node, event: InputEvent, shape_idx: int) -> 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
|
1
upgrade.gd.uid
Normal file
|
@ -0,0 +1 @@
|
||||||
|
uid://cratbhruo2vb
|