Page 1 of 1

First project with Lua and LOVE, would love some feedback if possible

Posted: Sat May 12, 2018 3:56 am
by SmugGoat
I wanted to get into some game development and I thought the best way would be to work from the ground up. Here is my mandatory Asteroids clone. Take a look at the code and give me some constructive criticism.

My background is in C++ and ARM Assembly so that's where I'm coming from.
asteroids.love
unzip to get at the source
(3.49 KiB) Downloaded 265 times

Re: First project with Lua and LOVE, would love some feedback if possible

Posted: Sat May 12, 2018 5:01 pm
by KayleMaster
Pretty good !

Definitely better than my first game. Anyways, you're not using any locals which means a lot of stuff is in the global namespace.
I've attached a reworked version of your game, literally runs the same, the only difference being that they're no globals anymore, except width and height in love.load.

Re: First project with Lua and LOVE, would love some feedback if possible

Posted: Sat May 12, 2018 5:47 pm
by NotARaptor
It's weird - the "global by default, implicit declaration" approach seems utterly wrong to me, coming from a c/c++ background too. I distinctly remember hating AS2 for this very reason.

I get where it comes from though, as it's mostly used as a scripting language.

Wish there was a "use strict" equivalent!

Re: First project with Lua and LOVE, would love some feedback if possible

Posted: Sat May 12, 2018 5:49 pm
by KayleMaster
There are some strict modules that warn when you write to the global namespace or something like that, google strict.lua

Re: First project with Lua and LOVE, would love some feedback if possible

Posted: Sat May 12, 2018 5:56 pm
by NotARaptor
Oh cool! I will look into that. I guess it makes sense; the global scope is a table, and if you can change its metatable you could detect writes. Thanks

Re: First project with Lua and LOVE, would love some feedback if possible

Posted: Thu May 17, 2018 2:00 am
by Darlex
Wow! This is your first game?! I just programmed a box with buggy collisions