Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | puffle69945 |
I’m making a 2d platformer where the character you play as has a gun.
But whenever I shoot to the left, it goes really slowly.
When I shoot to the right it’s completely fine.
Does anyone know how to fix this?
Hi! you really need to share your code so we can help! Its hard to know what is happening if we cannot see the relevant code.
p7f | 2020-09-10 12:26
Sorry about that
Here is the bullet’s code ///
`extends KinematicBody2D
var speed = 1000
var dir
var pos
var velocity = Vector2()
var accel
var loop = 1
var shooty
func _ready():
dir = Pewww.shooty
pos = self.position.x
self.position = Pewww.pos
shooty = Pewww.shooty
func _process(delta):
velocity.x += speed * delta
velocity.y += Pewww.change.y
velocity.x = velocity.x * shooty
move_and_slide(velocity)
if loop == 1:
loop = 2
yield(get_tree().create_timer(1.0),"timeout")
queue_free()
And here is Pewww, the thing that the Bullet’s code takes some stuff from
extends Node
var direction = 1
var shooty = 1
var pos = Vector2.ZERO
var change = Vector2()
func _process(delta):
if Input.is_action_just_pressed(“ui_left”):
shooty = -shooty
if Input.is_action_just_pressed(“ui_right”):
shooty = abs(shooty)
puffle69945 | 2020-09-10 12:33