Table of Contents

changeeffect()

Function Definition: changeeffect(effect_name = "COLOR", effect_value = 25)

Parameters

NameTypeDescriptionExpected ValuesDefault Value
effect_namestringThe name of the effect."COLOR", "FISHEYE", "WHIRL", "PIXELATE", "MOSAIC", "BRIGHTNESS", or "GHOST""COLOR"
effect_valueintThe value of the effect.Integer25

Description

The function changes the specified effect on its sprite by the specified amount. There are seven different effects to choose from: colour, fisheye, whirl, pixelate, mosaic, brightness, and ghost.

Example

The example demonstrates the various graphical effects in the Python - Brightness, color, fisheye, ghost, mosaic, pixelated, and whirl.

Code

sprite = Sprite('Tobi')
import time

effect = "COLOR"
# effect = "FISHEYE"
# effect = "WHIRL"
# effect = "PIXELATE"
# effect = "MOSAIC"
# effect = "BRIGHTNESS"
# effect = "GHOST"

sprite.gotoxy(0, 0)
sprite.setsize(200)
sprite.cleareffects()
sprite.seteffect(effect, 0)

while True:
  for i in range(10):
    sprite.changeeffect(effect, 5)
    time.sleep(0.1)
  for i in range(10):
    sprite.changeeffect(effect, -5)
    time.sleep(0.1)

Color

Fisheye

Ghost

 

Mosaic

Brightness

 

Pixelate

Whirl

Read More
All articles loaded
No more articles to load