Asteroides source code

Here we go:
Single file: https://gist.github.com/1354610

Asteroides - Codea game - 1/10 - Alien.lua
http://pastebin.com/5E4cw9YJ

Asteroides - Codea game - 2/10 - Asteroid.lua
http://pastebin.com/3emG1vdu

Asteroides - Codea game - 3/10 - Cosmos.lua
http://pastebin.com/YYYQyU0r

Asteroides - Codea game - 4/10 - Explosion.lua
http://pastebin.com/yNuz1C2W

Asteroides - Codea game - 5/10 - Fire.lua
http://pastebin.com/XWAK3MD1

Asteroides - Codea game - 6/10 - FontByBortels.lua
http://pastebin.com/vFTdDgp5

Asteroides - Codea game - 7/10 - Loot.lua
http://pastebin.com/wAHDH8b4

Asteroides - Codea game - 8/10 - Main.lua
http://pastebin.com/Pm6uhBDT

Asteroides - Codea game - 9/10 - Ship.lua
http://pastebin.com/pHGetPLB

Asteroides - Codea game - 10/10 - Stars.lua
http://pastebin.com/vxaiZWMv

You can add a class copy-pasting the Fire class and design your own attack (like the example of the dungeon), and also a change for line 57 of Ship class:
if self.invulnDuration == 0 then

with:

if self.health == 0 then return end if self.invulnDuration == 0 then
and then add before the end of the last if…
if self.health == 0 then table.insert ( cosmos.explosions, Explosion:init(self.position,color(255,255,255,255),"Died") ) end

Some observations:

  1. I get giddy when I see the fonts used! :slight_smile:
  2. Pasting 10 source files is tedious. Fingers crossed for a real solution soon.
  3. Based on the video, nice looking! I’ll try it out for reals when I get home.

Interesting, it is not start and not highlighting an error that I may have made in the cut/pastes

Ok, i have concatenated all the files in a single one, you can try this:
http://pastebin.com/V25gCrUB

The real solution to copying and pasting is in the build sitting with Apple. You can simply upload .codea files straight from the app and import them from the web. Fingers crossed that it goes through.

It would be nice to see a video or tut
about that Simeon,… ah, a cool feature would be to have a fullscreen mode without console or the ability to move the left widgets in running mode :slight_smile:

Here a change for the alien class , to move in a sinusuidal mode xD

First line of Alien:draw(), add:

`
self.position.y = self.position.y + math.sin((self.position.x - 0.66)/33)

`

this is magic! haha

+1 for full screen mode (it’s been suggested before).

One question though - if you go to full screen mode, how do you get back out of the app? There is now presumably no “back” button anymore. I’m actually thinking hitting the home button and re-running Codea is reasonable, but ugly.

Which brings up a question: is there a way under program control to do “exit” or such, ie. to dump you out of the display and back into the editor? So that we could add a “quit to editor” button or hotspot or such on a fullscreen project?

Fullscreen mode would still have a single back button visible in one of the corners.

Bleah. Can’t say I like that; fullscreen should be fullscreen, no visible widgets at all (if you wanted to have a “hot corner”, meh, maybe, but please let us control where/when somehow). I’d much rather have an exit() call and I can manage it with touches or the like, or simply have someone hit Home to exit out.

It’s an aesthetic thing, as well as a “It’d be nice to hand this to my three year old and not have her push the buttons (she is a good button pusher) and get back to the code and have daddy have to fix it”.

Okay in that case the fullscreen API might need more features.

By default it will show an exit button. You’ll have to explicitly turn it off in order to have the potential to get “trapped” inside your code.

fullscreen( isFullscreen, showExitButton )

The showExitButton parameter would default to true.

more than reasonable; avoid surprise to someone unfamiliar, but allows us to avoid it if we know.

I’d still like a function that tells Codea, programatically, that I’ve pushed that button. (There’s a “shake to exit” concept in my brain…)

Yeah that would have to be in there in order to support a fullscreen mode with no exit button.

+1 to exit button in the corner to back and -1 to the parameter to show…

When you switch to fullscreen, what happens with the WIDTH and HEIGHT?.. it differs from iPad/iPad2?
I love to host these deep conversations about game programming :slight_smile:

WIDTH and HEIGHT would change to new values.

The parameter to show would be true by default, so:

fullscreen( true ) 

Will show the exit button.

fullscreen( true, false )

Will hide the exit button.

Added to wiki https://bitbucket.org/TwoLivesLeft/codea/wiki/UserContrib

Oh my gosh guys i have been looking for something like this forever, i got codea a llittle while ago and i am super determined to start coding…i thought the user interface would be a little more friendly and im having a little trouble with the rules of source code - so, i just want to know if i can directly import this into codea or if i can copy it in to check it out and mess around BUT i have no idea how, like should i use specific heading or make new pages for each group set up…confused

I think ive got it…

No genius here but what I do is copy each file and email it to myself from my desktop and save each file on the desktop to a Codea folder for archive purposes. I’m sure you could skip the desktop/laptop process and copy each file from your iPad while online.

Make sure the Main file goes into the Main tab in your project and add a tab (class) for each of the other files (named as each file is named) and copy them to each appropriate tab.

Most of the time the project runs without modifications but sometimes you have to troubleshoot some files to get them to work.

I haven’t seen this particular contribution so I haven’t tried to see if it still works in the current version of Codea.

Good luck and have fun.

Holy cow sorry for all the posts but i followed the full link and just copied it straight into the app and IT IS SOOO COOOL!!! Juaxix, how long have you been source coding for??? I am stoked to mess around and have some fun, thanks sooo much for posting this!!