Another Scripting Problem...
12 posts • Page 1 of 1
Another Scripting Problem...
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;
If anyone has a solution it would help me a lot...
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...
Made In PHUN And PHOTOSHOP CS4
-
o0shadow0o - Posts: 14
- Joined: Fri Feb 05, 2010 7:09 pm
Re: Another Scripting Problem...
- 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...
-
Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: Another Scripting Problem...
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;
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 }
Made In PHUN And PHOTOSHOP CS4
-
o0shadow0o - Posts: 14
- Joined: Fri Feb 05, 2010 7:09 pm
Re: Another Scripting Problem...
- 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.
-
standardtoaster - Posts: 606
- Joined: Mon Aug 31, 2009 7:57 pm
Re: Another Scripting Problem...
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...
i only want the code to affect yellow/green balls or it doesnt work...
Made In PHUN And PHOTOSHOP CS4
-
o0shadow0o - Posts: 14
- Joined: Fri Feb 05, 2010 7:09 pm
Re: Another Scripting Problem...
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 }
-
standardtoaster - Posts: 606
- Joined: Mon Aug 31, 2009 7:57 pm
Re: Another Scripting Problem...
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...
seeing as i only need to change balls, would there be a way just to change circles, not polygons or boxes.
that seems easier...
Made In PHUN And PHOTOSHOP CS4
-
o0shadow0o - Posts: 14
- Joined: Fri Feb 05, 2010 7:09 pm
Re: Another Scripting Problem...
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 }
-
standardtoaster - Posts: 606
- Joined: Mon Aug 31, 2009 7:57 pm
Re: Another Scripting Problem...
Made In PHUN And PHOTOSHOP CS4
-
o0shadow0o - Posts: 14
- Joined: Fri Feb 05, 2010 7:09 pm
Re: Another Scripting Problem...
- 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 }
-
standardtoaster - Posts: 606
- Joined: Mon Aug 31, 2009 7:57 pm
Re: Another Scripting Problem...
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:
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:
- 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 } : {} } }
<-- Made with GIMP
-
blahblah200 - Posts: 61
- Joined: Tue Sep 01, 2009 11:33 am
- Location: Somewhere over the rainbow...
Re: Another Scripting Problem...
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
Intermediate Phuner
- Cs24
- Posts: 41
- Joined: Tue Nov 03, 2009 5:30 am
12 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest