Hai there!
First of all, this is my first time posting here, so excuse me if this is not the proper place to post this.
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?
The code is hosted on Github.
First game (newbie)
First game (newbie)
- Attachments
-
- pong.love
- (47.97 KiB) Downloaded 309 times
Re: First game (newbie)
Hello!nelmaven wrote:Hai there!
Welcome, and this is the right place to post this.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.
Terribly shocking. Nobody does Pong clones anymore (just kidding).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?
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)
Code: Select all
return ( love.window.getWidth() - ball.width ) / 2
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
Code: Select all
loop = function(dt)
Code: Select all
function field.draw()
Code: Select all
screen.paused = screen.playing
Overall you've done a good job, especially for a first game!
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: First game (newbie)
Nice. It certainly works, so that's a plus.
Here are some things that might improve it:
- Some indication of what the controls are.
- The game should wait for a moment and indicate what direction the ball will initially travel after a goal. It's easy to lose a puck near the top or bottom of the screen and have one or two more slide by before you can get back to the middle.
The only other thing I can think of is the paddle area could stand to be better defined in some way. It's a bit ambiguous where the game paddles are.
Some difficulty would also be nice, make rallies speed up the ball with each one slightly so that it's harder to keep up with and predicting the position is more useful
Here are some things that might improve it:
- Some indication of what the controls are.
- The game should wait for a moment and indicate what direction the ball will initially travel after a goal. It's easy to lose a puck near the top or bottom of the screen and have one or two more slide by before you can get back to the middle.
The only other thing I can think of is the paddle area could stand to be better defined in some way. It's a bit ambiguous where the game paddles are.
Some difficulty would also be nice, make rallies speed up the ball with each one slightly so that it's harder to keep up with and predicting the position is more useful
Re: First game (newbie)
@davisdude
First of all, thanks for the heartfelt welcome and for taking the time to look through the code and the tips.
... simple is better. Thanks!
--------------------------------
@Xkeeper
Hi! Thank you for the look in the game and for the feedback! Much appreciated!
Sorry for the long post.
First of all, thanks for the heartfelt welcome and for taking the time to look through the code and the tips.
davisdude wrote:Doesn't really make much of a difference, but, ya' know...
... simple is better. Thanks!
Globals are evil. Fixed this on the last revision. Well sorta, still have to decide how to handle the player objects defined on the "score" moduledavisdude wrote: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.
Fair point. Though in this case, the "loop" function is inside a complex object. I'm still trying to figure how to abstract the "screen" and the "mode" objects and move them to modules, which is a bit difficult because of the way they are called and the fact they need to access other local variables.davisdude wrote:main.lua
Your coding style is somewhat inconsistent. Sometime you make functions by doingother times you doCode: Select all
loop = function(dt)
Code: Select all
function field.draw()
Should've commented this one before but the case here is that I need to define a "paused" screen, but right now I only need it to be the equal to the "playing" screen. This will be changed later to show a game paused message.davisdude wrote:Not sure what you're dong with this either:Code: Select all
screen.paused = screen.playing
I guess this is because I come from an imperative background. You know, define everything before hand then call the main function.davisdude wrote:It seems sort of strange to have love.load at the end of the file, but that's your call.
Thanks! That means a lot!davisdude wrote:Overall you've done a good job, especially for a first game!
--------------------------------
@Xkeeper
Hi! Thank you for the look in the game and for the feedback! Much appreciated!
I guess a controls screen is on the wayXkeeper wrote:Some indication of what the controls are.
This is one of my goals but I'm not sure how to "pause the action"?Xkeeper wrote:The game should wait for a moment and indicate what direction the ball will initially travel after a goal.
Sorry, I don't understand what you mean by rallies.Xkeeper wrote:make rallies speed up the ball
Sorry for the long post.
Re: First game (newbie)
Rallies are a succession of consecutive hits. Basically, the longer you go, the faster the ball goes.
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: First game (newbie)
Oh I see. I do something similar already in which I slightly increase the ball speed with each successful hit of the pads, but this seems more interesting.
I was also thinking of adding speed pads to the field that activate when the player is able to score 3 goals in a row. They would then be active during X seconds and if the player is able to aim the disk at it, it would give a speed bost to his shot.
I was also thinking of adding speed pads to the field that activate when the player is able to score 3 goals in a row. They would then be active during X seconds and if the player is able to aim the disk at it, it would give a speed bost to his shot.
Who is online
Users browsing this forum: No registered users and 3 guests