Four hours of Love

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
mr_happy
Citizen
Posts: 84
Joined: Fri Mar 18, 2016 8:57 pm

Four hours of Love

Post by mr_happy »

Installed Love (how does one get those umlauts over the 'o' on a UK keyboard?) a little earlier on my Linux Mint 'tinkering machine'. Decided to try it with an IDE (I don't normally use such things) so I installed Zerobrane as well.

Four hours later and I've managed to learn enough Love/Lua to port the basics of my map generator (that I previously concocted in Processing and then ported to D/Allegro). I've even figured out modules, saving the map to a file, zooming via the mouse-wheel and debugging. Screeny attached. I didn't get any further with the game in its previous incarnations, but think I could press ahead with it in Love2D.

I have to say I'm quite impressed with how easy Love is to get into, how light it feels, even using Zerobrane, and how speedy it seems to be - I was expecting it to be much more sluggish. So, well done developers and wiki writers. :awesome:

A couple of questions about general coding style though: what is considered best practice with regard to naming - I rather like camelCase for variables (but can live with underscores), MixedCase for classes (don't know if I would use them in Lua, looks a bit obtuse to what I'm used to!) and UPPERCASE for constants (which don't seem to exist!). What does everyone else do?
Attachments
screenykins.png
screenykins.png (41.47 KiB) Viewed 3444 times
User avatar
Tesselode
Party member
Posts: 555
Joined: Fri Jul 23, 2010 7:55 pm

Re: Four hours of Love

Post by Tesselode »

mr_happy wrote: A couple of questions about general coding style though: what is considered best practice with regard to naming - I rather like camelCase for variables (but can live with underscores), MixedCase for classes (don't know if I would use them in Lua, looks a bit obtuse to what I'm used to!) and UPPERCASE for constants (which don't seem to exist!). What does everyone else do?
That's what I do. I feel like a lot of Lua is written with underscores, but underscores are ugly as sin. I don't know how anyone can stand them.
User avatar
mr_happy
Citizen
Posts: 84
Joined: Fri Mar 18, 2016 8:57 pm

Re: Four hours of Love

Post by mr_happy »

Cheers Tesselode, I'll stick with what I'm used to then.

mrUnderscoreHappy ( :awesome: )
User avatar
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Re: Four hours of Love

Post by Ranguna259 »

camelCase with the first letter as underscore FTW
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping :D

Check out my twitter.
User avatar
mr_happy
Citizen
Posts: 84
Joined: Fri Mar 18, 2016 8:57 pm

Re: Four hours of Love

Post by mr_happy »

Ranguna259 wrote:camelCase with the first letter as underscore FTW
That always gives me the impression of some sort of system thing I shouldn't mess with, dunno why. Makes them easier to spot I suppose...
User avatar
Beelz
Party member
Posts: 234
Joined: Thu Sep 24, 2015 1:05 pm
Location: New York, USA
Contact:

Re: Four hours of Love

Post by Beelz »

I do things weird, but it helps me to remember...

Code: Select all

CAMEL_CASE  -- Globals/debug
_camelCase  -- Constants
camelCase   -- Variables/functions/etc

Code: Select all

if self:hasBeer() then self:drink()
else self:getBeer() end
GitHub -- Website
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests