Bombs game ending, and debugging.
This commit is contained in:
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:
|
||||
follower = true
|
||||
if name.contains("Mine"):
|
||||
get_node("CharacterBody2D/AnimatedSprite2D").connect("animation_finished", Callable(self, "Remove_Mine"))
|
||||
set_process_input(true)
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if follower:
|
||||
position = get_viewport().get_mouse_position()
|
||||
|
||||
func get_if_moving_state():
|
||||
return follower
|
||||
|
||||
func _input(event):
|
||||
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
|
||||
if abs(position) <= get_viewport().get_mouse_position():
|
||||
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()
|
||||
|
Reference in New Issue
Block a user