Another Scripting Problem...

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

Another Scripting Problem...

Postby o0shadow0o » Fri Feb 12, 2010 7:04 pm

i am trying to remake a game called Color Infection and i cannot make the script for the brown balls function correctly!
this is the code i am using;
Code: Select all
(e)=>{
    e.other.color == [1, 1, 0, 1] ? {e.other.color = [0.5, 0.25, 0, 1]} : {e.other.color == [1, 1, 0, 1]}(:)({});     e.other.onCollide = e.this.onCollide }



If anyone has a solution it would help me a lot... :lol:
Image Made In PHUN And PHOTOSHOP CS4
User avatar
o0shadow0o
 
Posts: 14
Joined: Fri Feb 05, 2010 7:09 pm

Re: Another Scripting Problem...

Postby Kilinich » Fri Feb 12, 2010 7:18 pm

Code: Select all
(e)=>{
    (e.other.color == [1, 1, 0, 1]) ? {e.other.color = [0.5, 0.25, 0, 1]} : {e.other.color == [1, 1, 0, 1];     e.other.onCollide = e.this.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: Another Scripting Problem...

Postby o0shadow0o » Fri Feb 12, 2010 7:46 pm

i try that and when the brown balls touch the yellow or green balls not only do the brown balls not change the yellow/green balls color, but they make all parts of the scene it touches have the same oncollide.
i want all green/yellow balls any brown ball touches to turn brown and have the same oncollide.
basically it only works once, after that bothe involved balls have the oncollide;
Code: Select all
(e)=>{
    e.other.color == [1, 1, 0, 1] ? {e.other.color = [0.5, 0.25, 0, 1]} : {e.other.color == [1, 1, 0, 1]}(:)({});     e.other.onCollide = e.this.onCollide }
Image Made In PHUN And PHOTOSHOP CS4
User avatar
o0shadow0o
 
Posts: 14
Joined: Fri Feb 05, 2010 7:09 pm

Re: Another Scripting Problem...

Postby standardtoaster » Fri Feb 12, 2010 8:03 pm

Code: Select all
(e)=>{
        e.other.color == [1, 1, 0, 1] ? {e.other.color = [0.5, 0.25, 0, 1]} : {e.other.color == [0, 1, 0, 1] ? {e.other.color = [0.5, 0.25, 0, 1]} : {}} ;     e.other.onCollide = e.this.onCollide }

I believe this is what you were trying to achieve. :)
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: Another Scripting Problem...

Postby o0shadow0o » Fri Feb 12, 2010 8:08 pm

that works, however, if a brown ball hits the peice of ground on which the yellow/green balls are on, they give the floor the code but not the color, and all balls turn brown.
i only want the code to affect yellow/green balls or it doesnt work...
Image Made In PHUN And PHOTOSHOP CS4
User avatar
o0shadow0o
 
Posts: 14
Joined: Fri Feb 05, 2010 7:09 pm

Re: Another Scripting Problem...

Postby standardtoaster » Fri Feb 12, 2010 10:02 pm

That's easy enough to do. All you need is another comparison.
Code: Select all
    (e)=>{
            e.other.color == [1, 1, 0, 1] && e.other + "" == "circle" ? {e.other.color = [0.5, 0.25, 0, 1]} : {e.other.color == [0, 1, 0, 1] ? {e.other.color = [0.5, 0.25, 0, 1]} : {}} ;     e.other.onCollide = e.this.onCollide }
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: Another Scripting Problem...

Postby o0shadow0o » Sat Feb 13, 2010 9:23 am

no... same problem as before, all balls touching the arena turn brown
seeing as i only need to change balls, would there be a way just to change circles, not polygons or boxes.
that seems easier... :)
Image Made In PHUN And PHOTOSHOP CS4
User avatar
o0shadow0o
 
Posts: 14
Joined: Fri Feb 05, 2010 7:09 pm

Re: Another Scripting Problem...

Postby standardtoaster » Sat Feb 13, 2010 5:43 pm

Sorry about that again. I forgot to put the added comparison into all of the ifs.
Code: Select all
        (e)=>{
                e.other.color == [1, 1, 0, 1] && e.other + "" == "circle" ? {e.other.color = [0.5, 0.25, 0, 1]} : {e.other.color == [0, 1, 0, 1 && e.other + "" == "circle"] ? {e.other.color = [0.5, 0.25, 0, 1]} : {}} ;     e.other.onCollide = e.this.onCollide }
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: Another Scripting Problem...

Postby o0shadow0o » Sat Feb 13, 2010 9:06 pm

nope... still doesnt work.

here it is.

http://www.algodoo.com/algobox/details.php?id=37792

:(
Image Made In PHUN And PHOTOSHOP CS4
User avatar
o0shadow0o
 
Posts: 14
Joined: Fri Feb 05, 2010 7:09 pm

Re: Another Scripting Problem...

Postby standardtoaster » Sat Feb 13, 2010 9:58 pm

Code: Select all
            (e)=>{
                    e.other.color == [1, 1, 0, 1] && e.other + "" == "circle" ? {e.other.color = [0.5, 0.25, 0, 1]} : {e.other.color == [0, 1, 0, 1 ]&& e.other + "" == "circle" ? {e.other.color = [0.5, 0.25, 0, 1]} : {}} ;     e.other.onCollide = e.this.onCollide }
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: Another Scripting Problem...

Postby blahblah200 » Sun Feb 14, 2010 3:49 pm

So, let me get this straight:
You want the Yellow/Green balls to turn brown and turn other Yellow/Green balls brown, and so on.
You don't want the arena to have the OnCollide of the brown balls.

Is that right?
If so, here is the code and the scene:
Rating: rated 5
Filesize: 30.56 kB
Comments: 0
Ratings: 1
download

Code: Select all
(e)=>{
    e.other.color == [1, 1, 0, 1] ? {         e.other.color = [0.5, 0.25, 0, 1];         e.other.oncollide = e.this.oncollide     } : {         e.other.color = [0, 1, 0, 1] ? {             e.other.color = [0.5, 0.25, 0, 1];             e.other.oncollide = e.this.oncollide         } : {}     } }
Image<-- Made with GIMP
User avatar
blahblah200
 
Posts: 61
Joined: Tue Sep 01, 2009 11:33 am
Location: Somewhere over the rainbow...

Re: Another Scripting Problem...

Postby Cs24 » Mon Feb 15, 2010 6:58 am

Filesize: 14.54 kB
download


our scripts look the same (blah blah 200) but somehow your, i think is a little broken

script on brown circle
Code: Select all
(e)=>{
    e.other.color == [0, 1, 0, 1] ? {         e.other.color = e.this.color;         e.other.oncollide = e.this.oncollide     } : {};     e.other.color == [1, 1, 0, 1] ? {         e.other.color = e.this.color;         e.other.oncollide = e.this.oncollide     } : {} }
Newbie Thymer
Intermediate Phuner
Cs24
 
Posts: 41
Joined: Tue Nov 03, 2009 5:30 am


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 1 guest

cron