How Do you Spawn a Shape With different Collisions?

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

How Do you Spawn a Shape With different Collisions?

Postby Dezzeron » Wed Nov 11, 2009 6:30 am

The title says it all, but I will elaborate...

I'm trying to make something where a certain object hits another, and a circle spawns. But, I cant find out how to change what it collides with, e.g right now it only collides with group "a", I want it to collide with b,c, and d... but I cant find out how! Someone HALP!! :oops:
Last edited by Dezzeron on Wed Nov 11, 2009 10:10 pm, edited 1 time in total.
Check out my stuff HERE!
MY WEB SITE HERE!

Image
Sorry, I just had to.

Phundamentalist!
Mystery wrote:I'm convinced that dezzerons scenes are all epic. He's one of the biggest underdogs of algobox.
User avatar
Dezzeron
 
Posts: 296
Joined: Tue Sep 01, 2009 12:45 am
Location: Dark Side Of The Moon

Re: How Do you Spawn a Shape With different Collisions?

Postby standardtoaster » Wed Nov 11, 2009 6:45 am

A = 1
B = 2
C = 4
D = 8
E = 16
F = 32
G = 64

add numbers together to get different collideSet values. When you spawn the circle make sure to put collideSet := 22
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: How Do you Spawn a Shape With different Collisions?

Postby KarateBrot » Wed Nov 11, 2009 6:14 pm

And if you want to see which collision layers are included in one number you have to do it this way:

- - - - -

what's the highest power of two that fits in 22? - 16

6 left: what's the highest power of two that fits in 6? - 4

2 left: what's the highest power of two that fits in 2? - 2

- - - - -

so you have the numbers 16, 4 and 2. that's collision layer E, C and B.
With a littlebit of practice you will know them just by looking at it.
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany

Re: How Do you Spawn a Shape With different Collisions?

Postby monstertje3 » Wed Nov 11, 2009 6:21 pm

You are all Awesome!! :clap: :clap: :lol:
Basically, there are only 10 types of people in the world. Those who know binary, and those who don't.
Light travels faster than sound. That's why some people appear bright until they open their mouths.
User avatar
monstertje3
 
Posts: 343
Joined: Sat Sep 05, 2009 4:29 pm
Location: N-H, NL

Re: How Do you Spawn a Shape With different Collisions?

Postby Dezzeron » Wed Nov 11, 2009 8:10 pm

I still dont understand, can you put the full code?
Check out my stuff HERE!
MY WEB SITE HERE!

Image
Sorry, I just had to.

Phundamentalist!
Mystery wrote:I'm convinced that dezzerons scenes are all epic. He's one of the biggest underdogs of algobox.
User avatar
Dezzeron
 
Posts: 296
Joined: Tue Sep 01, 2009 12:45 am
Location: Dark Side Of The Moon

Re: How Do you Spawn a Shape With different Collisions?

Postby algadoodle123 » Wed Nov 11, 2009 8:22 pm

oncollide =
Code: Select all
(e)=>{scene.addCircle({radius:= "your size"; pos:=e.pos; collideset:=22})}
Last edited by algadoodle123 on Fri Nov 13, 2009 4:38 am, edited 1 time in total.
**/\ /\
>( ' ; ' )<***<---------- cat
*((")("))
i'm right-side-up
uʍop-ǝpısdn ɯ,ı
http://www.sherv.net/flip.html
User avatar
algadoodle123
 
Posts: 66
Joined: Tue Sep 08, 2009 6:04 pm

Re: How Do you Spawn a Shape With different Collisions?

Postby standardtoaster » Wed Nov 11, 2009 8:44 pm

Wrong.
Code: Select all
scene.addCircle({radius := size; pos := e.pos; collideSet := 22})
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: How Do you Spawn a Shape With different Collisions?

Postby Dezzeron » Wed Nov 11, 2009 8:53 pm

Ok, can you add it on to this code I have so far?
Code: Select all
(e)=>{
    (sim.time > (scene.my.lastshoot + 0.010000001) ? {         scene.my.lastshoot = sim.time;         scene.addcircle({             pos := e.pos;             radius := 0.050000001;             density := 5500000;             color := [0, 0, 0, 1]         });         scene.addpen({             pos := e.pos;             fadetime := 0.1;             size = 0.1;             color := [1, 1, 0, 0.5]         })     } : {}) }
Check out my stuff HERE!
MY WEB SITE HERE!

Image
Sorry, I just had to.

Phundamentalist!
Mystery wrote:I'm convinced that dezzerons scenes are all epic. He's one of the biggest underdogs of algobox.
User avatar
Dezzeron
 
