Great Love practice?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
dementia_patient567
Prole
Posts: 12
Joined: Sun Jan 27, 2013 6:00 am

Great Love practice?

Post by dementia_patient567 »

I've been messing around with Love2d and it's awesome. I'm getting the hang of it slowly but surely. This(
1942.love
(133.74 KiB) Downloaded 177 times
) abomination is the closest I've managed to making a "game" so far with just a little bit of practice. I didn't bother finishing it because there were too many things wrong with it. I just couldn't get things to work. Anyways. I was wondering if you guys had some really good practices to get people's programming up to par. Whether that means games to clone or what, idk. I go through Lua and Love tutorials/libraries for a little bit pretty often and I learn a few new things each time. I just really learn better through trial and error and practice rather than staring at tutorials and libraries all day(which I'm willing to do, and I do just that, but it just isn't as effective for me.)

Basically I'm just asking what things I could do in practice that would help me achieve my goals in programming in Love and in general.

Thanks guys!
User avatar
Saegor
Party member
Posts: 119
Joined: Thu Nov 08, 2012 9:26 am
Location: Charleroi

Re: Great Love practice?

Post by Saegor »

hello

your .love don't work because you zipped the main folder instead of all the files.
look at the bottom for a working version

some example tips :

you can replace this

Code: Select all

explosion= {}
explosion[1] = love.graphics.newImage("images/explode/ex1.png")
explosion[2] = love.graphics.newImage("images/explode/ex2.png")
explosion[3] = love.graphics.newImage("images/explode/ex3.png")
explosion[4] = love.graphics.newImage("images/explode/ex4.png")
explosion[5] = love.graphics.newImage("images/explode/ex5.png")
explosion[6] = love.graphics.newImage("images/explode/ex6.png")
explosion[7] = love.graphics.newImage("images/explode/ex7.png")
explosion[8] = love.graphics.newImage("images/explode/ex8.png")
explosion[9] = love.graphics.newImage("images/explode/ex9.png")
explosion[10] = love.graphics.newImage("images/explode/ex10.png")
explosion[11] = love.graphics.newImage("images/explode/ex11.png")
explosion[12] = love.graphics.newImage("images/explode/ex12.png")
explosion[13] = love.graphics.newImage("images/explode/ex13.png")
explosion[14] = love.graphics.newImage("images/explode/ex14.png")
explosion[15] = love.graphics.newImage("images/explode/ex15.png")
explosion[16] = love.graphics.newImage("images/explode/ex16.png")
explosion[17] = love.graphics.newImage("images/explode/ex17.png")
explosion[18] = love.graphics.newImage("images/explode/ex18.png")
explosion[19] = love.graphics.newImage("images/explode/ex19.png")
explosion[20] = love.graphics.newImage("images/explode/ex20.png")
explosion[21] = love.graphics.newImage("images/explode/ex21.png")
explosion[22] = love.graphics.newImage("images/explode/ex22.png")
explosion[23] = love.graphics.newImage("images/explode/ex23.png")
explosion[24] = love.graphics.newImage("images/explode/ex24.png")
explosion[25] = love.graphics.newImage("images/explode/ex25.png")
by this

Code: Select all

explosion = {}
for n = 1, 25 do
explosion[n] = love.graphics.newImage("images/explode/ex" .. n ..".png")
end
another tip : try to make again the same game, cause you will make inconsciently more optimizations to your code with the newly gained XP in Lua
Attachments
1942_w.love
(131.3 KiB) Downloaded 140 times
Current work : Isömap
User avatar
zorfmorf
Prole
Posts: 35
Joined: Sat Mar 10, 2012 12:31 pm

Re: Great Love practice?

Post by zorfmorf »

Essential things you should keep in mind:

- Just like in Saegor's example above, if you find yourself writing the same code again and again/ copy&paste a lot of code, this usually means that you can simplify your approach greatly
- Try to keep a clean, consistent style of code. Indent properly, use meaningful names for variables, define your global variables at the start of your file, etc
- Write lots of comments! Write a short explanation for every more complex piece of code. For every method, explain what the parameters are, what the method does/returns, how it (should) handle special cases
d_0o_d
Prole
Posts: 4
Joined: Wed Jan 30, 2013 7:20 pm

Re: Great Love practice?

Post by d_0o_d »

Yes, truly, the best thing you can do is practice your skills by coding stuff. Additionally you could read and modify code of some pro coders (ask for permission of course, but I don't think you get problems if you don't publish the modified code. It's just for the purpose of learning, right? ;) ).
Maybe you think at some point that there must be a way to make things easier and more clean, often that is the case. But to find this way, you may have to ask google or some nice people :)
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 210 guests