Help on gravity?

  • cat
    27th Sep 2014 Member 0 Permalink

    How would I make an element pull liquids/dust/broken things towards it, sorta like Black hole,

  • QuentinADay
    28th Sep 2014 Member 0 Permalink

    Okay i just remembered I made this: 

     

    local a = elements.allocate("SOMETHING" , "LOLOL")
    elements.element(elements.SOMETHING_PT_LOLOL, elements.element(elements.DEFAULT_PT_TTAN))
    elements.property(elements.SOMETHING_PT_LOLOL, "Name" , "LOLOL")
    elements.property(elements.SOMETHING_PT_LOLOL, "Description" , "Creates Gravitational Pull")
    function SOMEUPDATE(i,x,y,s,n)
    local xo = math.random(-5,5) local yo = math.random(-5,5)
    if tpt.get_property("type", x + xo, y + yo) ~= 0 then
    if tpt.get_property("tmp", x + xo, y + yo) == 1 then
    tpt.set_property("tmp", 1, x, y)
    end
    if tpt.get_property("tmp", x, y) == 1 then
    sim.gravMap(x/4, y/4, 10)
    function sprk(i,x,y,s,n)
    if tpt.get_property("ctype", x, y) == elements.SOMETHING_PT_LOLOL then
    tpt.set_property("tmp", 0, x, y)
    end
    end
    tpt.element_func(sprk,tpt.el.sprk.id)
    end
    end
    end
    tpt.element_func(SOMEUPDATE,elements.SOMETHING_PT_LOLOL)

     

    so if you type into console: !set tmp LOLOL 1 then it will start creating gravity and if you spark it afterwards it will turn off. Its a bit buggy and I'm not even sure why this works anymore and when i created it lol

    Edited 2 times by QuentinADay. Last: 28th Sep 2014