Posts: 296
Joined: Tue Sep 01, 2009 12:45 am
Location: Dark Side Of The Moon

Re: How Do you Spawn a Shape With different Collisions?

Postby standardtoaster » Wed Nov 11, 2009 9:06 pm

Code: Select all
sim.time > scene.my.lastshoot + 0.010000001 ? {scene.my.lastshoot = sim.time; scene.addCircle({pos := e.pos; radius := 0.050000001; density := 5500000; color := [0, 0, 0, 1]; collideSet := 22}); scene.addPen({pos := e.pos; fadeTime := 0.1; size := 0.1; color := [1, 1, 0, 0.5]})} : {}
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: How Do you Spawn a Shape With different Collisions?

Postby Dezzeron » Wed Nov 11, 2009 10:11 pm

It still doesnt work, can you make the code so the ball collides with collision groups "b" "c" and "d"? Thanks...
Check out my stuff HERE!
MY WEB SITE HERE!

Image
Sorry, I just had to.

Phundamentalist!
Mystery wrote:I'm convinced that dezzerons scenes are all epic. He's one of the biggest underdogs of algobox.
User avatar
Dezzeron
 
Posts: 296
Joined: Tue Sep 01, 2009 12:45 am
Location: Dark Side Of The Moon

Re: How Do you Spawn a Shape With different Collisions?

Postby standardtoaster » Wed Nov 11, 2009 10:30 pm

*sigh* Add and subtract the collideSet values to get what you want or make an object with the collision layers you want, select it, go to its script menu, and look at the collideSet value. >.> But since you're lazy the collideSet for b, c, and d is 14.
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: How Do you Spawn a Shape With different Collisions?

Postby Dezzeron » Wed Nov 11, 2009 10:36 pm

I'm sorry, but it still doesnt work! :crazy:
Check out my stuff HERE!
MY WEB SITE HERE!

Image
Sorry, I just had to.

Phundamentalist!
Mystery wrote:I'm convinced that dezzerons scenes are all epic. He's one of the biggest underdogs of algobox.
User avatar
Dezzeron
 
Posts: 296
Joined: Tue Sep 01, 2009 12:45 am
Location: Dark Side Of The Moon

Re: How Do you Spawn a Shape With different Collisions?

Postby standardtoaster » Wed Nov 11, 2009 11:12 pm

Sorry. >.>
Code: Select all
    sim.time > (scene.my.lastshoot + 0.010000001) ? {scene.my.lastshoot = sim.time; scene.addCircle({pos := e.pos; radius := 0.050000001; density := 5500000; color := [0, 0, 0, 1]; collideSet := 22}); scene.addPen({pos := e.pos; fadeTime := 0.1; size := 0.1; color := [1, 1, 0, 0.5]})} : {}
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: How Do you Spawn a Shape With different Collisions?

Postby Frank » Thu Nov 12, 2009 4:17 am

The weirdness of the collideset variable is based in binary. If you take the number for a given combination of collision sets and translate it into binary, you will get a very neat display in which each digit represents a collision group. If it's one, it collides with that group, and if it's zero, then it doesn't.

0000001 = 1 = A
0000000 = 0 = none
1111111 = 127 = all
0101010 = 42 = B, D, F
0001000 = 8 = D
Made some cool stuff a long time ago
User avatar
Frank
[Best Tutorial Maker 2010]
 
Posts: 193
Joined: Mon Aug 31, 2009 6:37 pm
Location: the dark side of the moon

Re: How Do you Spawn a Shape With different Collisions?

Postby Dezzeron » Thu Nov 12, 2009 4:23 am

Dammit! It STILL doesnt work! Make sure you make it collide with "b" "c" and "d"!
Check out my stuff HERE!
MY WEB SITE HERE!

Image
Sorry, I just had to.

Phundamentalist!
Mystery wrote:I'm convinced that dezzerons scenes are all epic. He's one of the biggest underdogs of algobox.
User avatar
Dezzeron
 
Posts: 296
Joined: Tue Sep 01, 2009 12:45 am
Location: Dark Side Of The Moon

Re: How Do you Spawn a Shape With different Collisions?

Postby standardtoaster » Thu Nov 12, 2009 9:31 am

