Hey guys, i heard about love from the gobber assult game i saw on TIG source a while back and have been messing around in it a little. My programming experience is a bit on the low end but i have made a game or two in flash before. I thought love was really cool since i would be able to look at other peoples code which i always find interesting.
Anyway i made this fading circle demo, nothing too impressive i promise you! Give it a quick look if you are inclined and if you would've done anything differently. I use a lot of different arrays to track the position and color which seems like a little much to me, so i'm pretty sure there is a more efficient way of doing it.
Circlefade
Circlefade
- Attachments
-
- circlefade.love
- (872 Bytes) Downloaded 197 times
Re: Circlefade
I didn't understand all of the code, but nothing seems to wasteful.
- rhezalouis
- Party member
- Posts: 100
- Joined: Mon Dec 07, 2009 10:27 am
- Location: Indonesia
- Contact:
[Response]Awesome!
Hi rawr!
It's impressive! I like this!
Wow, it looks like bokeh when you run the mouse wildly. I am not an expert at this, but I hope some of these are useful:
It's impressive! I like this!
Wow, it looks like bokeh when you run the mouse wildly. I am not an expert at this, but I hope some of these are useful:
- Here, you increase counter by 1, thus the comparison here:
Code: Select all
--love.load spacing = .1 --love.update counter = counter + 1
always yields true, i.e. brushSpacing equals to dt [approx. 0.01].Code: Select all
if counter >= spacing then
I am guessing you intended to do something else [e.g. spacing = 0.01; counter = counter+dt;]. Code: Select all
if love.mouse.isVisible() then love.mouse.setVisible(false) else love.mouse.setVisible(true) end --into love.mouse.setVisible(not love.mouse.isVisible())
- You could place this mgreen valueCheck where the mgreen is changed [e.g. after "mgreen = mgreen + 10"]; so that it wouldn't be called on every update.
Code: Select all
if mgreen > 255 then mgreen = 0 elseif mgreen < 0 then mgreen = 255 end
- further, you could store the five variables (xpos, ypos, rc, gc, and bc) into one table so that you only need to operate table.insert and table.remove to a table instead of 5. [each time you remove the first member of a table (each call to table.remove(someTableWith100Members, 1)) would shift down the 99 members, i.e. 99+ operations.]
Here's an example:
Aargh, I am wasting my posts! My citizenshiiiip...
Who is online
Users browsing this forum: Google [Bot] and 1 guest