Table of Contents

changesize()

Function Definition: changesize(percentage = 10)

Parameters

NameTypeDescriptionExpected ValuesDefault Value
percentageintThe percentage by which the size need to be changed.Integer10

Description

The function changes its sprite’s size by the specified amount. The default sprite size is 100; size values below that percentage are for shrunken sprites, and size values above it are for overlarge sprites.

Example

The example demonstrates the bouncing of an object from a bird's eye view in PictoBlox.

Code

sprite = Sprite('Tobi')
import time

sprite.gotoxy(0, 0)
sprite.setsize(100)

while True:
  for i in range(10):
    sprite.changesize(sprite.size()/10)
    time.sleep(0.01)
  for i in range(10):
    sprite.changesize(- sprite.size()/10)
    time.sleep(0.01)

Output

Read More
All articles loaded
No more articles to load