Missiles break bricks

This commit is contained in:
Felipe M 2021-05-18 20:53:49 +02:00
parent 632d927938
commit 2e1bcbc225
Signed by: fmartingr
GPG key ID: 716BC147715E716F
5 changed files with 40 additions and 4 deletions

View file

@ -0,0 +1,15 @@
extends "res://Scenes/Objects/Proyectile.gd"
const EnemyDeathEffect = preload("res://Scenes/Effects/EnemyDeathEffect.tscn")
const BRICK_LAYER_BIT = 4
func _ready():
pass # Replace with function body.
func _on_Hitbox_body_entered(body):
if body.get_collision_layer_bit(BRICK_LAYER_BIT):
body.queue_free()
Utils.instance_scene_on_main(EnemyDeathEffect, body.global_position + Vector2(8, 8))
._on_Hitbox_body_entered(body)

View file

@ -1,8 +1,9 @@
[gd_scene load_steps=8 format=2]
[gd_scene load_steps=9 format=2]
[ext_resource path="res://Assets/Player/PlayerMissile.png" type="Texture" id=1]
[ext_resource path="res://Scenes/Objects/Proyectile.tscn" type="PackedScene" id=2]
[ext_resource path="res://Assets/Effects/Particle.png" type="Texture" id=3]
[ext_resource path="res://Scenes/Player/PlayerMissile.gd" type="Script" id=4]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 7, 2 )
@ -25,6 +26,7 @@ orbit_velocity_random = 0.0
scale_curve = SubResource( 3 )
[node name="PlayerMissile" instance=ExtResource( 2 )]
script = ExtResource( 4 )
[node name="Sprite" parent="." index="0"]
texture = ExtResource( 1 )
@ -34,7 +36,7 @@ position = Vector2( -0.5, 0 )
scale = Vector2( 2.125, 1 )
[node name="Hitbox" parent="." index="3"]
collision_mask = 10
collision_mask = 26
damage = 3
[node name="Collider" parent="Hitbox" index="0"]