Table of Contents

changey()

Function Definition: changey(delta_y = 10)

Parameters

NameTypeDescriptionExpected ValuesDefault Value
delta_yintThe steps for which y position needs to be changed.integer10

Description

The function moves its sprite’s Y position by the specified amount.

Example

The example demonstrates how to add movement to a sprite.

Code

sprite = Sprite('Ball')

while True:
  if sprite.iskeypressed('up arrow'):
    sprite.changey(3)
  if sprite.iskeypressed('down arrow'):
    sprite.changey(-3)
  if sprite.iskeypressed('left arrow'):
    sprite.changex(-3)
  if sprite.iskeypressed('right arrow'):
    sprite.changex(3)
Read More
All articles loaded
No more articles to load