I'm bored... Up for a challenge

  • asdf123
    5th Oct 2012 Member 0 Permalink

    well..

    umm....

    it won't pressurise well

    .

     

    HELP!!!!

  • Shriek
    5th Oct 2012 Banned 0 Permalink
    This post is hidden because the user is banned
  • cyberdragon442
    5th Oct 2012 Banned 0 Permalink
    This post is hidden because the user is banned
  • coolcat99
    6th Oct 2012 Member 0 Permalink
    Make CAT, wanders around aimlessly and looks like a cat.
  • Box-Poorsoft
    6th Oct 2012 Banned 0 Permalink
    This post is hidden because the user is banned
  • carrots123
    7th Oct 2012 Member 0 Permalink

    i'll have mouse with that!

  • Box-Poorsoft
    7th Oct 2012 Banned 1 Permalink
    This post is hidden because the user is banned
  • asdf123
    9th Oct 2012 Member 1 Permalink

     

    Shriek: working on it..

     

     

    cyberdragon: you need lua ~ or something...

     

     

     

    .. Cat...

     

    Well you see it chases the mouse, and the mouse will get the cheese. 

     

    plenty of fail, plenty of infinite loops...

     

    and there must be cheese or mouse infiniteloops, there must be mouse or cat infiniteloops. i'll get the cat-shaped thing later.

     

    sigh...

     

     

    Here goes!

     

     

    tpt.el.dust.name="mous"
    tpt.el.dust.description="Squeak!"
    tpt.el.brel.name="cat"
    tpt.el.brel.description="Miaow!"
    tpt.el.spng.name="CHES"
    tpt.el.spng.description="Cheese for mouse."
    math.randomseed(os.time())
    function findcheese (i,x,y,s,n)
    a=math.random(1,611)
    b=math.random(1,383)
    while tpt.get_property("type",a,b)~=tpt.el.spng.id do
    a=math.random(1,611)
    b=math.random(1,383)
    end

    if x<a then
    tpt.set_property("vx",1,i)
    elseif x>a then
    tpt.set_property("vx",-1,i)
    else
    tpt.set_property("vx",0,i)
    end
    if y<b then
    tpt.set_property("vy",1,i)
    elseif y>b then
    tpt.set_property("vy",-1,i)
    else
    tpt.set_property("vy",0,i)

    end
    end


    function findmous (i,x,y,s,n)
    c=math.random(1,611)
    d=math.random(1,383)

    while tpt.get_property("type",c,d)~=tpt.el.dust.id do
    c=math.random(1,611)
    d=math.random(1,383)
    end
    e=x-c
    f=y-d
    if e==1 or e==-1 or e==0 then
    if f==1 or f==-1 or f==0 then
    tpt.delete(c,d)
    end
    end


    if x<c then
    tpt.set_property("vx",1,i)
    elseif x>c then
    tpt.set_property("vx",-1,i)
    else
    tpt.set_property("vx",0,i)
    end
    if y<d then
    tpt.set_property("vy",1,i)
    elseif y>d then
    tpt.set_property("vy",-1,i)
    else
    tpt.set_property("vy",0,i)

    end
    end

    function geteaten(i,x,y,s,n)
    j=math.random(-1,1)
    k=math.random(-1,1)
    if tpt.get_property("type",x+j,y+k)==tpt.el.dust.id then
    tpt.delete (i)
    end
    end

    tpt.element_func(findcheese,tpt.el.dust.id)
    tpt.element_func(geteaten,tpt.el.spng.id)
    tpt.element_func(findmous,tpt.el.brel.id)

     

     

     

     

  • Shadow79473
    18th Nov 2012 Member 0 Permalink

    @asdf123 (View Post)

     Okay now change this to be compatible with the latest version... because the line "tpt.el.NAME.name = 'name' " no longer works

  • jacob1
    18th Nov 2012 Developer 0 Permalink
    @Shadow79473 (View Post)
    it will be fixed in the next version though, they don't all need to be changed. Or, use a name that's already taken, that still works...