This errors are from my bullet so this is my bullets script
extends Area2D
const min_bullet_speed = 200
const max_bullet_speed = 500
# Speed of the bullet
var BULLET_SPEED = 300
# Maximum angle deviation from vertical (in degrees)
const MAX_ANGLE_DEVIATION = 30
# Called when the node enters the scene tree for the first time.
func _ready():
# Set the initial position of the bullet (random x at the bottom of the screen)
randomize() # Ensure random number generation is initialized
var viewport_width = get_viewport().size.x
position = Vector2(rand_range(0, viewport_width), get_viewport().size.y)
# Apply a random angle deviation
rotation = deg2rad(rand_range(-MAX_ANGLE_DEVIATION, MAX_ANGLE_DEVIATION))
BULLET_SPEED = rand_range(min_bullet_speed, max_bullet_speed)
connect("area_entered", self, "_on_area_entered")
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
# Move the bullet upwards at the given angle
position.y -= BULLET_SPEED * delta * cos(rotation)
position.x += BULLET_SPEED * delta * sin(rotation)
# Check if the bullet is out of the screen
if position.y < -100 or position.x < 0 or position.x > get_viewport().size.x:
queue_free() # Destroy the bullet when it goes out of screen
func fade_out() -> void:
var tween = Tween.new()
add_child(tween)
tween.interpolate_property(self, "modulate", Color(1, 1, 1, 1), Color(1, 1, 1, 0), 1)
tween.start()
print("fade_out")
func _on_area_entered(area):
# Define what happens when the area is entered
print("Area entered: ", area.name)
i tried to do something like this but dont working
Now you called it _on_Bullet_area_entered, read the error message it tells you what is wrong, just create the correct method or connect it to the correct method
Now you’re connecting it twice, not sure where else you connect it, but you connect it twice somewhere which isn’t correct (the error message says what’s wrong)
i found it, that was in my bullet ready function connect… i deleted it and then add as you said this :func _on_Bullet_area_entered(area):
print("Bullet entered area: ", area.name).And what about this yellow need i fix this or not i just fear when i export my game it will crash.