add groups for nodes and clean up old code

This commit is contained in:
fram3d 2024-07-02 13:57:46 +02:00
parent cb235310f1
commit f87abc0631
Signed by: fram3d
GPG Key ID: 938920E709EEA32A
7 changed files with 72 additions and 74 deletions

View File

@ -16,24 +16,16 @@ const MOVEMENT_VECTORS = [
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _physics_process(delta):
func _physics_process(_delta):
var movement = MOVEMENT_VECTORS[randi() % 4]
move_and_collide(movement * 2)
pass
func _on_Hitbox_area_entered(area):
pass # Replace with function body.
func _on_Hurtbox_area_entered(area):
func _on_Hurtbox_area_entered(_area):
$Hurtbox/death.play()
pass # Replace with function body.
func _on_death_finished():
queue_free()
pass # Replace with function body.

View File

@ -20,25 +20,34 @@ script = ExtResource( 2 )
position = Vector2( 0.380203, -0.127379 )
texture = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="." groups=[
"goblin",
]]
shape = SubResource( 1 )
[node name="Hitbox" type="Area2D" parent="."]
[node name="Hitbox" type="Area2D" parent="." groups=[
"goblin",
]]
collision_layer = 32
collision_mask = 16
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox" groups=[
"goblin",
]]
shape = SubResource( 2 )
[node name="Hurtbox" type="Area2D" parent="."]
[node name="Hurtbox" type="Area2D" parent="." groups=[
"goblin",
]]
collision_layer = 64
collision_mask = 2
[node name="death" type="AudioStreamPlayer2D" parent="Hurtbox"]
[node name="death" type="AudioStreamPlayer" parent="Hurtbox"]
stream = ExtResource( 3 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hurtbox"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hurtbox" groups=[
"goblin",
]]
shape = SubResource( 3 )
[connection signal="area_entered" from="Hitbox" to="." method="_on_Hitbox_area_entered"]
[connection signal="area_entered" from="Hurtbox" to="." method="_on_Hurtbox_area_entered"]
[connection signal="finished" from="Hurtbox/death" to="." method="_on_death_finished"]

View File

@ -10,23 +10,11 @@ extends Area2D
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func _on_Hitbox_area_entered(area):
pass # Replace with function body.
func _on_Hurtbox_area_entered(area):
func _on_Hurtbox_area_entered(_area):
#if area.is_in_group("ooze"):
$Hurtbox/death.play()
pass # Replace with function body.
func _on_death_finished():
queue_free()
pass # Replace with function body.

View File

@ -21,25 +21,34 @@ position = Vector2( 0.118118, -0.0393729 )
scale = Vector2( 1.02953, 0.990157 )
texture = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="." groups=[
"moss",
]]
shape = SubResource( 1 )
[node name="Hitbox" type="Area2D" parent="."]
[node name="Hitbox" type="Area2D" parent="." groups=[
"moss",
]]
collision_layer = 2147483650
collision_mask = 64
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox" groups=[
"moss",
]]
shape = SubResource( 2 )
[node name="Hurtbox" type="Area2D" parent="."]
[node name="Hurtbox" type="Area2D" parent="." groups=[
"moss",
]]
collision_layer = 4
collision_mask = 8
[node name="death" type="AudioStreamPlayer" parent="Hurtbox"]
stream = ExtResource( 3 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hurtbox"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hurtbox" groups=[
"moss",
]]
shape = SubResource( 3 )
[connection signal="area_entered" from="Hitbox" to="." method="_on_Hitbox_area_entered"]
[connection signal="area_entered" from="Hurtbox" to="." method="_on_Hurtbox_area_entered"]
[connection signal="finished" from="Hurtbox/death" to="." method="_on_death_finished"]

View File

