Page 1 of 1

### Block after a certain number

Posted: Thu Feb 11, 2010 10:19 am
Would someone mind telling me how to do this? Basically I want something to collide with something else and it adds a variable. After the variable reach a certain number, it creates a block, stops spinning something. etc.

### Re: Block after a certain number

Posted: Thu Feb 11, 2010 10:30 am
Code: Select all
`Scene.my.num > x ? {Spawn box} : {}`

X is any number
Spawn box is whatever spawn box script you would use

### Re: Block after a certain number

Posted: Thu Feb 11, 2010 10:31 am
Easy, I'll show you how.

What you've described is a perfect If Statement

{}?{}:{}

And if Statement can be sumarized in english pretty well

{Scene.my.variable == 5}?{scene.my.example = 6}:{scene.my.example = 0}
If scene.my.variable is equal to 5 then make scene.my.example equal 6 otherwise scene.my.example = 0

So lets say the number you want to reach is 10
{scene.my. Variable == 5}

And what you want to happen is for a block to spawn.
?{Scene.addbox({size := [1,2]; pos := e.pos; color := [0,0,0,1]})}

Otherwise Do nothing :{}

All up you get
Code: Select all
`{Scene.my.variable == 5}?{Scene.addbox({size := [1,2]; pos := e.pos; color := [0,0,0,1]})}:{}`

I trust you understand creating and using variable.

### Re: Block after a certain number

Posted: Thu Feb 11, 2010 9:50 pm
Code: Select all
`(e)=>{    sim.time >= 5 ? {         Scene.addbox({             size := [1, 2];             collideSet := 0;             pos := e.pos;             color := [0.3, 0.3, 0.3, 1]         })     } : {} }`

this will spawn a box after the simulation have been activated for 5 seconds.
Hope this helped