• Gwilty's Programming Assignments #1
    355 replies, posted
So Gwilty is learning to program. I thought I'd get him started using baby steps. If you want to learn along with him that would be cool too and feel free to use these threads to post your progress. I'm going to set him programming challenges which eventually will lead him to be as epic as coder as me. But you've got to crawl before you can walk. So the first challenge is this. [B]USE [URL="http://love2d.org/"]LOVE TO MAKE A BREAKOUT CLONE[/URL] (WITHOUT THE BRICKS)[/B] • Some kind of paddle at the bottom • Control the paddle with the mouse or the keyboard • Add a `Ball` • Ball moves of its own free will • Ball bounces from the top, left and right walls • Ball collides with the paddle [B]Extra Credit[/B] • Ball has gravity • Ball resets to center of screen when falls off the bottom • Any other self explored coolness [B]Skill Points Attainable[/B] • 10 Self Learning Points • 10 Lua Points • 10 Game Loop Points • 20 Game Logic Points • 10 Game Graphic Points [B]Deadline[/B] • Wednesday 26th October 2011
sounds pretty complex for a first assignment. Will you grade mine and give me feedback too
Sure.. it's not that complicated if you just work step by step.
I've never done game programming before and my web development ability is incredibly poor (even though I do it all the time and for money) so I think this will go badly, but I'm going to join in with this. I've always wanted to do game programming, it seems exciting. See you on the 26th Garry! I'm sure everyone will hate playing breakout by then, but it's a worthy cause.
Well, I'm a terrible coder... But sure I'll try.
What about people who dont even understand the basics of Lua itself? Add a link to necessary chapters of [url]http://lua.org/pil/[/url] Also, what do you mean by "add gravity" :P
[QUOTE=garry;32888172]Sure.. it's not that complicated if you just work step by step.[/QUOTE] That was sarcasm really, I didnt really plan on doing this, but who knows, maybe I will. Good luck to you all.
[QUOTE=TheAnyInbox;32888359]Also, what do you mean by "add gravity" :P[/QUOTE] Subtract anti-gravity Or make it so the ball accelerates downwards.
I think this should be ample motivation for me to get off my arse and start coding something productive. We shall see what I manage to produce.
Should be good to see everyone's efforts
What's the prize?
[QUOTE=nmagain;32888621]What's the prize?[/QUOTE] Knowledge, experience.
Let's see if I can keep up with Gwilty
A free breakout clone.
Great idea. Though I doubt people will have learned Lua from scratch by next wednesday.
There's lots of Love tutorials about - the best way to learn is to have a task and to do it. Not to sit down and read a website for 2 weeks before trying to do stuff.
Should I do it for fun? I don't know lua, so c++ / opengl? Think I can do that in time.
Following a tutorial now, I'll post my efforts!
I've used LÖVE before. It's really nice when you get used to Lua's [i]"unique"[/i] syntax.
Awesome idea. Good luck, gwilty! I might join in some of the later challenges.
This is great. [editline]21st October 2011[/editline] Better than the usual assignment in sschool.
This was the same challenge given to me for my 2nd year object oriented uni course, had to put in bricks and levels though, but they gave us weeks
Lua is so different from languages like Java or C++. It's confusing but yet looks so simple.
Progress! [img]https://img.skitch.com/20111021-k85gbtfd6wus1ndm2c48w273f2.jpg[/img] Oh yeah, for those not familiar with Lua or Love2D, heres a handy hint... When using the love system, if you assign them to variables you can increase your applications performance 30x ( or something like that ). Example: [code] g = love.graphics k = love.keyboard t = love.timer p = love.physics function love.load() end function love.update( dt ) end function love.draw() g.print( "Hello World!", 10, 10 ) end [/code] Now for the ball...
[QUOTE=Bambo.;32889768]Progress! [img]https://img.skitch.com/20111021-k85gbtfd6wus1ndm2c48w273f2.jpg[/img] Oh yeah, for those not familiar with Lua or Love2D, heres a handy hint... [B]When using the love system, if you assign them to variables you can increase your applications performance 30x ( or something like that ).[/B] Example: [code] g = love.graphics k = love.keyboard t = love.timer p = love.physics function love.load() end function love.update( dt ) end function love.draw() g.print( "Hello World!", 10, 10 ) end [/code] Now for the ball...[/QUOTE] It's nowhere near that high, but there is a slight speed increase.
[QUOTE=BlkDucky;32889785]It's nowhere near that high, but there is a slight speed increase.[/QUOTE] Ah ok, thanks for cleaning that for me. Also there are some cool tips in the Lua Gems book if anyone is really interested.
I wouldn't pay too much attention to optimization right now. You're going to be drawing 2 sprites.
[QUOTE=Bambo.;32889768]Progress! [img]https://img.skitch.com/20111021-k85gbtfd6wus1ndm2c48w273f2.jpg[/img] Now for the ball...[/QUOTE] Made some progress as well. The ball only moves to the side though. [img]http://i.imgur.com/QfSY8.png[/img]
[QUOTE=Bambo.;32889768]Oh yeah, for those not familiar with Lua or Love2D, heres a handy hint... When using the love system, if you assign them to variables you can increase your applications performance 30x ( or something like that ). Example: [code] g = love.graphics k = love.keyboard t = love.timer p = love.physics function love.load() end function love.update( dt ) end function love.draw() g.print( "Hello World!", 10, 10 ) end [/code] Now for the ball...[/QUOTE] For your example, the difference will be miniscule. Firstly, you'll want to use locals for everything that doesn't need to be shared as globals (which has the nice [I]side-effect[/I] of being slightly faster), especially with your poor choice of variable names (changed here): [lua] local graphics = love.graphics local keyboard = love.keyboard local timer = love.timer local physics = love.physics function love.load() end function love.update( dt ) end function love.draw() graphics.print( "Hello World!", 10, 10 ) end [/lua] If you want to optimize a tight loop, you want to do as few lookups as possible, such as in this example: [lua] do local print = graphics.print function love.draw() print("Hello World!", 10, 10) end end [/lua] Although it's a poor example, because your program will spend an incredibly small portion of its time in this love.draw function anyway.
[img]http://dl.dropbox.com/u/26976530/lifeharold.png[/img] I was gonna make the paddle rotate but that caused too much confusion
Sorry, you need to Log In to post a reply to this thread.