Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | ZacurniaTate |
Ok, so here is what my nodes look like right now:
KinematicBody (player)
sprite
collisonshape2D
sprite (GUN)
timer
Bullet.tscn is a separate scene with code that says:
extends KinematicBody2D
func _physics_process(delta):
position.x += 10
Right now, I have a script in the Gun that says:
extends Sprite
var Bullet = preload("res://Bullet.tscn")
func shoot():
var bullet = Bullet.instance()
add_child(bullet)
func _process(delta):
if Input.is_action_pressed("click"):
shoot()
The bullets spawn and move, but when I move forward, the bullets move forward faster, like they’ve been boosted. When I move backwards, the bullets stop and slightly move backwards until I stop moving. Can someone please explain how to fix this problem?