Trajectory of flight

I haven’t found any lessons, were you can be learned for it. Can you give me tags of how to search for it? For example I tried trajectory, flight, path, but they didn’t gave me a link. I am confused, so I tried to ask you, if the physic engine Codea gives would be possible to use?

Do you want the trajectory of something like a bullet or the trajectory of a space ship in orbit. The physics engine would do a bullet type trajectory with very little code.

Since I don’t know what you want, here’s an example of an Angry Bird type of trajectory.

supportedOrientations(LANDSCAPE_ANY)
displayMode(FULLSCREEN)

function setup()
    b=physics.body(CIRCLE,10)
    b.x=10
    b.y=10
    b.type=STATIC
    physics.continuous=true
end

function draw()
    background(0)
    fill(255)
    ellipse(b.x,b.y,20)
    text("tap screen to shoot",WIDTH/2,HEIGHT-50)
    if b.y<0 then
        b.type=STATIC
        b.x=10
        b.y=10
    end
end

function touched(t)
    if t.state==BEGAN then
        b.type=DYNAMIC
        b.linearVelocity=vec2(300,500)
    end
end

If you don’t want to use physics, try this. Change dt, grav, xSpeed, or ySpeed for the effect you want.

displayMode(FULLSCREEN)

function setup()
    x,y,t=0,0,0
    dt=1/60 -- time interval
    grav=16 -- gravity
    xSpeed=130  -- x initial velocity
    ySpeed=130  -- y initial velocity
end

function draw()
    background(0)
    fill(255)
    t=t+dt
    x=t*xSpeed
    y=t*ySpeed-(t*t*grav)
    ellipse(x,y,10)
    text("tap screen to shoot",WIDTH/2,HEIGHT-50)
end

function touched(t)
    if t.state==BEGAN then
        setup()
    end
end

Thank you! This simple code is a beginning for a big Codea project!