Help with a cannon

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

Help with a cannon

Postby mbartelsm » Wed May 26, 2010 11:24 pm

I'm making a cannon but I don't want to fire the bullets with magnets, and I want to add a 36 bullet limit
mbartelsm
 
Posts: 9
Joined: Tue May 25, 2010 2:57 am

Re: Help with a cannon

Postby Chronos » Wed May 26, 2010 11:32 pm

TheWinkits wrote:They both looks of cuking amazing
User avatar
Chronos
[Most Active Member 2010]
 
Posts: 4457
Joined: Mon Aug 31, 2009 6:00 pm
Location: Californania

Re: Help with a cannon

Postby mbartelsm » Wed May 26, 2010 11:56 pm

Would be great not to read the entire tutorial
mbartelsm
 
Posts: 9
Joined: Tue May 25, 2010 2:57 am

Re: Help with a cannon

Postby Chronos » Thu May 27, 2010 2:24 am

Just read it. It'll help you in the long run.
TheWinkits wrote:They both looks of cuking amazing
User avatar
Chronos
[Most Active Member 2010]
 
Posts: 4457
Joined: Mon Aug 31, 2009 6:00 pm
Location: Californania

Re: Help with a cannon

Postby mbartelsm » Thu May 27, 2010 4:52 am

I'll read it but in the mean time can anybody help me, I want to finish this soon
mbartelsm
 
Posts: 9
Joined: Tue May 25, 2010 2:57 am

Re: Help with a cannon

Postby mbartelsm » Thu May 27, 2010 6:06 am

never mind, but i have this and it doesn't create the tracers
Code: Select all
(e)=>{
    scene.addcircle({
        radius := 0.06;
        density := 12;
        pos := e.pos;
        color := [1.0, 0.9763333, 0.29000002, 1.0];
        drawcake := false;
        attraction := -10000;
        collideset := 64;
        onhitbylaser := ((e)=>{attraction = 0})
    });
    scene.addpen({
        size := 0.11;
        color := [0.8580386, 0.8580386, 0.8580386, 0.175];
        fadetime := 1.0
    });
    scene.addpen({
        size := 0.1;
        color := [1.0, 0.8333333, 0.0, 0.735];
        fadetime := 0.4
    });
    scene.addpen({
        size := 0.09;
        color := [0.8580386, 0.8580386, 0.8580386, 0.37];
        fadetime := 0.6
    });
    scene.addpen({
        size := 0.08;
        color := [0.8580386, 0.14300644, 0.0, 0.682];
        fadetime := 0.1
    })
}


I'm an idiot, i forgot the "pos := e.pos"
mbartelsm
 
Posts: 9
Joined: Tue May 25, 2010 2:57 am

Re: Help with a cannon

Postby Mystery » Thu May 27, 2010 1:06 pm

mbartelsm wrote:Would be great not to read the entire tutorial

If you can't be bothered to put in any sort of effort why should we helps you.

@Chronos.
Don't just the Thyme tutorial card actually try and help.
User avatar
Mystery
 
Posts: 2802
Joined: Thu Sep 03, 2009 1:16 pm
Location: Southern Australia

Re: Help with a cannon

Postby Nxdt » Thu May 27, 2010 1:45 pm

Your not exactly helping either.
In the code you need to specify the position of the tracers. Use;
Code: Select all
pos := e.pos


For the nuber of bullets you need to create a varible.
eg;
Code: Select all
Scene.my.Bulletcount = 36
Type that into the console. (Press F11 to open it)

Then create an if statement where if scene.my.bulletcount = 0 then it won't fire.
This should be the completed code;
Code: Select all
    (e)=>{scene.my.bulletcount == 0 ? {} : {scene.addcircle({
            radius := 0.06;
            density := 12;
            pos := e.pos;
            color := [1.0, 0.9763333, 0.29000002, 1.0];
            drawcake := false;
            attraction := -10000;
            collideset := 64;
            onhitbylaser := ((e)=>{attraction = 0})
        });
        scene.addpen({
            pos := e.pos;
            size := 0.11;
            color := [0.8580386, 0.8580386, 0.8580386, 0.175];
            fadetime := 1.0
        });
        scene.addpen({
            pos := e.pos;
            size := 0.1;
            color := [1.0, 0.8333333, 0.0, 0.735];
            fadetime := 0.4
        });
        scene.addpen({
            pos := e.pos;
            size := 0.09;
            color := [0.8580386, 0.8580386, 0.8580386, 0.37];
            fadetime := 0.6
        });
        scene.addpen({
            pos := e.pos;
            size := 0.08;
            color := [0.8580386, 0.14300644, 0.0, 0.682];
            fadetime := 0.1
        })}
User avatar
Nxdt
 
Posts: 1019
Joined: Mon Aug 31, 2009 6:32 pm
Location: Scotland!

Re: Help with a cannon

Postby mbartelsm » Fri May 28, 2010 8:59 am

Thank you, i just didn't know how to create the "if"
mbartelsm
 
Posts: 9
Joined: Tue May 25, 2010 2:57 am

Re: Help with a cannon

Postby Nxdt » Fri May 28, 2010 10:33 am

Okay, Does it work now?

If statements go like this,

{If}?{Then}:{Else}

> More than
< Less than
>= Equal to or More than
<= Equal to or less than
== Equal to
!= Not Equal to
User avatar
Nxdt
 
Posts: 1019
Joined: Mon Aug 31, 2009 6:32 pm
Location: Scotland!

Re: Help with a cannon

Postby Matten » Fri May 28, 2010 5:55 pm

Nxdt wrote:Okay, Does it work now?

If statements go like this,

{If}?{Then}:{Else}

> More than
< Less than
>= Equal to or More than
<= Equal to or less than
== Equal to
!= Not Equal to

You haven't put the {} around the statement.
Cave Johnson wrote:Do you know who I am? I'm the man who's gonna burn your house down! With the lemons! I'm gonna get my engineers to invent a combustible lemon that burns your house down!
User avatar
Matten
 
Posts: 435
Joined: Mon Apr 05, 2010 2:03 pm
Location: The Netherlands

Re: Help with a cannon

Postby Mystery » Sat May 29, 2010 1:26 am

But for the sake of simplicity it is easier to teach them with the {} Not only that but it make your code easier to read and edit.
User avatar
Mystery
 
Posts: 2802
Joined: Thu Sep 03, 2009 1:16 pm
Location: Southern Australia

Re: Help with a cannon

Postby Nxdt » Tue Jun 01, 2010 8:59 pm

If people are inserting that into code then the curly brackets wouldn't be around the statement but around everything. People might assume that is right way to write the statement and mess up.
User avatar
Nxdt
 
Posts: 1019
Joined: Mon Aug 31, 2009 6:32 pm
Location: Scotland!


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 14 guests