Thanks for the vid! I finally nailed things down. The problem? Keep the ship in bounds while letting it get hit by enemy fire too. Solution? Keep the KinematicBody2D I used initially and instead add a child Area2D to it with the circular hitbox in it. The bullets and Area2D are on collision mask and layer 2, and the body itself and the boundaries are on collision mask and layer 1.
Great tutorial friend - keep 'em coming! Godot is a very capable tool but we need a wealth of tutorials if we want it to gain any traction for commercial development.
Amazing tutorial! I'm still learning Godot but already loving it so far! I have one question, why didn't you use a kinematicBody2D for the player with a collisionShape? Im really new to the engine, are there any benefits/reasons why you would choose an area2D over it? Thank you for your amazing tutorials.
I'm late, but I would think this is because a kinematicBody is meant to be used with physics collisions (if you wanted to do things like have bullets bounce off of the player), and all that's needed in this game is just an area to detect bullets entering.
Hey I’m sorry if this is too late to ask Since this tutorial was four years ago But the print() function at the end for me doesn’t work I added the collision and everything and yet when my player gets hit it doesn’t say he got hit
Is the language different between version 3 and 4? I followed the script verbatim and I keep getting an error on the line "var b = bullet_scene.instance()" saying "Invalid call. Nonexistent function 'instance' in base 'PackedScene'". Trying to figure out where I messed up, as this is my only road block I ran into following this video.
I really like this video an I know its old. But there was literally no need for the raycast. At least in godot 4.21. Just use an Area2d with a collisionshape2d and then connect the area to the bullets script and check if the "body" that entered is the player and if so run a "dmg" function in the player to change the health