This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

so in my game, I have a flare weapon which I want to act as a light source when it collides with the mouse position, to clarify i mean where the mouse was positioned when the player fired the flare, so ideally, it would travel until it hit where the player had targeted it and I would from there be able to swap out a flare object in its place.

I've tried a lot of different methods but the one that's been the closest, is the method where when I fire I spawn a crosshair indicator showing i fired at that spot, but at the center of the crosshair there is a collision stored on it or an area2d, so when the flare hits the center of the crosshair, it can detect its hit a "block" and it can do all the things i mentioned above

I've gotten most aspects of this to work, the only thing not working is the detection for deleting the bullet as when it collides it comes to a stop and stays there until the timer i have set deletes it which is way too long. the bullet and crosshair are completely different scenes btw, as well as different codes, any ideas?

Godot version Godot 3.4
in Engine by (17 points)

1 Answer

0 votes

What about, after firing the bullet if the bullet hits the mouse cursor it will make it stop? and when it stops you can make the energy of the light2d node go up like this Idk I am not expert.

func fire():
   var ene =  $Light2d.energy
   var pos = get_global_mouse_position()
   if (your bullet).position = pos
       (your bullet).position = pos
       $Light2d.energy = ene + 1.5

IDK IF IT WILL WORK *BUT YOU WILL GET AN IDEA THATS WHAT IS HAPPENING
and soory if its misleading or wrong

by (20 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 Frequently asked questions and 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 [email protected] with your username.