Discuss Scratch

100+ posts

Custom Blocks - Refresh

I'm creating a full physics custom block. I need the user to be able to add inputs that determine what the sprite will collide with. They would do that by dropping an "if touching or (color) block into a boolean slot in the custom block. They would also be able to add “or” and “and”, that way they don't have to edit the definition block in order to choose which sprites that the sprite will collide with.

Define if touching <boolean1>
if ((boolean1) = )) then
(physics stuff)

So in that boolean1 slot, they would be able to place an “if touching block”, so that the script knows what sprites to collide with. They need to be able to do this with the block and NOT have to edit the actual definition block to achieve this.

The problem is that when I do that, it only checks to see if it's touching the sprites once. So I have to wrap a “forever” block around the custom block to force the boolean to constantly check to see if it's touching certain sprites. However, it only checks to see if the boolean is “true” once every time it goes through the script. The script is long and that boolean needs to be able to update it's value multiple time rather than just once at the beginning.

In the end, we need to be able to choose when a boolean refreshes its value from INSIDE the definition block.

Scratch 2.0 = Cloud Variables!

Powered by DjangoBB

Standard | Mobile