God! Why can't you learn to edit a goddamn script! >:C
Code: Select all
        sim.time > (scene.my.lastshoot + 0.010000001) ? {scene.my.lastshoot = sim.time; scene.addCircle({pos := e.pos; radius := 0.050000001; density := 5500000; color := [0, 0, 0, 1]; collideSet := 14}); scene.addPen({pos := e.pos; fadeTime := 0.1; size := 0.1; color := [1, 1, 0, 0.5]})} : {}
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: How Do you Spawn a Shape With different Collisions?

Postby RicH » Thu Nov 12, 2009 2:05 pm

Dezzeron wrote:Dammit! It STILL doesnt work! Make sure you make it collide with "b" "c" and "d"!

You're the one who can't understand simple things. You can even observe it in-game without asking here.
Millions of voices suddenly cried out in terror, and were suddenly silenced. Something terrible has happened.
User avatar
RicH
[Funniest Person 2010]
 
Posts: 2043
Joined: Tue Sep 01, 2009 9:01 am

Re: How Do you Spawn a Shape With different Collisions?

Postby Dezzeron » Thu Nov 12, 2009 7:54 pm

I did edit the script, and it doesnt work! I dont know why, I did everything I was supposed to...
Check out my stuff HERE!
MY WEB SITE HERE!

Image
Sorry, I just had to.

Phundamentalist!
Mystery wrote:I'm convinced that dezzerons scenes are all epic. He's one of the biggest underdogs of algobox.
User avatar
Dezzeron
 
Posts: 296
Joined: Tue Sep 01, 2009 12:45 am
Location: Dark Side Of The Moon

Re: How Do you Spawn a Shape With different Collisions?

Postby standardtoaster » Thu Nov 12, 2009 7:58 pm

Did the script I just post work? It does for me. Did you declare scene.my.lastshoot?
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: How Do you Spawn a Shape With different Collisions?

Postby Dezzeron » Thu Nov 12, 2009 8:25 pm

standardtoaster wrote:Did the script I just post work? It does for me. Did you declare scene.my.lastshoot?


What do you mean? I am such a noob to scripting...
Check out my stuff HERE!
MY WEB SITE HERE!

Image
Sorry, I just had to.

Phundamentalist!
Mystery wrote:I'm convinced that dezzerons scenes are all epic. He's one of the biggest underdogs of algobox.
User avatar
Dezzeron
 
Posts: 296
Joined: Tue Sep 01, 2009 12:45 am
Location: Dark Side Of The Moon

Re: How Do you Spawn a Shape With different Collisions?

Postby standardtoaster » Thu Nov 12, 2009 8:30 pm

Image
Declaring a variable: Press ~ or F11, type scene.my.lastshoot = 0, press enter, now put this script into the onCollide of the object.
Code: Select all
            sim.time > (scene.my.lastshoot + 0.010000001) ? {scene.my.lastshoot = sim.time; scene.addCircle({pos := e.pos; radius := 0.050000001; density := 5500000; color := [0, 0, 0, 1]; collideSet := 14}); scene.addPen({pos := e.pos; fadeTime := 0.1; size := 0.1; color := [1, 1, 0, 0.5]})} : {}
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: How Do you Spawn a Shape With different Collisions?

Postby Dezzeron » Thu Nov 12, 2009 8:36 pm

It still doesnt work... do you want me to upload the scene so you can try? I swear, it is really screwed up... :problem:
Check out my stuff HERE!
MY WEB SITE HERE!

Image
Sorry, I just had to.

Phundamentalist!
Mystery wrote:I'm convinced that dezzerons scenes are all epic. He's one of the biggest underdogs of algobox.
User avatar
Dezzeron
 
Posts: 296
Joined: Tue Sep 01, 2009 12:45 am
Location: Dark Side Of The Moon

Re: How Do you Spawn a Shape With different Collisions?

Postby standardtoaster » Thu Nov 12, 2009 9:04 pm

Jesus christ... Image How is it that your are messing it up? I have tested this script at least ten times now and it works every time.
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: How Do you Spawn a Shape With different Collisions?

Postby Dezzeron » Thu Nov 12, 2009 9:18 pm

I dont know, it... gah... just for get it.
Check out my stuff HERE!
MY WEB SITE HERE!

Image
Sorry, I just had to.

Phundamentalist!
Mystery wrote:I'm convinced that dezzerons scenes are all epic. He's one of the biggest underdogs of algobox.
User avatar
Dezzeron
 
Posts: 296
Joined: Tue Sep 01, 2009 12:45 am
Location: Dark Side Of The Moon

Re: How Do you Spawn a Shape With different Collisions?

Postby standardtoaster » Thu Nov 12, 2009 9:49 pm

If you could upload the scene I can make it work.
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Next

Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 21 guests

cron