Set Size to ()%
set size to ()%
Category Looks
Type Stack
Introduced in 08Jul04 (0.x)

The Set Size to ()% block is a Looks block and a stack block. The block sets its Sprite's size to the specified amount. The default sprite size is 100%;[1] anything lower than that will decrease the size of the sprite on the stage, and anything above will increase the size of the sprite on the stage.

Example Uses

This block is used to set the size of a sprite, meaning that it cannot be used to increase the size of the stage (which is unable to differ in size). Some common uses of this block are:

  • Imitating distance in a 3D world
set size to (100)%
forever
if <key (w v) pressed?> then
set size to ((5) + (size))%
end
if <key (s v) pressed?> then
set size to ((-5) + (size))%
end
end
  • Increasing the size of a button on mouse-over
repeat until <<mouse down?> and <touching (mouse-pointer v)?>>
if <touching (mouse-pointer v)?> then
set size to (110)%
else
set size to (100)%
end
  • Making enemies larger as the game progresses
forever
set size to (((timer) / (5)) + (100))%

Drawbacks

This block has one major drawback for use in a 3D world; when the sprite is being resized, the smaller the size the sprite is at the moment, the quicker it will become larger (it will enlarge much faster at size 10% than size 150%). This can be solved by using the following formula to calculate the size of an object based on distance:

set size to ((100) / (distance:: variables))%

Workaround

Main article: List of Block Workarounds

This block can be replicated with the following code:

change size by ((wanted size) - (size))

See Also

References