#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# [WIP] Flight School

edited February 2015 Posts: 167

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!!! \n Press the restart button to fly again.", WIDTH/2, HEIGHT/2)
text("       | \n       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("\n Tap and rub the top of the screen to decend.")
print("\n No left and right yet... But it will come soon.")
print("\n You switch directions be hitting the edge.")
print("\n 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
``````
Tagged:

• Posts: 167

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.

• Posts: 835

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

• Mod
Posts: 9,262

@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.

• Posts: 167

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

• Posts: 167

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.

• edited February 2015 Posts: 167

Version 1.1 has been deleted.

• Posts: 167

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

• edited February 2015 Posts: 167

1.2.1 has been deleted.

• edited February 2015 Posts: 167

1.2.2 has been deleted.

• edited February 2015 Posts: 167

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:
--[[

]]--

-- 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
print("Coins:" ..coins)
doubleCoins = false
reg = 0
cessna = 1
plane_type = reg

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!!! \n Press the restart button to fly again.", WIDTH/2, HEIGHT/2)
text("       | \n       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("\n Tap and rub the top of the screen to decend.")
print("\n No left and right yet... But it will come soon.")
print("\n 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")

end

doubleCoins = true
coins = coins - 50
end

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
``````
• Posts: 167

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