Basic Games programming --> LUA ? :)

Guys! Codea is totally awesome… Im using it to teach my son (9) to program.

So I started thinking back to when I learned to program. ( Basic in 2nd grade on an AppleII+ ).

Remember this type of stuff?

Remember all those old books with Basic recipes in it for simple but cool games that forced you to work ( by typing the game in! ) to get a game?

Im wondering if anyone is up for converting some of this stuff into LUA for Codea? Or if anyone has tutorials online that are similar to these? Ive been playing with the tutorials/examples built in to the app and they are good… but there could be a lot more - and with smaller incremental steps for the younger audience who is for the first time learning.

Thoughts? Just seeing if anyone out there is also looking for this stuff.



theres a few more of these out there…would be great to see this kind of material reWritten for LUA / Codea.

This sounds like a great idea (my eldest is nearly 8 so maybe soon for him, and I have fond memories of copying BBC and CBM64 programs from magazines).

We have some tutorials on the wiki, I don’t think that there’s anything quite like what you propose yet, but I think that the wiki would be a great place to post them.

(There’s always the problem that these days one can just cut-and-paste code so it should be emphasised that it is important to type it in yourself to get the most out of it.)

Exactly! :wink: Typing it in forced you to somewhat read it… and the mistakes in typing helped you to accidentally learn what something does at times. Its amazing how much we have evolved away from that whole process…most kids just know how to plug in a game developed by a team of 100s of guys and mash buttons. So far removed from the understanding of what it takes to make those things - we have crippled them in a sense…and most computers don’t have a simple easy environment from which to learn the basics even. Dumping a kid into a Unix command line does not constitute a good initial experience…

I feel like Codea is a step back in the right direction - you will spawn a whole generation of great programmers with this app. Great stuff.

I guess one would probably want a proper keyboard to make it a bit easier on the kid.

I also like the idea of it being like a “magazine”, though that might be hard to keep up. Maybe starting with some simple programs that nonetheless actually do something interesting.

(I wish I’d kept all those magazines now. Can’t even remember what they were called so can’t search the internet for back issues. There were some great programs. I still remember the sense of achievement when I managed to port a CBM64 Basic program for drawing julia sets into fortran.)

I still have that book from my C64 days. At least I think I do, I believe I put it on the keep pile during spring cleaning.

Those example are texted based. Some of which can be repurposed to graphical. Some will be fine just using the print() window. Others may require for us to make a scrolling text window class to simulate command line print kind of interaction (or a command to expand the print window to the main screen).

Sounds like fun.

I think it would be more effective to build a new set of programs with the same level of simplicity, but which take advantage of Codea’s graphic nature—maybe some of them could retain logic from these BASIC programs.

Sounds like great fun and a great way to learn!

Couldn’t agree more. I’m using Codea to teach my 8 year old girl how to program and I couldn’t believe the progress we made. I tried first to teach her using Corona and although we got some cool stuff going, she never had the satisfaction she had with this software. Which made me think of these old BASIC programs, and judging from these comments I’m not the only one!

I think the idea of resurrecting some of the old classics is great - the only problem we currently face is the lack of text output to the main area :frowning:

But I’m sure that will be remedied soon - I hope.

Simple but nice text output AND text input. Maybe somekind of screenMode() or something. Or, we could wait for @Bortels console program. :slight_smile:

Until there is a keyboard/console I was thinking Battle (battleship)

It doesn’t require text and can be done with drawing.

So the question becomes how do you present it? Providing the text would be a simple cut and paste. It could be done as a tutorial a piece at a time but it seems a long task with no immideate postive feedback.

Possibly there should be a set of tutorials that are more fun centered. The question is what is fun.

Possibly a good starting point would be “hopper”. It would be a sprite that when touched hops (actually just changes position). From there more realistic hops, screen edges, relative movement, multiple characters, gravity, and sound could be added. Once they get though that seris more complex example could be added.

Coming someday…

  • Setting the Stage – adding the background sprite
  • Introducing Spritey – adding a sprite to the screen (using numbers)
  • X marks the spot – controlling a sprite’s position with a variable
  • Run, Spritey, Run – moving a sprite on it’s own
  • Here, Spritey, Here – moving a sprite to your finger
  • Hang on Spritey – moving a sprite with gravity
  • Stay, Spritey, Stay – having a sprite remember it’s position
  • Super Spritey Grow Power – stretching a sprite
  • Laser Spritey – drawing a line from a sprite to somewhere
  • Speak, Spritey, Speak – printing

This may be similar to taking 378 pages to prove 1+1=2 ( but it’s worth a try

Sound like a terrific approach. Step by step adding skills.

  • Something New – making a new program
  • The Secret Rectangle – keeping drawing working
  • Setting the Stage – adding the background sprite
  • Introducing Spritey – adding a sprite to the screen (using numbers)
  • Hide and Seek – comments

5 down 373 to go…

  • More Hide and Seek – draw order
  • Go, Spritey, Go – sprite position
  • X marks the spot – controling a sprite’s position with a variable
  • Run, Spritey, Run – math in the draw loop
  • Speak, Spritey, Speak – printing
  • Super Spritey Grow Power – stretching a sprite

11 of 378 (although I’ve already gotten to 1+1)

  • Zombie Spritey – tinting

… new section …

The Adventures of Spritey continue

These are not hard, but, do require a little more work to see new adventures.

  • Watching Spritey – watching numbers
  • Here, Spritey, Here – moving a sprite to your finger
  • Hang on Spritey – moving a sprite with gravity
  • Blowing Bubbles – using ellipse

16 of 378

Thanks, it’s even good for much much older kids.
Looking forward to further tutorials.

I’ve made a couple of formatting changes to the first two, and would like to know what you think before doing any more. The main change is to get rid of the “hard” spaces used for indentation of the code. They look as though they are in some way “special” but they’re just a feature of how copy-and-paste works on the iPad so are potentially confusing.

The other main change (there were a few other minor ones) is in the second tutorial. The rect(0,0,10,10) should be in code formatting, but should also stand out from the surrounding code. I put it in its own code block, but I’m not overly happy with how it looks. There are a few different ways to achieve the desired end and I’m not sure which is best (but I think that the tutorials should be consistent).

One would be to write “Add the line rect(0,0,10,10) in the draw function just before the background line so that the entire code looks like: …” and then put the full code. Maybe with the added lines looking like:

rect(0,0,10,10) -- <-- new line

Thx @JunkMail

Looks good @Andrew, thx , I’ll run back though them later before making more and switch to that style.