y position

From PenguinMod Wiki
Revision as of 23:30, 8 July 2024 by MediansSC (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Y position
Jump to navigation Jump to search
y position
y position
Caption
Block Type Reporter Block
Category / Extension Motion
Status Who tf uses status

The y position block is a reporter block that reports the current y position of the sprite. It originates from Scratch. The default y position for paint sprites or blank sprites is 28, while other new sprites start at a random position. In the default project, the Penguin sprite is at (0, 0).

Workaround

This block can be worked around by using a variable to save the y position when the set y to () or change y by () blocks are used:

define set y to (number1)
set [y pos v] to (number1)
set y to (number1)
define change y by (number1)
set y to ((number1) + (y pos))::custom

However, this workaround does not account for the y position limit if offscreen, or "Remove Fencing" is disabled.

See also