Discuss Scratch

itamaryaffe
Scratcher
4 posts

I need a help!

I wanna do a variable is changed by another variable, is changed, when I'm pressing a key.
When I do that, the value of the first variable increased too much.
It needs to change by (the other variable)/100 but it changes very larger than that.
I need a help from you!

Thank you,
itamaryaffe
bloxxer
Scratcher
100+ posts

I need a help!

make sure you have a wait (0.1 secs?) block!
Griftor05
Scratcher
13 posts

I need a help!

um, you might want to try this out.

Header Bit: When Key (whatever_key_you_want) Pressed:
then put: change variable (the_variable_you're_changing) by (Variable_2 inside of a math division where one side is var2, and the other is 100)
then, optionally: End Script (is this still in 2.0? I should check that, although it was pretty redundant in 1.4, so probably not)
ErnieParke
Scratcher
1000+ posts

I need a help!

Griftor05 wrote:

um, you might want to try this out.

Header Bit: When Key (whatever_key_you_want) Pressed:
then put: change variable (the_variable_you're_changing) by (Variable_2 inside of a math division where one side is var2, and the other is 100)
then, optionally: End Script (is this still in 2.0? I should check that, although it was pretty redundant in 1.4, so probably not)
Yes, end script is still in 2.0, as well as [stop [all v]] and [stop [other scripts in sprite v]]. Also, end script is actually now [stop [this script v]].

With regards,

ErnieParke

Last edited by ErnieParke (June 23, 2013 19:56:22)

greenflash
Scratcher
18 posts

I need a help!

Griftor05 wrote:

um, you might want to try this out.

Header Bit: When Key (whatever_key_you_want) Pressed:
then put: change variable (the_variable_you're_changing) by (Variable_2 inside of a math division where one side is var2, and the other is 100)
then, optionally: End Script (is this still in 2.0? I should check that, although it was pretty redundant in 1.4, so probably not)

Instead of End Script, you could do this:

Forever
If “whatever key” is pressed
Change variable 1 by ( (variable 2)/100 )
wait until <not “whatever key” is pressed>
-end of if -
-end of forever loop -

Last edited by greenflash (June 23, 2013 19:30:38)

Powered by DjangoBB