scratchfoundation / scratch-blocks

Scratch Blocks is a library for building creative computing interfaces.
https://scratch.mit.edu/developers
Apache License 2.0
2.6k stars 1.39k forks source link

"when this sprite clicked" in the stage should be "when stage clicked" #634

Closed towerofnix closed 6 years ago

towerofnix commented 8 years ago

You can see the issue in the scratch-vm demo – here's a script inside the stage:

Issue

tmickel commented 8 years ago

Yep. The opcode for these is actually the same - so it may be a little tricky to pull off. But maybe the VM needs to provide the blocks with some function, editingStage? or similar...

paulkaplan commented 6 years ago

@thisandagain can you just confirm the capitalization on this block? "when Stage clicked" is... unexpected....

thisandagain commented 6 years ago

@paulkaplan LOL. True. Good catch. Should be when stage clicked.

paulkaplan commented 6 years ago

@tmickel we could also separate into two different opcodes, parsing the single opcode into two different ones depending on the owner on import. Seems like that might be easier? Or is there an existing pattern you were thinking of in blocks for this kind of thing?

towerofnix commented 6 years ago

@paulkaplan Would separating it into two opcodes (which I assume means two separate blocks?) maybe cause more trouble? E.g., when dragging the script to the backpack and then into a sprite (or into a sprite, directly by dragging the script over the icon in the palette) - would a "when stage clicked" block appear inside a sprite?

tmickel commented 6 years ago

@paulkaplan seems like could work :) not sure what will be better, kind of an oddity...

guess you could also consider re-texting the block. "when I am clicked" -- there's precedent for that ("when I receive broadcast")...

paulkaplan commented 6 years ago

Hm @towerofnix that is a good point, ditto @tmickel. If there are other blocks that have to change labels between sprite and stage, a way of changing the block text would be a good way to go, make things like dragging scripts easier. Any other examples you can think of that would fit this use case.

I'm going to hold of implementing this until after the holidays and I get the chance to ask @thisandagain or @carljbowman about retexting the block to something more generic as an option ("when clicked", "when I am clicked", etc.)

paulkaplan commented 6 years ago

We decided to tackle this in two steps:

  1. Split the blocks into two separate opcodes that do the same thing.
  2. Implement a filtering process that maps one block to the other when dragged from sprite <=> stage (or backpack)

There are not any acceptable "generalizations" of the text that would be clear enough to avoid confusion with the stack itself ("when I'm clicked"). The pre-share-the-love filtering may also be useful for other transformations, e.g. sprite-specific variable blocks, blocks that reference sprite assets, etc.)