add eart
All checks were successful
CI / build (pull_request) Successful in 2m48s

This commit is contained in:
ultrablob 2025-02-05 21:15:12 -05:00
parent 8cb01d7918
commit 4ea08b1c5f
29 changed files with 697 additions and 17 deletions

29
shield_bullet.gd Normal file
View file

@ -0,0 +1,29 @@
extends RigidBody2D
@onready var player = $"../Player"
var shield_scene = preload("res://shield.tscn")
func _physics_process(delta):
rotation = linear_velocity.angle()
#if linear_velocity.length() < 1100:
# apply_central_force((global_position - player.global_position).normalized() * -200)
func hit(body):
if body.is_in_group("destructible") and body.name != "Shield":
var shield = shield_scene.instantiate()
if body.has_node("ShieldMarker"):
shield.scale = Vector2.ONE
body.get_node("ShieldMarker").add_child(shield)
else:
body.add_child(shield)
shield.position = Vector2.ZERO
queue_free()
else:
queue_free()