How to decrement a number to one decimal places

NexusxAlpha

  • Posts: 157
Hello everyone

My question is in the title.

Every 0.1 seconds I want to decrement a number like 6 by 0.1

for example

6.0
5.9
5.8
5.7

etc etc

I tried before and when it gets to 0.<something>, it goes to like 0.973548, which is not what I'm after :P

Thanks

Nexus


NexusxAlpha

  • Posts: 157


NexusxAlpha

  • Posts: 157
Just re-tried it: by me it is working.
What do you get?

For some reason it goes down very quickly

could you maybe upload the behavior to the forge so I can download? Just call it NexusTimeBehavior or something like that so I can know what it is :)

nev

  • *
  • Posts: 386
Have you put the block inside a "do every 'x' seconds" block (where x=0.1) ?  ;)
Be sure you put the so formed block in "When Created" and not in "Always".

NexusxAlpha

  • Posts: 157
Have you put the block inside a "do every 'x' seconds" block (where x=0.1) ?  ;)
Be sure you put the so formed block in "When Created" and not in "Always".

Yeah, I put in When Created, inside a Do Every 0.1 seconds block. :/



nev

  • *
  • Posts: 386
OK, if you look carefully, the formula is not the same as the one I posted. The "round" block has to wrap ((seconds-1)x10) only, NOT the entire (((seconds-1)x10)/10)  ;)

And... Wasn't your intention to decrement by 0.1? Using that formula with integer numbers is useless. :)

NexusxAlpha

  • Posts: 157
OK, if you look carefully, the formula is not the same as the one I posted. The "round" block has to wrap ((seconds-1)x10) only, NOT the entire (((seconds-1)x10)/10)  ;)

And... Wasn't your intention to decrement by 0.1? Using that formula with integer numbers is useless. :)

yeah, it's 0.1 I wanted, I was just testing some stuff out. Will get back to you if it works :)

NexusxAlpha

  • Posts: 157
This still wont work, I'm beginning to think Stencyl hates me! lol


Play

  • Posts: 165
Well in the second attempt you fixed the math block but you removed the "do after 1 sec" before the "do every 1 sec" block, try putting that back.

NexusxAlpha

  • Posts: 157
Well in the second attempt you fixed the math block but you removed the "do after 1 sec" before the "do every 1 sec" block, try putting that back.

I tried with and without, and no luck....

jpeterson

  • Posts: 17