[WIP] Flight School

I could use a few deva to make some art. I could also use a guy who knows how to tilt 2d safley without messing up the game art. Hope you like it!


--Flight School

--Hi!
function setup()
    displayMode(STANDARD)
print("Tap help to learn how to fly.")
print("Tap close to start flying.")
print("Sorry the plane is a little small.")
parameter.action("Close", function() closing() end)
parameter.action("Help", function() Help() end)
    supportedOrientations(LANDSCAPE_ANY)
    player = vec2(150,300)
    full = false
    throttle = 0
end

function draw()
    background(0, 0, 255, 255)
fill(0, 255, 36, 255)
rect(0, 0, 1000, 200)

 if full == true then
    fill(128, 79, 30, 255)
    rect(100, 100, 100, 200)
    speed = throttle * 2
    sprite("Documents:plane", player.x, player.y)
    fill(127, 127, 127, 255)
    rect(400, 500, 100, 100)
    
   player.x = player.x + speed
        if CurrentTouch.x >=0 and CurrentTouch.y >=700 and CurrentTouch.state == MOVING then
        player.y = player.y - 2
        end
if CurrentTouch.x >= 0 and CurrentTouch.y <=100 and CurrentTouch.state == MOVING then
        player.y = player.y + 1
        end
if CurrentTouch.x >=400 and CurrentTouch.x <= 500 and CurrentTouch.y >=500 and CurrentTouch.y <=600 and CurrentTouch.state == BEGAN then
    throttle = throttle + 1
    end
    if throttle >= 2 then
        throttle = throttle - 1
    end
    if player.x >=1000 then
        throttle = throttle - 2
        if throttle <=2 then
            throttle = throttle + 1
            end
        end
        if player.x <= 0 then
            throttle = throttle + 2
            if throttle >=2 then
                throttle = throttle - 1
                end
               
if player.x <= 0 and player.y <= 270 then
throttle = throttle - 5
if throttle <= 0 then
    throttle = 0
    background(240, 255, 0, 255)
    fill(255, 0, 0, 255)
    fontSize(50)
    text("You landed safley!!! \
 Press the restart button to fly again.", WIDTH/2, HEIGHT/2)
    text("       | \
       v", 100, 100)
end
end
        end
    end
end

function Help()
    displayMode(STANDARD)
    output.clear()
    print("Tap and rub the bottom of the screen to climb.")
    print("\
 Tap and rub the top of the screen to decend.")
    print("\
 No left and right yet... But it will come soon.")
    print("\
 You switch directions be hitting the edge.")
    print("\
 If you are facing more degrees up than your speed, you will stall.")
    print("Tap the grey box to increase throttle. (5 Taps is max)")
end

function closing()
    full = true
displayMode(FULLSCREEN)
output.clear()
end

You land by first reaching one end of the map, get onto the grass, and when you hit the end closest to the launching pad, you land. I will add if you crash into the launching pad, it says to try again.

@code_maker, Since we dont have access to your documents, i replaced the sprite, but I can’t see the plane

@code_maker Any sprite you use from you Documents or Dropbox file isn’t available to other users on the forum. If you’re going to post code for others to use, then it’s best to use the build in Codea sprites. @CodeaNoob You should see whatever Codea sprite that you substituted for the plane. I used a Codea sprite and had not trouble seeing the sprite.

Oh, ok. You can make an image close to plane plane facing left if you want

In the next update,I’ll add in game currency. You get 5 coins when you land. You can use your coins to buy game passes.

Version 1.1 has been deleted.

I should have about 2 beta versions a day submitted based on how big the update is and how much time I have

1.2.1 has been deleted.

1.2.3 is out, it contains bug fixes. I figured out a bug where you can do anything but enter planes, and close. This allows for all of it to happen. I just moved the camera and perspective to when you fly.

--Flight School

--Version 1.2.3
--Whats new?
--[[
bug fixes
]]--

--News:
--[[

]]--
--LINKS FOR IMAGES:

-- Cessna 182 img link- http://www.bredow-web.de/ILA_2006/Kleinflugzeuge/Cessna_182_Skylane/cessna_182_skylane.html

function setup()
    displayMode(STANDARD)
