Circlefade

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
rawr
Prole
Posts: 1
Joined: Thu Aug 05, 2010 4:35 pm

Circlefade

Post 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.
Attachments
circlefade.love
(872 Bytes) Downloaded 194 times
User avatar
Tesselode
Party member
Posts: 555
Joined: Fri Jul 23, 2010 7:55 pm

Re: Circlefade

Post by Tesselode »

I didn't understand all of the code, but nothing seems to wasteful.
User avatar
rhezalouis
Party member
Posts: 100
Joined: Mon Dec 07, 2009 10:27 am
Location: Indonesia
Contact:

[Response]Awesome!

Post by rhezalouis »

Hi rawr! :ultrahappy:

It's impressive! I like this! :awesome:
Wow, it looks like bokeh when you run the mouse wildly. :P
Yay, bokeh!
Yay, bokeh!
screenCapture.PNG (21.24 KiB) Viewed 2323 times
I am not an expert at this, but I hope some of these are useful: ^^
  1. Code: Select all

    --love.load
    spacing = .1
    --love.update
    counter = counter + 1
    Here, you increase counter by 1, thus the comparison here:

    Code: Select all

    if counter >= spacing then
    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;].
  2. 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())
    
  3. 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
  4. 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:
    [rawr]circlefade.love
    LOVE0.6.2
    (1.06 KiB) Downloaded 167 times
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. ^^
Aargh, I am wasting my posts! My citizenshiiiip... :o
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 68 guests