You are in charge. You are the Head Honcho at the new Nimitz class of nuclear powered aircraft carrier and your job is to make sure that every plane/helicopter lands safely.
This sample project is provided for you learn a different type of game that can be developed using Corona. It is up to you now to implement sound, different planes, water movement, score, etc.
The code is very simple to follow and as usual it is open source MIT license so feel free to use it for your own projects, or just to impress your friends.
One thing, this game sample has coordinate systems for iPad - looks funky on some other devices.
ps: there are some quirks but really minor. ...
pss: Catmull Spline code thanks to Matthew Pringle for submitting it to our code exchange.
After installation on an iPhone or iPad all I get is a black screen. Any idea what is wrong?
yepp same issue here, doesnt show when i tried it out on my iPod Touch 4th generation, whats going on?
You guys have the source? can't you debug?
What build number are you using? this works with the latest build.
C.
Hey Carlos, is there any way for me to see an example with just one plane connect with the ship. The plan being placed in one place not moving.
Basically I want to see how this code works with just one still object (plane) connect with another still object (ship).
I am very new and get confused with all the randomness going on..
Well I managed to rip apart the Flight control project to where it just shows one plane and the run way.
I was wondering if there was a way to set up boundaries where the plan can't fly outside of those boundaries. Say we had a maze that the plane had to fly through. If the plane tried to go through a wall it would cancel its path. is this possible?
It's good but it has the same issue I saw in Martian Control in that under some circumstances when a vehicle crashes, the line is not erased and remains for the rest of the game.
I downloaded this last night to have a look, and I noticed that sometimes planes "lose" their path and go off screen. I think it happens when the paths of different planes intersect or when the paths end at the landing area close together. I started to look at the code to see where this gremlin was hiding but I can't figure it out. Any thoughts? Also, I'm VERY new to lua so it might be something obvious I'm missing. Thanks
Hi all,
I installed the latest build and built this sample code, but i still encountered the same issue -- there was a black screen in my iPhone3.
Could anyone please give me some suggestions about how to resolve this ?
Thank you in advance.
Eric.W
Really great example of catmull splines but for a novice like me in game development I struggled to get my head round this at first.
As a result I have applied this code to a simpler example providing as many comments and references back to the SDK as well as the concept of catmull splines.
I hope my research into this subject helps. I have two postings at http://mygamingproject.blogspot.com/2011/12/catmull-splines-introduction.html and http://mygamingproject.blogspot.com/2011/12/catmull-splines-object-follows-path.html
The intention is to continue my study of which I will report further postings. Once finished will submit to the code exchange
Sometimes, the plane will lose track of the path. I am yet to find what is causing this problem. Anyone has any idea?
I have found that this is due to a velocity too close to zero.
Solution 1
To correct this I added code to the followPoints(plane) method to ensure a high enough velocity.
Original Code:
1 2 3 4 | local flightAngle = math.atan2((plane.y - point.y) , (plane.x - point.x) ) * (180 / math.pi) local velocityX = math.cos(math.rad(flightAngle)) * planeSpeed * -1 local velocityY = math.sin(math.rad(flightAngle)) * planeSpeed * -1 |
Modified Code:
1 2 3 4 5 6 7 8 9 10 | local flightAngle = math.atan2((plane.y - point.y) , (plane.x - point.x) ) * (180 / math.pi) local velocityX = math.cos(math.rad(flightAngle)) * planeSpeed * -1 local velocityY = math.sin(math.rad(flightAngle)) * planeSpeed * -1 while(math.abs(velocityX) < 0.001)do velocityX = velocityX * 10 end while(math.abs(velocityY) < 0.001)do velocityY = velocityY * 10 end |
Solution 2
To correct this I modified code in the checkForNextPoint method. The new code only checks if the plane is close enough to the point, not if it has passed it.
Original Code:
1 2 | if( (velX < 0 and plane.x < dest.x and velY < 0 and plane.y < dest.y) or (velX > 0 and plane.x > dest.x and velY < 0 and plane.y < dest.y) or (velX > 0 and plane.x > dest.x and velY > 0 and plane.y > dest.y) or (velX < 0 and plane.x < dest.x and velY > 0 and plane.y > dest.y) or #plane.points == 0) then |
Modified Code:
1 | if( (math.abs(dest.x - plane.x) < 1) and (math.abs(dest.y - plane.y) < 1) or #plane.points == 0) then |
Brilliant! Whippin' out the Catmull splines!