print("Tap help to learn how to fly.")
print("Tap close to start flying.")
print("Sorry the plane is a little small.")
print("Tap planes to select a plane is you have bought one.")
parameter.action("Close", function() closing() end)
parameter.action("Help", function() Help() end)
parameter.action("Shop", function() shopping() end)
parameter.action("Planes", function() bp() end)
    supportedOrientations(LANDSCAPE_ANY)
    player = vec2(150,300)
    full = false
  coins = readLocalData("cu", 50)
print("Coins:" ..coins)
doubleCoins = false
reg = 0
cessna = 1
plane_type = reg
planes = readLocalData("Pls", 1)

end

function closing()
    full = true
parameter.clear()
output.clear()
parameter.integer("Throttle", -2, 100, 0)
saveLocalData("Pls", planes)
parameter.integer("CamX", 0, 3000, 0)
    parameter.integer("CamY", 0, 3000, 140)
    parameter.integer("CamZ", -1000, 3000, 710)
    parameter.integer("LAX", -1000, 3000, 575)
    parameter.integer("LAY", -1000, 3000, 420)
    parameter.integer("LAZ", -1400, 3000, -1400)
end

function draw()
    background(0, 0, 255, 255)
   
fill(0, 255, 36, 255)
rect(0, 0, 1000, 200)

 if full == true then
 camera(CamX, CamY, CamZ, LAX, LAY, LAZ)
perspective()
    parameter.action("Reverse", function() flip() end)
    fill(128, 79, 30, 255)
    rect(100, 100, 100, 200)
    speed = Throttle / 2
    if plane_type == reg then
    sprite("SpaceCute:Rocketship", player.x, player.y, 100, 100)
    elseif plane_type == cessna then
    sprite("Documents:Cessna 182", player.x, player.y, 100, 100)
    end

    
   player.x = player.x + speed
        if CurrentTouch.x >=0 and CurrentTouch.y >=700 and CurrentTouch.state == MOVING then
        player.y = player.y - 2
        end
if CurrentTouch.x >= 0 and CurrentTouch.y <=100 and CurrentTouch.state == MOVING then
        player.y = player.y + 1
        end
--if CurrentTouch.x >=400 and CurrentTouch.x <= 500 and CurrentTouch.y >=500 and CurrentTouch.y <=600 and CurrentTouch.state == BEGAN then
   -- throttle = throttle + 1
    --end
    
    if Throttle >=10 then
player.y = player.y
    elseif Throttle <=9 and Throttle >=10 and player.x == 150 and player.y == 300 then
    player.y = player.y
    else
    player.y = player.y - 0.5
end

if Throttle >= 30 then
player.y = player.y + 1
end

if Throttle >=50 then
player.y = player.y + 2
end
    
    if Throttle <=-10 then
    player.y = player.y
    end
    
        if player.x <= 0 then
            Throttle = 10
            if Throttle >=2 then
               
if player.x <= 1 and player.y <= 270 then
Throttle = 0
if Throttle <= 0 then
    Throttle = 0
    save()
    background(240, 255, 0, 255)
    fill(255, 0, 0, 255)
    fontSize(50)
    text("You landed safley!!! \
 Press the restart button to fly again.", WIDTH/2, HEIGHT/2)
    text("       | \
       v", 100, 100)
end
end
end
    end
end

function Help()
    displayMode(STANDARD)
    output.clear()
    print("Tap and rub the bottom of the screen to climb.")
    print("\
 Tap and rub the top of the screen to decend.")
    print("\
 No left and right yet... But it will come soon.")
    print("\
 You switch directions be hitting the edge.")
end


function save()
    if doubleCoins == true then
        coins = coins + 2
        else
coins = coins + 1
end
 saveLocalData("cu", coins)
end

function shopping()
output.clear()
print("Double Coins:Doubles the amount of coins when you land. Price: 50 coins")
print("Cessna 182: Gives you a new plane to fly with! Price: 130 coins")
parameter.action("Double Coins", function() buyC() end)
    parameter.action("Cessna 182", function() buyC2() end)

end

function buyC()
doubleCoins = true
coins = coins - 50
end

function buyC2()
plane_type = cessna
coins = coins - 130
end
end
function bp()
output.clear()
parameter.clear()
parameter.action("Close", function() closing() end)
    parameter.integer("Plane", 1, planes, 1)
if plane_type == cessna then
planes = 2
saveLocalData("Pls", planes)
else
planes = 1

    end
end

function flip()
Throttle = -10
end

1.2.2 has been deleted.

1.2.3 is the official 1.2 BTW, that’s why I haven’t gotten 1.2.4 out.