Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | desik | |
Old Version | Published before Godot 3 was released. |
Hi,
I am trying to create simple top down shooter. Player may look at any direction, and when we shoot, then I want to create new bullet instance and immediately start moving it to the mouse position (position it had when we shot).
I ended up with something like:
func _input(event):
if(event.is_action_pressed("shoot")):
var target = get_parent().get_global_mouse_pos()
var start_pos = get_node("bulletSource").get_global_pos()
var bullet = bulletScene.instance()
bullet.set_pos(start_pos)
bullet.init(target)
world.add_child(bullet)
#what next? what to do in bullet code
But I don’t know how should I proceed with bullet moving.
Could you help me guys? Thanks in advance