I need help with some graphical stuff

  • Ahpiox
    7th Apr 2018 Member 0 Permalink

    I want to make a element, that have random color on spawn, like quartz.

    It is possible?

    Edited once by Ahpiox. Last: 7th Apr 2018
  • jombo23
    7th Apr 2018 Member 0 Permalink

    nope

    Edited 4 times by jombo23. Last: 7th Apr 2018
  • jacob1
    7th Apr 2018 Developer 0 Permalink
    It's a bit more complicated, but you can do it. You need to use something like .tmp to store the color, have a check like:
    if sim.partProperty(0, "tmp") == 0 then
        sim.partProperty(0, "tmp", math.random(1,5))
    end


    This sets .tmp to a random value from 1 to 5 on creation.

    Then you need to create a graphics function, there is some information on that here: https://powdertoy.co.uk/Wiki/W/Lua_API:Elements.html#Properties

    return 0 as the first value (which means, don't cache result), then change some of the other values depending on .tmp