# how to make my bullet fly directly to target?(

I’ve just downloading Codea, and don’t know anything about vectors, can anyone help, i have to make the bullet to fly directly on target

``````function setup()
displayMode(FULLSCREEN)
t = Target()
bullet = Bullet()
end

function draw()

background(40, 40, 50)

strokeWidth(5)

bullet.draw()
-- bullet.mov()
t.draw()

if dx < a then
dx = dx + 1
end

if dy< b then
dy = dy + 1
end

if dx > a then
dx = dx - 1
end

if dy > b then
dy = dy - 1
end

end

Bullet = class()

function Bullet:init(x)
dx = 0
dy = 0
end

function Bullet:draw()
ellipse(dx,dy, 15,15)
fill(255,0,0)
end

Target = class()

function Target:init(x)
a = WIDTH/2
b = HEIGHT/2
end

function Target:draw()
smooth()
noStroke()
ellipse(a,b, 50,50)
fill(255,255,255)
a = CurrentTouch.x
b = CurrentTouch.y
end
``````

@Instantly Do a forum search for missiles or see the link below for one example.

``````
https://twolivesleft.com/Codea/Talk/discussion/3354/space-ship-shooting/p1

``````

@Instantly I would use a tween.

@Prynok you can’t create ricochets with tween can you?

@Luatee If it has number values, then it can. A tween just slowly makes a number(s) go up or down, to reach the target number, in the amount of time you gave it.

Ahh, I’ve never used them, never really though I had to, although I do the unruly use of tween.delay(0.1,function() end) for a delayed function execution.

@Instantly - please read some of the tutorials on the wiki link above. You can’t download Codea and instantly write programs without learning something first.