[help] If statement in oncollide
5 posts • Page 1 of 1
[help] If statement in oncollide
How would I form a simple if then else statement in an oncollide script?
For instance if my.scene.variable>100 Then my.scene.bool=1 Else my.scene.bool=0
Thanks in advance.
For instance if my.scene.variable>100 Then my.scene.bool=1 Else my.scene.bool=0
Thanks in advance.
- killalltheyuppies
- Posts: 1
- Joined: Sat Mar 20, 2010 11:05 am
-
Mystery - Posts: 2802
- Joined: Thu Sep 03, 2009 1:16 pm
- Location: Southern Australia
Re: [help] If statement in oncollide
Mystery wrote:
- Code: Select all
{my.scene.variable > 100}?{my.scene.bool = 1}:{my.scene.bool=0}
{If}?{Then}:{Else}
almost.
if ? then : else
where if is boolean, than and else - anything, include procedure {}
for example:
1 > 2 ? 3 : 4
gives you
4
and you can include that in some operations like:
scene.my.begining = sim.time < 10 ? 1 : 0
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: [help] If statement in oncollide
Is it really that hard to search? Or maybe look at the damn tutorial topic that's been stickied?
TheWinkits wrote:They both looks of cuking amazing
-
Chronos - [Most Active Member 2010]
- Posts: 4457
- Joined: Mon Aug 31, 2009 6:00 pm
- Location: Californania
Re: [help] If statement in oncollide
Well now if anyone does search they will find a nice simple topic with the answers already posted.
Also
My way works fine, i prefer it as it makes it easier to edit and read i find it more organised, a lot of my code is like that.
Also
Kilinich wrote:Mystery wrote:
- Code: Select all
{my.scene.variable > 100}?{my.scene.bool = 1}:{my.scene.bool=0}
{If}?{Then}:{Else}
almost.
if ? then : else
where if is boolean, than and else - anything, include procedure {}
for example:
1 > 2 ? 3 : 4
gives you
4
and you can include that in some operations like:
scene.my.begining = sim.time < 10 ? 1 : 0
My way works fine, i prefer it as it makes it easier to edit and read i find it more organised, a lot of my code is like that.
-
Mystery - Posts: 2802
- Joined: Thu Sep 03, 2009 1:16 pm
- Location: Southern Australia
5 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 16 guests