Bombs game ending, and debugging.
This commit is contained in:
BIN
Assets/Traps/Mine/49.png
Normal file
BIN
Assets/Traps/Mine/49.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
34
Assets/Traps/Mine/49.png.import
Normal file
34
Assets/Traps/Mine/49.png.import
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dn22pudsmyrrg"
|
||||||
|
path="res://.godot/imported/49.png-9f286fae1b269b6439fe04a6433109bb.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Assets/Traps/Mine/49.png"
|
||||||
|
dest_files=["res://.godot/imported/49.png-9f286fae1b269b6439fe04a6433109bb.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
Assets/Traps/Mine/54.png
Normal file
BIN
Assets/Traps/Mine/54.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
34
Assets/Traps/Mine/54.png.import
Normal file
34
Assets/Traps/Mine/54.png.import
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://sb3dotm5napj"
|
||||||
|
path="res://.godot/imported/54.png-c39b6232e9a5800056e940740f3c68c8.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Assets/Traps/Mine/54.png"
|
||||||
|
dest_files=["res://.godot/imported/54.png-c39b6232e9a5800056e940740f3c68c8.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
Assets/Traps/Mine/55.png
Normal file
BIN
Assets/Traps/Mine/55.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.1 KiB |
34
Assets/Traps/Mine/55.png.import
Normal file
34
Assets/Traps/Mine/55.png.import
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://by0c26bla5hce"
|
||||||
|
path="res://.godot/imported/55.png-8fa0ef2c7e91afba070877ff7f61c4f4.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Assets/Traps/Mine/55.png"
|
||||||
|
dest_files=["res://.godot/imported/55.png-8fa0ef2c7e91afba070877ff7f61c4f4.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
Assets/Traps/Mine/56.png
Normal file
BIN
Assets/Traps/Mine/56.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.0 KiB |
34
Assets/Traps/Mine/56.png.import
Normal file
34
Assets/Traps/Mine/56.png.import
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://cspjuelhbbavu"
|
||||||
|
path="res://.godot/imported/56.png-9cad383dff8247b0648b1c73f3490744.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Assets/Traps/Mine/56.png"
|
||||||
|
dest_files=["res://.godot/imported/56.png-9cad383dff8247b0648b1c73f3490744.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
|
@ -8,7 +8,7 @@ const COBOLD = preload("res://Game/Mobs/cobold.tscn")
|
|||||||
|
|
||||||
const enemies = [FORKMAN, COBOLD, ORK]
|
const enemies = [FORKMAN, COBOLD, ORK]
|
||||||
|
|
||||||
var lives = 20
|
var lives = 2
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
get_node("SidePanel").Update_Lives(lives)
|
get_node("SidePanel").Update_Lives(lives)
|
||||||
@ -28,5 +28,12 @@ func decrease_life(damage) -> void:
|
|||||||
lives -= damage
|
lives -= damage
|
||||||
get_node("SidePanel").Update_Lives(lives)
|
get_node("SidePanel").Update_Lives(lives)
|
||||||
if lives == 0:
|
if lives == 0:
|
||||||
print("DEAD")
|
game_over()
|
||||||
|
|
||||||
|
func game_over()-> void:
|
||||||
|
get_node("Timer").stop()
|
||||||
|
var enemy = get_node("Path2D").get_children()
|
||||||
|
for i in enemy:
|
||||||
|
i.get_children()[0].set_process(false)
|
||||||
|
i.get_children()[0].name
|
||||||
|
|
||||||
|
@ -8,7 +8,9 @@ var damage = 0
|
|||||||
var current_health = 0
|
var current_health = 0
|
||||||
var current_shield = 0
|
var current_shield = 0
|
||||||
|
|
||||||
var last_position: Vector2 = Vector2.ZERO # To store the previous position
|
var last_position: Vector2 = Vector2.ZERO # for previous position
|
||||||
|
|
||||||
|
static var NAMES = ["Forkman", "Cobold", "Ork"]
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
last_position = get_parent().position
|
last_position = get_parent().position
|
||||||
@ -119,5 +121,14 @@ func AnimatedSprite2D_animation_finished() -> void:
|
|||||||
|
|
||||||
func Collision_Handler(body: Node2D):
|
func Collision_Handler(body: Node2D):
|
||||||
if body.get_parent().name.contains("StickTrap"):
|
if body.get_parent().name.contains("StickTrap"):
|
||||||
|
if not body.get_parent().get_if_moving_state():
|
||||||
enemy_hurt(25)
|
enemy_hurt(25)
|
||||||
get_node("CharacterBody2D/AnimatedSprite2D").play("hurt")
|
get_node("CharacterBody2D/AnimatedSprite2D").play("hurt")
|
||||||
|
if body.get_parent().name.contains("Mine"):
|
||||||
|
if not body.get_parent().get_if_moving_state():
|
||||||
|
var surrounding_enemies = body.get_node("Area2D").get_overlapping_bodies()
|
||||||
|
for i in surrounding_enemies:
|
||||||
|
if i. get_parent().name in NAMES:
|
||||||
|
enemy_hurt(100)
|
||||||
|
body.get_parent().Explode_Mine()
|
||||||
|
|
||||||
|
58
Game/Traps/mine.tscn
Normal file
58
Game/Traps/mine.tscn
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
[gd_scene load_steps=9 format=3 uid="uid://ctbmgsp8dfel3"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://3gn70ilm20tw" path="res://Game/Traps/traps.gd" id="1_6fgim"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dn22pudsmyrrg" path="res://Assets/Traps/Mine/49.png" id="2_6m2fs"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://sb3dotm5napj" path="res://Assets/Traps/Mine/54.png" id="3_57sxm"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://by0c26bla5hce" path="res://Assets/Traps/Mine/55.png" id="4_a3dnl"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://cspjuelhbbavu" path="res://Assets/Traps/Mine/56.png" id="5_a1ih2"]
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_m1bdk"]
|
||||||
|
radius = 32.0
|
||||||
|
|
||||||
|
[sub_resource type="SpriteFrames" id="SpriteFrames_fp50i"]
|
||||||
|
animations = [{
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("3_57sxm")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("4_a3dnl")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("5_a1ih2")
|
||||||
|
}],
|
||||||
|
"loop": false,
|
||||||
|
"name": &"Explode",
|
||||||
|
"speed": 3.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("2_6m2fs")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"idle",
|
||||||
|
"speed": 0.0
|
||||||
|
}]
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_uiyu1"]
|
||||||
|
|
||||||
|
[node name="Mine" type="Node2D"]
|
||||||
|
script = ExtResource("1_6fgim")
|
||||||
|
|
||||||
|
[node name="CharacterBody2D" type="CharacterBody2D" parent="."]
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBody2D"]
|
||||||
|
scale = Vector2(0.6, 0.6)
|
||||||
|
shape = SubResource("CircleShape2D_m1bdk")
|
||||||
|
|
||||||
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="CharacterBody2D"]
|
||||||
|
scale = Vector2(0.2, 0.207)
|
||||||
|
sprite_frames = SubResource("SpriteFrames_fp50i")
|
||||||
|
animation = &"Explode"
|
||||||
|
autoplay = "idle"
|
||||||
|
|
||||||
|
[node name="Area2D" type="Area2D" parent="CharacterBody2D"]
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBody2D/Area2D"]
|
||||||
|
scale = Vector2(4, 4)
|
||||||
|
shape = SubResource("CircleShape2D_uiyu1")
|
@ -4,14 +4,25 @@ var follower = false
|
|||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
follower = true
|
follower = true
|
||||||
|
if name.contains("Mine"):
|
||||||
|
get_node("CharacterBody2D/AnimatedSprite2D").connect("animation_finished", Callable(self, "Remove_Mine"))
|
||||||
set_process_input(true)
|
set_process_input(true)
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
if follower:
|
if follower:
|
||||||
position = get_viewport().get_mouse_position()
|
position = get_viewport().get_mouse_position()
|
||||||
|
|
||||||
|
func get_if_moving_state():
|
||||||
|
return follower
|
||||||
|
|
||||||
func _input(event):
|
func _input(event):
|
||||||
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
|
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
|
||||||
if abs(position) <= get_viewport().get_mouse_position():
|
if abs(position) <= get_viewport().get_mouse_position():
|
||||||
follower = false
|
follower = false
|
||||||
|
|
||||||
|
func Explode_Mine() -> void:
|
||||||
|
get_node("CharacterBody2D/AnimatedSprite2D").scale = Vector2(1,1)
|
||||||
|
get_node("CharacterBody2D/AnimatedSprite2D").play("Explode")
|
||||||
|
|
||||||
|
func Remove_Mine() -> void:
|
||||||
|
queue_free()
|
||||||
|
@ -5,8 +5,12 @@ extends Panel
|
|||||||
@onready var stickspawner: Button = $HBoxContainer4/HBoxContainer4/Button2
|
@onready var stickspawner: Button = $HBoxContainer4/HBoxContainer4/Button2
|
||||||
const STICK_TRAP = preload("res://Game/Traps/stick_trap.tscn")
|
const STICK_TRAP = preload("res://Game/Traps/stick_trap.tscn")
|
||||||
|
|
||||||
|
@onready var minespawner: Button = $HBoxContainer4/HBoxContainer4/Button3
|
||||||
|
const MINE = preload("res://Game/Traps/mine.tscn")
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
stickspawner.connect("button_up", Spawn_Stick)
|
stickspawner.connect("button_up", Spawn_Stick)
|
||||||
|
minespawner.connect("button_up", Spawn_Mine)
|
||||||
|
|
||||||
func Update_Lives(lives) -> void:
|
func Update_Lives(lives) -> void:
|
||||||
livelabel.text = "Lives: " + str(lives)
|
livelabel.text = "Lives: " + str(lives)
|
||||||
@ -15,3 +19,8 @@ func Spawn_Stick() -> void:
|
|||||||
var stick = STICK_TRAP.instantiate()
|
var stick = STICK_TRAP.instantiate()
|
||||||
stick.name = "StickTrap-" + str(randi())
|
stick.name = "StickTrap-" + str(randi())
|
||||||
get_parent().add_child(stick)
|
get_parent().add_child(stick)
|
||||||
|
|
||||||
|
func Spawn_Mine() -> void:
|
||||||
|
var mine = MINE.instantiate()
|
||||||
|
mine.name = "Mine-" + str(randi())
|
||||||
|
get_parent().add_child(mine)
|
||||||
|
Reference in New Issue
Block a user