mirror of
https://github.com/Yadciel1/2048-Shooter.git
synced 2024-11-14 01:51:20 +01:00
73 lines
1.9 KiB
Plaintext
73 lines
1.9 KiB
Plaintext
[gd_scene load_steps=5 format=2]
|
|
|
|
[ext_resource path="res://assets/Tank Town V2.png" type="Texture" id=1]
|
|
|
|
[sub_resource type="GDScript" id=1]
|
|
script/source = "extends KinematicBody2D
|
|
|
|
var pre_bullet_hit = preload(\"res://Objects/bullet_hit.tscn\")
|
|
var velocity = Vector2(0,1)
|
|
var speed = 50
|
|
var life = 1
|
|
var rng = RandomNumberGenerator.new()
|
|
|
|
signal on_Death
|
|
signal badget
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
rng.randomize()
|
|
var Progressbars = get_tree().get_nodes_in_group(\"XP\")
|
|
for Progressbar in Progressbars:
|
|
self.connect(\"on_Death\",Progressbar, \"on_Death_listed\")
|
|
var GameNode = find_parent(\"Game\")
|
|
connect(\"badget\", GameNode, \"_enable_Panzer\")
|
|
pass # Replace with function body.
|
|
|
|
func _physics_process(delta):
|
|
move_and_collide(velocity.normalized() * delta * speed)
|
|
pass
|
|
|
|
|
|
func _on_Area2D_area_entered(area):
|
|
var value = 1
|
|
var bullet_hit = pre_bullet_hit.instance()
|
|
var GameNode = find_parent(\"Game\")
|
|
if area.is_in_group(\"Bullet\"):
|
|
var Bullet = area.get_parent()
|
|
GameNode.add_child(bullet_hit)
|
|
bullet_hit.global_position = Bullet.global_position
|
|
bullet_hit.play()
|
|
emit_signal(\"on_Death\", value)
|
|
emit_signal(\"badget\", value)
|
|
queue_free()
|
|
pass # Replace with function body.
|
|
"
|
|
|
|
[sub_resource type="RectangleShape2D" id=3]
|
|
extents = Vector2( 7, 7 )
|
|
|
|
[sub_resource type="RectangleShape2D" id=2]
|
|
extents = Vector2( 7.83333, 7.83333 )
|
|
|
|
[node name="Item" type="KinematicBody2D"]
|
|
position = Vector2( 64, 64 )
|
|
scale = Vector2( 8, 8 )
|
|
script = SubResource( 1 )
|
|
|
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
|
shape = SubResource( 3 )
|
|
|
|
[node name="Sprite" type="Sprite" parent="."]
|
|
texture = ExtResource( 1 )
|
|
hframes = 10
|
|
vframes = 12
|
|
frame = 48
|
|
|
|
[node name="Area2D" type="Area2D" parent="."]
|
|
|
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
|
shape = SubResource( 2 )
|
|
|
|
[connection signal="area_entered" from="Area2D" to="." method="_on_Area2D_area_entered"]
|