Hi.
My first post. A few months ago my 12 year old niece asked if I could teach her to program. An interesting question. I've been programming for more than 30 years so the answer should be yes. But what to teach her? Ideally she should be able to create something fun with relatively modest effort. And so I started striking candidates off the list. Eventually the page was empty so I knew I'd have to look further afield.
After much searching I stumbled across these pages about Löve 2D. I'd heard of Lua before in the context of Unity 3D. Since then I've found .lua files lurking all over the place. It's a lot more popular than I'd initially thought. Anyway, Löve 2D has proven to be an ideal vehicle to teach my niece to program. The asteroids game is the culmination of our first project together.
You can find some tutorials that I created for her on my web site at
http://www.dr-iguana.com/prj_love_and_lua/index.html
I'm still writing the last two tutorials but the code is complete. Hope you find it useful.
Cheers.
Dr Iguana
Writing an Asteroids game - Teaching a 12yo to program
-
- Prole
- Posts: 5
- Joined: Thu Jul 11, 2013 7:02 pm
Writing an Asteroids game - Teaching a 12yo to program
- Attachments
-
- AsteroidsInSpace.love
- The asteroids game all bundled.
- (4.42 MiB) Downloaded 288 times
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Writing an Asteroids game - Teaching a 12yo to program
Neat! So, how does your niece like programming so far?
Help us help you: attach a .love.
-
- Prole
- Posts: 5
- Joined: Thu Jul 11, 2013 7:02 pm
Re: Writing an Asteroids game - Teaching a 12yo to program
So far she's enjoying it a lot. She's a pretty motivated kid.
Learning to reuse code is a typical challenge. It takes a while to see how certain patterns reoccur in a program and how you can create one function instead. Still, I'm optimistic. She asks insightful questions so it's sinking in. She enjoys chess as well so perhaps she has the right 'kind' of mind (if there is such a thing) to enjoy programming. Certainly it's not everyone's cup of tea.
Learning to reuse code is a typical challenge. It takes a while to see how certain patterns reoccur in a program and how you can create one function instead. Still, I'm optimistic. She asks insightful questions so it's sinking in. She enjoys chess as well so perhaps she has the right 'kind' of mind (if there is such a thing) to enjoy programming. Certainly it's not everyone's cup of tea.
Re: Writing an Asteroids game - Teaching a 12yo to program
It's a nice little game! My one suggestion: either make it so that asteroids don't hit you when you're off the screen, or have the screen follow the player.
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
-
- Prole
- Posts: 5
- Joined: Thu Jul 11, 2013 7:02 pm
Re: Writing an Asteroids game - Teaching a 12yo to program
All good suggestions but I was trying to make a simple game. Also, this follows more closely the original game (pretty limited computers in those days).
I also though about adding passing power ups that would lure the player from the centre of the screen. But, the game has fulfilled its purpose as a teaching tool so I think I'll let it stand as is. But who knows, perhaps I'll be tempted in an idle moment.
Thanks.
I also though about adding passing power ups that would lure the player from the centre of the screen. But, the game has fulfilled its purpose as a teaching tool so I think I'll let it stand as is. But who knows, perhaps I'll be tempted in an idle moment.
Thanks.
Re: Writing an Asteroids game - Teaching a 12yo to program
I didn't know it was based off another game. Sorry about that...
It still is a pretty good game, especially for a first!
It still is a pretty good game, especially for a first!
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
Re: Writing an Asteroids game - Teaching a 12yo to program
Awesome! I started programming around that time too. Make sure to teach her good habits, I didn't get those being self taught. Took me 2 years to break free of all the bad habits (like editing code in notepad).
"your actions cause me to infer your ego is the size of three houses" -finley
- josefnpat
- Inner party member
- Posts: 955
- Joined: Wed Oct 05, 2011 1:36 am
- Location: your basement
- Contact:
Re: Writing an Asteroids game - Teaching a 12yo to program
First, I'd like to say this is fantastic!
I think asteroids is a daring subject to undertake, due to the trigonometry involved, but I still think it's a universally understandable result!
I have a few notes, if you're interested;
In chapter 1;
In chapter 2;
You use "The meaning of each is the text in gray."
Consider introducing comments here instead of on page three and chapter 5! Then you can document every following example.
In chapter 3;
"Finally, we modify the love.graphics.draw function."
Consider writing our your functions like this, so you can easily show the change, and you can comment each argument;
Also, it might make the chapter longer, but you ought to consider grouping chapter 3 and 4 together. It doesn't make sense to teach love.update incorrectly, and then correct it in the next chapter. Best to teach it right the first time around.
I chapter 4;
You have this one section in the code where you use "some trigonometry magic"
While I do not believe you can teach a 12 year old all of trig, I think you can teach a subset of trig effectively. Check this out!
Consider taking a chapter to teach this, considering you're teaching asteroids.
For chapter 6;
Be careful of double quotations. Your word proccessor is formatting them to open and closing double quotations, which do not parse correctly, and therefore your code is not copy-pastable.
I think asteroids is a daring subject to undertake, due to the trigonometry involved, but I still think it's a universally understandable result!
I have a few notes, if you're interested;
In chapter 1;
I would highly suggest making itFunction fred.washclothes()
To ensure that the student doesn't think that capitalization is like english.function fred.washclothes()
In chapter 2;
You use "The meaning of each is the text in gray."
Consider introducing comments here instead of on page three and chapter 5! Then you can document every following example.
In chapter 3;
"Finally, we modify the love.graphics.draw function."
Consider writing our your functions like this, so you can easily show the change, and you can comment each argument;
Code: Select all
love.graphics.draw(
spaceship[spaceship.useImage],
spaceship.xPos,
spaceship.xPos,
spaceship.direction, -- This is the direction, woo!
1,
1,
21,
36)
I chapter 4;
You have this one section in the code where you use "some trigonometry magic"
While I do not believe you can teach a 12 year old all of trig, I think you can teach a subset of trig effectively. Check this out!
Consider taking a chapter to teach this, considering you're teaching asteroids.
For chapter 6;
Be careful of double quotations. Your word proccessor is formatting them to open and closing double quotations, which do not parse correctly, and therefore your code is not copy-pastable.
Missing Sentinel Software | Twitter
FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
-
- Prole
- Posts: 5
- Joined: Thu Jul 11, 2013 7:02 pm
Re: Writing an Asteroids game - Teaching a 12yo to program
First I'd like to thank you for taking the time to write your thoughtful comments. I'll look through the tutorials, when I get a chance, and see how many of your suggestions I can incorporate.
Some of the roughness in the tutorials comes from the fact that I'm learning Love and Lua at the same time as writing the tutorials. I hadn't had the asteroids game in mind when I started teaching. Just moving things around the screen seemed sufficient payback to start. At the time I wasn't even aware of dt (delta time) being available in Love.
Once I started on the Asteroids game, and began adding more elements, the frame rate began to drop. The need for a delta time became obvious and I found out about dt via Google searches. This explains the 'fix' tutorial. It also prompted me to work ahead and finish the game before doing further tutorials so I could avoid too many more missteps.
I have to say that Love/Lua is remarkable environment for its simplicity and what you fun things you can accomplish with a small amount of code. I haven't pushed it hard yet so I don't know exactly where the walls are but it seems quite capable.
Some of the roughness in the tutorials comes from the fact that I'm learning Love and Lua at the same time as writing the tutorials. I hadn't had the asteroids game in mind when I started teaching. Just moving things around the screen seemed sufficient payback to start. At the time I wasn't even aware of dt (delta time) being available in Love.
Once I started on the Asteroids game, and began adding more elements, the frame rate began to drop. The need for a delta time became obvious and I found out about dt via Google searches. This explains the 'fix' tutorial. It also prompted me to work ahead and finish the game before doing further tutorials so I could avoid too many more missteps.
I have to say that Love/Lua is remarkable environment for its simplicity and what you fun things you can accomplish with a small amount of code. I haven't pushed it hard yet so I don't know exactly where the walls are but it seems quite capable.
Re: Writing an Asteroids game - Teaching a 12yo to program
sounds good, but love is not only an easy kids engine, it can also be used for more advanced and commercial games
Who is online
Users browsing this forum: No registered users and 3 guests