Discuss Scratch

skruffles
Scratcher
32 posts

"When X or Y changes" BLOCK

This would help (me personally) and probably a lot of other people. It would sense when the x position or y position changes in a pos or neg direction. It would help mostly with animating and bots in peoples projects!


PS- If Im having a brainfart and there is a code that translates into this please tell me!
-Osiris-
Scratcher
100+ posts

"When X or Y changes" BLOCK

This could be useful. Could you describe in more detail what this block would look like and how it would work?


FancyFoxy
Scratcher
500+ posts

"When X or Y changes" BLOCK

You can do this:
forever
set [original x v] to (x position) // original x is a local variable
wait (0) secs
if <not <(x position) = (original x)>> then
broadcast [x changed v]
end
end

forever
set [original y v] to (y position) // original y is also a local variable
wait (0) secs
if <not <(y position) = (original y)>> then
broadcast [y changed v]
end
end
Because this workaround is simple enough and the block itself probably won't be used that much, I'll just say no support.

THIS IS MY SIGNATURE. THIS MEANS IT IS AN AUTOMATIC MESSAGE THAT APPEARS AT THE BOTTOM OF ALL MY POSTS.
Hi! I'm FancyFoxy! I create animations and games that were never, EVER meant to be taken seriously.
FancyFoxy Heroes and #Thanksgiving are some of my latest projects, check them out!
Charles12310
Scratcher
1000+ posts

"When X or Y changes" BLOCK

No support because there's already a way to do this:

when green flag clicked
forever
set [old X v] to (x position)
wait until <not <(old X) = (x position)>>
...
end

when green flag clicked
forever
set [old Y v] to (y position)
wait until <not <(old Y) = (y position)>>
...
end


Click This Link For Some Secrets About Me!
A few internet communication companies want to corrupt the internet by getting rid of net neutrality. Stop Them!
Parametric
New to Scratch
40 posts

"When X or Y changes" BLOCK

Alternate idea: what if there was a block that could sense the derivative of the x or y positions? Like, “change in x position per second” or something like that.
--Waterfall--
Scratcher
500+ posts

"When X or Y changes" BLOCK

Parametric wrote:

Alternate idea: what if there was a block that could sense the derivative of the x or y positions? Like, “change in x position per second” or something like that.
Hmm, that would be better, since there is a workaround to the original suggestion


Powered by DjangoBB

Standard | Mobile