Color Cycling DMND

  • Videogamer555
    2nd Jan 2012 Member 1 Permalink
    This code makes DMND do color cycling via decoration color. I think it looks kinda cool.

    function rbow_update(i, x, y, s, n)
    tpt.set_property("tmp",tpt.get_property("tmp",i)+8,i)
    if tpt.get_property("tmp",i)==256 then
    tpt.set_property("tmp",0,i)
    end
    cindex=tpt.get_property("tmp",i)
    tpt.set_property("dcolour",math.floor(math.sin(cindex*3.14159/127.5)*128+128)+math.floor(math.sin(cindex*3.14159/127.5+2.0944)*128+128)*0x100+math.floor(math.sin(cindex*3.14159/127.5+4.1888)*128+128)*0x10000+0xff000000,i)
    end
    tpt.element_func(rbow_update, tpt.el.dmnd.id)
  • eternity
    2nd Jan 2012 Member 0 Permalink
    @Videogamer555
    nnnnnnniiiiiiiicccccceeeee

    i like it
  • Videogamer555
    2nd Jan 2012 Member 0 Permalink
    Thanks.


    Here's some code to make it just give random "white noise".

    math.randomseed(os.time())
    function rbow_update(i, x, y, s, n)
    tpt.set_property("dcolour",math.random(0,0xffffff)+0xff000000,i)
    end
    tpt.element_func(rbow_update, tpt.el.dmnd.id)





    And this combines the 2 other pieces of code in this forum thread to give random noise but always at full color saturation.
    math.randomseed(os.time())
    function rbow_update(i, x, y, s, n)
    cindex=math.random(0,255)
    tpt.set_property("dcolour",math.floor(math.sin(cindex*3.14159/127.5)*128+128)+math.floor(math.sin(cindex*3.14159/127.5+2.0944)*128+128)*0x100+math.floor(math.sin(cindex*3.14159/127.5+4.1888)*128+128)*0x10000+0xff000000,i)
    end
    tpt.element_func(rbow_update, tpt.el.dmnd.id)
  • RadioActiveLua
    10th Dec 2013 Member 0 Permalink

    @Videogamer555 (View Post)

     I used your rainbow on my mod. I'll give credit. Sorry for necroing.