moveBy()

Moves an element by x, y, z relative to its current position. Optionally this method also takes a Tween or Thrust object. Tweens and Thrusts are carried out over the duration of multiple frames. Tweens stop at a predefined end value after a predefined time. Thrusts are carried out until canceled. >> The class reference elaborates on Tweens and Thrusts.

<camera>.moveBy(x, y, z)
<sprite>.moveBy(x, y, z)
<tag>.moveBy(x, y, z)
<tag>.moveBy(x, y)
  • x, y, z ... coordinates in 3D space

<camera>.moveBy(tweenobj)
<sprite>.moveBy(tweenobj)
<tag>.moveBy(tweenobj)
  • tweenobj ... an object that describes the tween. Tween objects are usually instanced from classes that take x, y, z values and a time value that specifies the tween's duration.

<camera>.moveBy(thrustobj)
<sprite>.moveBy(thrustobj)
<tag>.moveBy(thrustobj)
  • thrustobj ... an object that describes the thrust. Thrust objects are usually instanced from classes that take x, y, z values. The standard Thrust understands them as change/second.

Relevant examples: tag.py , sprite.py , tag_all.py , sprite_all.py , ALL

In Context

Immediate

def onSetup(self):
    self.camera.moveBy(0.0, 0.0, -5.0)
s = ASpriteClass(self, 'sprite1')
s.moveBy(-0.5, 0.0, -1.5)
t = ATagClass(self, 'tag1')
t.moveBy(200, 50)

Thrusts

def onSetup(self):
    self.camera.moveBy(Thrust(0.0, 0.0, 0.1))
s = ASpriteClass(self, 'sprite1')
s.moveBy(Thrust(0.5, 0.0, 0.0))
t = ATagClass(self, 'tag1')
t.moveBy(FadeinThrust(40, 80, 0))

Tweens

s = ASpriteClass(self, 'sprite1')
s.moveBy(Tween(2.5, 0.0, 0.0, 2.0))
t = ATagClass(self, 'tag1')
t.moveBy(SineTween(50, 10, 0, 2.0))
Initiated by Stephan Hechenberger
Thanks to CADRE's 103