Block after a certain number
4 posts • Page 1 of 1
Block after a certain number
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.
- Techa
- Posts: 1
- Joined: Thu Feb 11, 2010 10:13 am
Re: Block after a certain number
- Code: Select all
Scene.my.num > x ? {Spawn box} : {}
X is any number
Spawn box is whatever spawn box script you would use
-
standardtoaster - Posts: 606
- Joined: Mon Aug 31, 2009 7:57 pm
Re: Block after a certain number
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
I trust you understand creating and using variable.
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.
-
Mystery - Posts: 2802
- Joined: Thu Sep 03, 2009 1:16 pm
- Location: Southern Australia
Re: Block after a certain number
- 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
make sure to check out my work.
-
Rideg - Posts: 948
- Joined: Tue Dec 15, 2009 5:17 pm
- Location: Östersund, Sweden
4 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 15 guests