Table of Contents

Function Definition: changex(delta_x = 10)

Parameters

NameTypeDescriptionExpected ValuesDefault Value
delta_xintThe steps for which x position needs to be changed.integer10

Description

The function moves its sprite costume center’s X 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