From Test-Scratch-Wiki

Archive.png This article or section documents a feature not included in the current version of Scratch (3.0). It is only useful from a historical perspective.
Align Scene ()
Align Scene.png
Category Motion
Type Stack
Introduced in 2.0 alpha
Removed in 2.0

The Align Scene () block was a Motion block and a Stack block. It worked in conjunction with the built-in scrolling mechanism that never made it past the late Scratch 2.0 Alpha stage. The block set the scrolling position of the Stage to the specified argument. The options of the dropdown were "top-left", "top-right", "middle", "bottom-left", and "bottom-right".

Example Uses

  • Realigning the Stage after panning in a scrolling game
when gf clicked
set [yvel v] to (0)
go to x: (0) y: (0)
forever
align scene [middle v]::motion
set [lives v] to [3]
repeat until <(lives) = [0]>
scroll right (-5)::motion
if <key [up arrow v] pressed?> then
change [yvel v] by (1.3) //upward motion
end
if <key [down arrow v] pressed?> then
change [yvel v] by (-1.3) //downward motion
end
change [yvel v] by (-0.4) //gravity
set [yvel v] to ((yvel) * (.87)) //physics
if <<touching [enemy v]?> or <(y position) < (-239)>> then
change [lives v] by (-1)
end
  • Using set locations as a base for panning
when gf clicked
forever
ask [Specify the location you would like to view of the house] and wait
if <<(answer) = [middle]> or <(answer) = [center]>> then
align scene [middle v]::motion
end
if <<(answer) = [top-left]> or <(answer) = [top left]>> then
align scene [top-left v]::motion

See Also

Cookies help us deliver our services. By using our services, you agree to our use of cookies.