@ -16,23 +16,16 @@ const MOVEMENT_VECTORS = [
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _physics_process(delta):
func _physics_process(_delta):
var movement = MOVEMENT_VECTORS[randi() % 4]
move_and_collide(movement * 2)
pass
func _on_Hitbox_area_entered(area):
pass # Replace with function body.
func _on_Hurtbox_area_entered(area):
func _on_Hurtbox_area_entered(_area):
$Hurtbox/death.play()
pass # Replace with function body.
func _on_death_finished():
queue_free()
pass # Replace with function body.

View File

@ -20,25 +20,34 @@ script = ExtResource( 2 )
position = Vector2( -0.061738, 0.18198 )
texture = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="." groups=[
"ooze",
]]
shape = SubResource( 1 )
[node name="Hitbox" type="Area2D" parent="."]
[node name="Hitbox" type="Area2D" parent="." groups=[
"ooze",
]]
collision_layer = 8
collision_mask = 4
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox" groups=[
"ooze",
]]
shape = SubResource( 2 )
[node name="Hurtbox" type="Area2D" parent="."]
[node name="Hurtbox" type="Area2D" parent="." groups=[
"ooze",
]]
collision_layer = 16
collision_mask = 32
[node name="death" type="AudioStreamPlayer2D" parent="Hurtbox"]
[node name="death" type="AudioStreamPlayer" parent="Hurtbox"]
stream = ExtResource( 3 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hurtbox"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hurtbox" groups=[
"ooze",
]]
shape = SubResource( 3 )
[connection signal="area_entered" from="Hitbox" to="." method="_on_Hitbox_area_entered"]
[connection signal="area_entered" from="Hurtbox" to="." method="_on_Hurtbox_area_entered"]
[connection signal="finished" from="Hurtbox/death" to="." method="_on_death_finished"]

View File

@ -144,27 +144,25 @@ cell_custom_transform = Transform2D( 8, 0, 0, 8, 0, 0 )
format = 1
tile_data = PoolIntArray( 0, 1, 0, 1, 1, 0, 2, 1, 0, 3, 1, 0, 4, 1, 0, 5, 1, 0, 6, 1, 0, 7, 1, 0, 8, 1, 0, 9, 1, 0, 65536, 1, 0, 65537, 0, 0, 65538, 0, 0, 65539, 0, 0, 65540, 2, 65537, 65541, 2, 65537, 65542, 2, 65537, 65543, 1, 0, 65544, 1, 0, 65545, 1, 0, 131072, 1, 0, 131073, 0, 0, 131074, 1, 0, 131075, 0, 0, 131076, 0, 0, 131077, 1, 0, 131078, 2, 65537, 131079, 1, 0, 131080, 1, 0, 131081, 1, 0, 196608, 1, 0, 196609, 0, 0, 196610, 1, 0, 196611, 0, 0, 196612, 0, 0, 196613, 0, 0, 196614, 2, 65537, 196615, 2, 65537, 196616, 2, 2, 196617, 1, 0, 262144, 1, 0, 262145, 0, 0, 262146, 1, 0, 262147, 0, 0, 262148, 0, 0, 262149, 1, 0, 262150, 2, 65536, 262151, 2, 65537, 262152, 2, 65538, 262153, 1, 0, 327680, 1, 0, 327681, 0, 0, 327682, 1, 0, 327683, 0, 0, 327684, 0, 0, 327685, 0, 0, 327686, 2, 65536, 327687, 2, 65537, 327688, 2, 65538, 327689, 1, 0, 393216, 1, 0, 393217, 0, 0, 393218, 0, 0, 393219, 0, 0, 393220, 0, 0, 393221, 0, 0, 393222, 2, 131072, 393223, 2, 131073, 393224, 2, 131074, 393225, 1, 0, 458752, 1, 0, 458753, 1, 0, 458754, 1, 0, 458755, 1, 0, 458756, 1, 0, 458757, 1, 0, 458758, 1, 0, 458759, 1, 0, 458760, 1, 0, 458761, 1, 0 )
[node name="moss" parent="." instance=ExtResource( 6 )]
position = Vector2( 36, 36 )
[node name="Moss2" parent="." instance=ExtResource( 6 )]
position = Vector2( 44, 44 )
[node name="Moss" parent="." instance=ExtResource( 6 )]
position = Vector2( 36, 20 )
[node name="Moss3" parent="." instance=ExtResource( 6 )]
position = Vector2( 44, 52 )
[node name="Goblin" parent="." instance=ExtResource( 4 )]
position = Vector2( 28, 52 )
[node name="Goblin2" parent="." instance=ExtResource( 4 )]
position = Vector2( 28, 28 )
[node name="Ooze2" parent="." instance=ExtResource( 5 )]
position = Vector2( 36, 52 )
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
position = Vector2( -4, 4 )
stream = ExtResource( 7 )
autoplay = true
[node name="goblin" parent="." instance=ExtResource( 4 )]
position = Vector2( 28, 52 )
[node name="moss" parent="." instance=ExtResource( 6 )]
position = Vector2( 44, 44 )
[node name="ooze" parent="." instance=ExtResource( 5 )]
position = Vector2( 28, 28 )
[node name="goblin2" parent="." instance=ExtResource( 4 )]
position = Vector2( 36, 36 )
[node name="moss2" parent="." instance=ExtResource( 6 )]
position = Vector2( 36, 20 )
[node name="ooze2" parent="." instance=ExtResource( 5 )]
position = Vector2( 36, 52 )