Discuss Scratch

moiseszarzar
New to Scratch
2 posts

My script ignores new value of variable

I hope someone could help me. Link to my project: https://scratch.mit.edu/projects/281021115/

I'm using Chrome 71.0.3578.98 (64 bits). OS: Windows 10 Home Single Language.

The problem: I run the project clicking the green flag. The sprite turns 15 degrees clockwise repeatdly. When I press spacebar, the value of my variable is changed, but the if-then-else block ignores the new value. So the sprite continues turning clockwise, when it should turn counterclockwise.

What is happening? Is it a bug or there is some hack for using Scratch that is essential for doing anything?

I need your help because if i can't use a simple variable, what can i?

Observation: I tried to search topics before posting this new topic, but the search doesn't search forum topics, just project topics.
deck26
Scratcher
1000+ posts

My script ignores new value of variable

Copy the variable ‘my variable’ into your if block. What you're doing is comparing the text ‘my variable’ with the value ‘1’.
moiseszarzar
New to Scratch
2 posts

My script ignores new value of variable

Thank you very much, deck26. It's incredible. I started programming in 1986 and all through my life it was clear, in every language, including Cobol, Clipper, C, Java, it was allways clear when we were coding literals like “my variable”, and when we were referencing variables. After applying the solution you brought to me, there is no visual difference between the problem and the solution. The difference is just in dragging. This situation helped me to understand important differences between textual programming and blocks programming. In some moment the Scratch team decided something about literals. I respect the decision. I'm a new Scratcher and it is not rational for me suggestting visual differences when literals are used, The crucial question: with the help of this community, now I can continue scratching. Thank you!!!
deck26
Scratcher
1000+ posts

My script ignores new value of variable

moiseszarzar wrote:

Thank you very much, deck26. It's incredible. I started programming in 1986 and all through my life it was clear, in every language, including Cobol, Clipper, C, Java, it was allways clear when we were coding literals like “my variable”, and when we were referencing variables. After applying the solution you brought to me, there is no visual difference between the problem and the solution. The difference is just in dragging. This situation helped me to understand important differences between textual programming and blocks programming. In some moment the Scratch team decided something about literals. I respect the decision. I'm a new Scratcher and it is not rational for me suggestting visual differences when literals are used, The crucial question: with the help of this community, now I can continue scratching. Thank you!!!
No problem, it's a common mistake for new Scratchers but generally one you only make once.

Powered by DjangoBB