Speed Shooter Earth

Video of the game:
http://www.youtube.com/watch?v=dCOP-Tj24k4

Source code here:
https://gist.github.com/2900292

You may want to change the GPS coordinates, then open MainMenu class and set them in the array self.places.
Google Maps use different sizes along the map for different zones of the World, so you need to set up correctly the amount of change in the latitude, this is the speed in the array.

The video is slower than the final FPS of the game

Wow!! :smiley: Better than my code.

But can you give us the Google Map’s code [-O<

I dont understand @Connorbot999 , what plan?..
Look at the code, in the Scroller class, all the magic is there ,no secrets.

http.get( 
        "http://maps.googleapis.com/maps/api/staticmap?"..
        "center="..self.lat..","..self.long.."&zoom=15&size="..
        WIDTH.."x".. (HEIGHT*2).."&maptype=satellite&sensor=true"
        , 
        didGetBg
    )

self.lat and long is the latitude and longitude GPS coordinates…then you can get an image, like this one:

http://maps.googleapis.com/maps/api/staticmap?center=40.494000,-3.558000&zoom=14&size=1024x1024&maptype=satellite&sensor=true

When the global function didGetBg handles the result of the operation it stores the image in the class variable of the current turn.
There are only 2 images, the first time you run the program it downloads the first coordinate image from gmaps, and start the scrolling down, in the first limit of the y axis it begin caching the second image and in the second limit, the first image is down the visible screen so you have to re-positionate this one to keep the image progress ,change the turn and cache the next image in the first one ,then again, check limits and move to the first turn one more time…

The 3 configured scenarios of the game are airports…

Real time video:

http://www.youtube.com/watch?v=L5y_R4vgNOg

Awesome work, @juaxix. Very clever idea.

Brillant !

Very nice, that touch of reality, and a nifty demo of the HTTP API.

Two slightly off-topic things:

You are using x for latitude and y for longitude, that’s strange. In my eyes y goes to the poles, not around the equator. I know that x and y are the names of the vector components and simply placeholders because what you really wanted was a tuple (I think so), but now that they have such associative names, it might be a neat idea to use the association properly (to not confuse the interested reader of your code).

Where do all these UTF8 spaces in the gist come from? Directly out of Codea? They (a) don’t look good and (b) make running scripts on the PC difficult, Löve complains about such characters. Not too difficult, I have a script that does the translation work for me, but it’s unnecessary. (And no, I’m not running the game in Löve, it doesn’t have a web API, but this is not the first time that I found these damn spaces.)

You can make any change to the code (vía comment or trunk via gist) and publish it :slight_smile:
The UTF8 spaces come directly from Codea, i copy-paste the code to the web.

I believe those non-breaking spaces come from iOS when the text content gets copied. Codea replaces those characters when they come in from the pasteboard (because Lua doesn’t like them, as you say). I’m not sure why iOS inserts them.

Aha, thanks for the explanation, i had no idea of this iOS “feature”…

This code doesn’t work properly. It scrolls for a bit then black screen scrolls up and it stays black.

I suspect a slight change has been made to the googleapi but I’m not sure. I’m wondering if there is a quick fix.

I modified the code to use the current GPS location. That works nicely in Codea 2.0.

@inoddy - the last post was nearly 2 years ago, so I’m not surprised the code broke.

I suggest you start a new thread for cases like this.