Posts

How to Shoot Bullets in Godot

Image
Bullet :     For Bullet i use an Area2D Node with a Sprite Child Node And Make It a Separate Scene. Node Placement:-      Bullet GDscript:- Declare the variable for bullet speed :     In Godot, class members can be exported. This means their value gets saved along with the resource (such as the scene) they’re attached to. They will also be available for editing in the property editor. Exporting is done by using the  export  keyword.      export(int) var bulletSpeed Bullet Movement: Applies a local translation on the node’s X axis based on the Node Process’s delta.      move_local_x(delta*bulletSpeed) Detecting The Bounds Of Screen: func is_outside_view_bounds(): return position.x>OS.get_screen_size().x or position.x<0.0\ or position.y>OS.get_screen_size().y or position.y<0.0 once bullet reach outside of ...