Hitboxes/Hurtboxes update
This commit is contained in:
18
ActionRPG-HeartBeast/World/Grass.gd
Normal file
18
ActionRPG-HeartBeast/World/Grass.gd
Normal file
@ -0,0 +1,18 @@
|
||||
extends Node2D
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func create_grass_effect():
|
||||
var GrassEffect = load("res://Effects/GrassEffect.tscn")
|
||||
var grassEffect = GrassEffect.instance()
|
||||
var world = get_tree().current_scene
|
||||
world.add_child(grassEffect)
|
||||
grassEffect.global_position = global_position
|
||||
|
||||
func _on_Hurtbox_area_entered(area):
|
||||
create_grass_effect()
|
||||
queue_free()
|
27
ActionRPG-HeartBeast/World/Grass.tscn
Normal file
27
ActionRPG-HeartBeast/World/Grass.tscn
Normal file
@ -0,0 +1,27 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://World/Grass.png" type="Texture" id=1]
|
||||
[ext_resource path="res://World/Grass.gd" type="Script" id=2]
|
||||
[ext_resource path="res://Overlap/Hurtbox.tscn" type="PackedScene" id=3]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 7, 7 )
|
||||
|
||||
[node name="Grass" type="Node2D"]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
texture = ExtResource( 1 )
|
||||
centered = false
|
||||
offset = Vector2( -8, -8 )
|
||||
|
||||
[node name="Hurtbox" parent="." instance=ExtResource( 3 )]
|
||||
collision_layer = 8
|
||||
|
||||
[node name="CollisionShape2D" parent="Hurtbox" index="0"]
|
||||
position = Vector2( 8, 8 )
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[connection signal="area_entered" from="Hurtbox" to="." method="_on_Hurtbox_area_entered"]
|
||||
|
||||
[editable path="Hurtbox"]
|
Reference in New Issue
Block a user