scratchfoundation / scratch-flash

Open source version of the Scratch 2.0 project editor. This is the basis for the online and offline versions of Scratch found on the website.
https://scratch.mit.edu
GNU General Public License v2.0
1.33k stars 512 forks source link

Y value can't go beyond about 2000 #1177

Closed jwzimmer-zz closed 8 years ago

jwzimmer-zz commented 8 years ago

Reported via freshdesk no. 52642.

About three months ago I finished typing a book onto Scratch, I made it chapter-by-chapter, a chapter per project, and I used a scrolling code, connecting the text to a variable on the y axis so that when you click the up and down arrow keys the text moves. But recently it stopped working in every single project, the text only goes to about y 2000 and refuses to go any farther, was a limit on the y axis created? Or is this a horrible bug? Can someone help?

Metadata:

  • Click on "See Inside" project (110066030)
  • Go to Event blocks.
  • Drag block "When 'Green Flag' Pressed" into the project area.
  • Go to Looks blocks.
  • Drag block "Switch Costume to [costume 1]" onto script.
  • Go to Motion blocks.
  • Drag block "Go To x: [0] y: [0]" onto script.
  • Go to Data blocks.
  • Drag block "Set [yvel] to [0]" onto script.
  • Go to Control blocks.
  • Drag block "Forever" onto script.
  • Drag block "If [Key [up arrow] Pressed] Then" into "Forever" block.
  • Go to Data blocks.
  • Drag block "Change [yvel] by [1]" into "If [Key [up arrow] Pressed] Then" block.
  • Go to Control blocks.
  • Drag block "If [Key [down arrow] Pressed] Then" into "Forever" block.
  • Go to Data blocks.
  • Drag block "Change [yvel] by [-1]" into "If [Key [down arrow] Pressed] Then" block.
  • Go to Motion blocks.
  • Drag block "Change y by [yvel]" into "Forever" block
  • Go to Data blocks.
  • Drag block "Set [yvel] to [[yvel] * [0.9]]" into "Forever" block.
TheLogFather commented 8 years ago

Scratch has always limited the X and Y positions of sprites to prevent one from leaving the screen, and getting 'lost'. (It's one of those little foibles of Scratch that's annoying to have to work around sometimes.)

However, you say that it used to work until "recently"... Were you perhaps working in an offline version of Scratch that's over a year old? There was a modification to Scratch some time ago which changed how it works out the costume boundaries.

Before this change, parts of a vector costume which were fully transparent were still counted as 'within' the costume. This allowed a costume with such transparent parts to appear to go offscreen (though it hadn't really, since the transparent parts were still onscreen – but all visible parts were offscreen). After the change, such transparent parts were no longer considered to be part of the costume. This meant such costumes would no longer move as far as before. (It actually broke some projects that expected sprites to reach certain X or Y positions while in a loop...)

I recently posted in the "Help with Scripts" forum explaining how to 'trick' Scratch into allowing you to 'slide' an object smoothly offscreen, so it might be helpful to read through that: https://scratch.mit.edu/discuss/post/2128297/

jwzimmer-zz commented 8 years ago

@TheLogFather - Wow, thanks for this explanation! I will pass this on to the user who reported this issue. : )

TheLogFather commented 8 years ago

Ah, oh... an alternative possibility has come to mind...

Is this text actually in a really tall vector costume? Maybe, say, more than 2000 pixels high? If not then ignore this...

But if so, there's a very recent change, in the most recent version 448, that could have broken it. Costumes more than 2048 pixels high or wide will be broken for certain operations where it tries to work out the costume boundaries.

Here's the change: https://github.com/LLK/scratch-flash/pull/1127 Read down to the bottom for discussion how it can break certain projects (and why it was done).

There are two ways to fix this. One would be to scale down the actual costume so it is less than 2000 pixels high. Then rescale it to the size you want by using the "set size" block (which you will have to do via a 'trick' with a smaller costume, since Scratch won't let you resize a costume to much larger than the stage size). The other way would be to split the text across separate costumes and use one or more clones, one for each costume, placed in the appropriate places on the screen as the text scrolls.

jwzimmer-zz commented 8 years ago

As discussed with @cwillisf, this issue was caused by https://github.com/LLK/scratch-flash/pull/1127. We are closing this issue since we're no longer supporting costumes/ sprites with sides > 2048 pixels. I emailed the reporting user via freshdesk to let them know.