Automatic collision change?

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

Automatic collision change?

Postby Sonic » Mon Dec 14, 2009 6:49 pm

I was trying to make a car, that when it hits an object, it changes to the next collison group, then the next, then the next. So it would be like

>Collide with A
>Change to B
>Collide with B
>Switch to C
>Collide with E
>Switch to D
>Collide with E again
>Switch to E
>Collide with E yet again
>Switch to F
Etc etc.
I do stuff and break things. You know how it is.
Image
User avatar
Sonic
 
Posts: 1467
Joined: Tue Sep 01, 2009 6:18 pm
Location: America!!!

Re: Automatic collision change?

Postby standardtoaster » Mon Dec 14, 2009 7:49 pm

Code: Select all
e.this.collideSet == 1 ? {e.this.collideSet = 2} : {e.this.collideSet == 2 ? {e.this.collideSet = 4} : {e.this.collideSet == 4 ? {e.this.collideSet = 8} : {e.this.collideSet == 8 ? {e.this.collideSet = 16} : {e.this.collideSet == 16 ? {e.this.collideSet = 32} : {e.this.collideSet == 32 ? {e.this.collideSet = 64} : {e.this.collideSet == 64 ? {e.this.collideSet = 1} : {}}}}}}}
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: Automatic collision change?

Postby Kilinich » Mon Dec 14, 2009 8:55 pm

Sonic wrote:I was trying to make a car, that when it hits an object, it changes to the next collison group, then the next, then the next. So it would be like

>Collide with A
>Change to B
>Collide with B
>Switch to C
>Collide with E
>Switch to D
>Collide with E again
>Switch to E
>Collide with E yet again
>Switch to F
Etc etc.


{collideSet = math.mod(2*collideSet, 127)}.
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: Automatic collision change?

Postby Sonic » Thu Dec 17, 2009 6:45 pm

Thanks Toaster! Your script worked! Killinch, i'm sorry to say, yours didn't.
I do stuff and break things. You know how it is.
Image
User avatar
Sonic
 
Posts: 1467
Joined: Tue Sep 01, 2009 6:18 pm
Location: America!!!

Re: Automatic collision change?

Postby standardtoaster » Thu Dec 17, 2009 6:47 pm

Actually both scripts work. Mine is a bit longer but easier to understand. Kilinich's is a bit shorter but harder to understand.
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: Automatic collision change?

Postby Sonic » Thu Dec 17, 2009 6:50 pm

Really? I tested his and it did absoutely nothing...
Whatever. Anyway, the point is, it works. I've been trying to get it to work since Beta 5 came out.
I do stuff and break things. You know how it is.
Image
User avatar
Sonic
 
Posts: 1467
Joined: Tue Sep 01, 2009 6:18 pm
Location: America!!!

Re: Automatic collision change?

Postby KarateBrot » Thu Dec 17, 2009 9:35 pm

Yeah Kilinich's works, too. But you did it in Phun, didn't you? If so it doesn't work because there is a bug with math.mod in Phun.
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany

Re: Automatic collision change?

Postby Kilinich » Fri Dec 18, 2009 8:52 am

KarateBrot wrote:Yeah Kilinich's works, too. But you did it in Phun, didn't you? If so it doesn't work because there is a bug with math.mod in Phun.

There is no problem with math mod in phun.
And this function works fine because it just do bit shift.
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: Automatic collision change?

Postby KarateBrot » Fri Dec 18, 2009 5:39 pm

i already encountered a not-working-bug in phun with math.mod
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany

Re: Automatic collision change?

Postby Kilinich » Fri Dec 18, 2009 6:26 pm

KarateBrot wrote:i already encountered a not-working-bug in phun with math.mod

Can you give an example?
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: Automatic collision change?

Postby KarateBrot » Sat Dec 19, 2009 2:44 pm

no sorry i can't. it was a long time ago when it happened.

but i can give an example that doesn't really fit to this topic:
if you open algodoo scenes in phun math.mod is not working. it happened when i was trying to open one of my scenes in phun to make it completely compatible. it was about 3 months ago.
the bug in phun we're really talking about happened before algodoo came out. but maybe something was screwed up, i don't know.
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 2 guests

cron