Topic: Bullet script
Hey, Im making a script for a bullet.
bullet = getObject("bullet")
bullet1 = getObject("bullet1")
firing = 0
--On scene update()
if onKeyDown("MOUSE_BUTTON1") then
if ammo_val == 1 then
changeAnimation(char, 4)
playSound(fire)
ammo_val = decrement(ammo_val)
firing = 1
elseif ammo_val == 0 then
playSound(click)
changeAnimation(char, 3)
end
end
if firing == 1 then
activate(bullet1)
bulletPos = getPosition(bullet)
setPosition(bullet1, {bulletPos[1], bulletPos[2], bulletPos[3]})
translate(bullet1, {0.5, 0, 0}, "local")
end
My main question is, why wont my bullet show at the coordinates for "bullet" (which is the spawnpoint for bullet1)?
And why is the coordinates for bullet the same all the time? I've tried printed them out in the console.