Topic was automatically imported from the old Question2Answer platform.
Asked By
Chasethegamer
HI, im trying to create a game where you shoot a bullet to destroy asteroids but i cannot for the life in me get the bullet to appear on screen. Im still pretty new to coding in general so i need all the help i can get!
var bullet = preload("res://bullet.tscn")
var bulletVelocity = 200
func shoot():
var bulletInstance = bullet.instance()
bulletInstance.position = $Position2D.position
bulletInstance.velocity.x = bulletVelocity
$BulletManager.add_child(bulletInstance)
But do note you do not need a position 2d. This is standard scene instanceing and you will use it a ton, from shooting bullets to spawning enemys and coins.
Merlin1846 | 2020-03-10 15:19
there is no velocity property for bulletInstance did I do something wrong?