nelmaven wrote:Hai there!
Hello!
nelmaven wrote:First of all, this is my first time posting here, so excuse me if this is not the proper place to post this.
Welcome, and this is the right place to post this.
nelmaven wrote:The game it's a Pong clone (shocking, right?) and this is my first time diving into Lua and LÖVE so I would like to ask for opinions, on the game and on the code. Pretty please?
Terribly shocking. Nobody does Pong clones anymore (just kidding).
Anyway, here are my comments:
I like how you have all of your pictures in the pictures folder, etc. It leads to good organization, and keeps everything nice and clean.
As for the code, here it goes:
ball.lua
Just some math here, doesn't really matter, but:
Code: Select all
return (love.window.getWidth() / 2) - (ball.width / 2)
is the same as
Code: Select all
return ( love.window.getWidth() - ball.width ) / 2
Doesn't really make much of a difference, but, ya' know...
If I were you, I would make ball.rotation a value, just to avoid hard-coding information. It makes it easier to edit in the long run.
Same with most all straight-up numbers. Good habit to get into.
field.lua
You make
field a global table. If I were you, I would do the same thing I did for ball, which is make a local table, then return it.
Same for pad, collision, field, score, title, and menu.
main.lua
Your coding style is somewhat inconsistent. Sometime you make functions by doing
other times you do
Not sure what you're dong with this either:
It seems sort of strange to have love.load at the end of the file, but that's your call.
Overall you've done a good job, especially for a first game!