Can I clone or store a thing with THYME?

About advanced scenes, and the Thyme scripting language used in Algodoo.

Can I clone or store a thing with THYME?

Postby l4m2 » Fri Nov 28, 2014 5:59 pm

(e)=>{
scene.addciecle(e.this);
pos = [0, 0]
}

but it didn't work.
If I use (e)=>{u=e;} and let u global,when I attempt to see it,Algodoo crashes.
l4m2
 
Posts: 42
Joined: Fri Jun 27, 2014 6:21 am

Re: Can I clone or store a thing with THYME?

Postby Kilinich » Sun Nov 30, 2014 1:13 pm

scene.cloneEntityTo(entity,pos)
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: Can I clone or store a thing with THYME?

Postby l4m2 » Sun Nov 30, 2014 1:35 pm

Kilinich wrote:scene.cloneEntityTo(entity,pos)

It did work, but is it necessary to find a place far away to store them if i just want to use it later ?
l4m2
 
Posts: 42
Joined: Fri Jun 27, 2014 6:21 am

Re: Can I clone or store a thing with THYME?

Postby l4m2 » Sun Nov 30, 2014 1:44 pm

l4m2 wrote:
Kilinich wrote:scene.cloneEntityTo(entity,pos)

It did work, but is it necessary to find a place far away to store them if i just want to use it later ?

Iknownow.A thing in my can be used too. Thank you!
l4m2
 
Posts: 42
Joined: Fri Jun 27, 2014 6:21 am

Re: Can I clone or store a thing with THYME?

Postby l4m2 » Sun Nov 30, 2014 2:04 pm

But this shows no effect:
Code: Select all
(e)=>{
    (e.geom.timetolive > 0) ? {
        scene.addcircle({
            pos := e.geom.pos;
            a := e.geom;
            radius := 0.1;
            collideset := 2;
            drawcake := false;
            color := [1, 0, 0, 1];
            oncollide := (e)=>{
                e.other.materialName == "Floor" ? {
                    scene.cloneEntityTo(a, pos);
                    timetolive = -1
                } : {}
            }
        });
        e.geom.timetolive = -1
    } : {}
}

I want to make Pokemon balls.
l4m2
 
Posts: 42
Joined: Fri Jun 27, 2014 6:21 am

Re: Can I clone or store a thing with THYME?

Postby l4m2 » Sun Nov 30, 2014 2:10 pm

l4m2 wrote:But this shows no effect:
Code: Select all
(e)=>{
    (e.geom.timetolive > 0) ? {
        scene.addcircle({
            pos := e.geom.pos;
            a := e.geom;
            radius := 0.1;
            collideset := 2;
            drawcake := false;
            color := [1, 0, 0, 1];
            oncollide := (e)=>{
                e.other.materialName == "Floor" ? {
                    scene.cloneEntityTo(a, pos);
                    timetolive = -1
                } : {}
            }
        });
        e.geom.timetolive = -1
    } : {}
}

I want to make Pokemon balls.

Tested i found a not definded.Why?
l4m2
 
Posts: 42
Joined: Fri Jun 27, 2014 6:21 am

Re: Can I clone or store a thing with THYME?

Postby Kilinich » Mon Dec 01, 2014 1:58 am

I don't know what is pockemon balls but your code is bad)
What do you want to do?

Why check ttl? Object could not exist with negative ttl.
Why set it to -1? There is function scene.removeEntity().
Wtere is no "a" defined in onCollide then objcet call it, you should use e.this, e.this.pos in onCollide.
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: Can I clone or store a thing with THYME?

Postby l4m2 » Mon Dec 01, 2014 2:37 am

Kilinich wrote:I don't know what is pockemon balls but your code is bad)
What do you want to do?

Why check ttl? Object could not exist with negative ttl.
Why set it to -1? There is function scene.removeEntity().
Wtere is no "a" defined in onCollide then objcet call it, you should use e.this, e.this.pos in onCollide.

1.If not checked, a tick with two laser hitting on it(to make it good looking) make the code happened twice.
2.I don't know this command.
3.In Onlaserhit e.geom is used correctly. Byt no variable name can be used to store this.
l4m2
 
Posts: 42
Joined: Fri Jun 27, 2014 6:21 am

Re: Can I clone or store a thing with THYME?

Postby l4m2 » Mon Dec 01, 2014 2:56 am

Kilinich wrote:I don't know what is pockemon balls but your code is bad)
What do you want to do?

Why check ttl? Object could not exist with negative ttl.
Why set it to -1? There is function scene.removeEntity().
Wtere is no "a" defined in onCollide then objcet call it, you should use e.this, e.this.pos in onCollide.

I know what you mean in the last sentence now. Yet it in fact mean nothing.
l4m2
 
Posts: 42
Joined: Fri Jun 27, 2014 6:21 am

Re: Can I clone or store a thing with THYME?

Postby l4m2 » Mon Dec 01, 2014 3:02 am

I simplified the code as
Code: Select all
scene.addcircle({pos:=[0,0];a:=0;})

However there's still no a in the circle.
l4m2
 
Posts: 42
Joined: Fri Jun 27, 2014 6:21 am

Re: Can I clone or store a thing with THYME?

Postby l4m2 » Mon Dec 01, 2014 5:48 am

I made it. Necessary to use my.
l4m2
 
Posts: 42
Joined: Fri Jun 27, 2014 6:21 am


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 2 guests