0 votes

I'm making a simple platformer game in which the player can shoot bullets at enemies. The bullet is an Area2D that uses the translate function to move and the enemy is a KinematicBody2D with an Area2D that I'm using to detect this collision. My collision code in the enemy and bullet are as simple as they can possibly be:

Bullet:

func _on_Bullet_body_entered(body):
    queue_free()

Enemy:

func _on_DeathArea_area_entered(area):
    lives -= 1

Yet the collision does sometimes not get detected, which leads to very frustrating gameplay - sometimes enemies with three lives require 7 shots to die. What is causing this to happen and how can I fix it? Thank you for your help!

Godot version 3.2.3 stable
in Engine by (12 points)

1 Answer

0 votes

It's possible that the bullet is moving so fast that it skips over the Area2D. In this case, you should try increasing FPS or lowering the bullet speed. Or maybe the issue something else?

by (6,280 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.