Page 1 of 1
Circlefade
Posted: Thu Aug 05, 2010 4:47 pm
by rawr
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.
Re: Circlefade
Posted: Thu Aug 05, 2010 5:43 pm
by Tesselode
I didn't understand all of the code, but nothing seems to wasteful.
[Response]Awesome!
Posted: Fri Aug 06, 2010 6:30 am
by rhezalouis
Hi rawr!
It's impressive! I like this!
Wow, it looks like bokeh when you run the mouse wildly.
- Yay, bokeh!
- screenCapture.PNG (21.24 KiB) Viewed 2468 times
I am not an expert at this, but I hope some of these are useful:
Code: Select all
--love.load
spacing = .1
--love.update
counter = counter + 1
Here, you increase counter by 1, thus the comparison here: always yields true, i.e. brushSpacing equals to dt [approx. 0.01].
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:
You could play more with the methods to change the values (e.g. on LMB, green changes based on the mousePos, alpha value, trail value, spacing, circle radius, etc). Maybe you could make a game out of this.