Table of Contents

stamp()

Function Definition: stamp()

Parameters

Description

The function is used when the sprite needs to produce a bitmap image of itself which is stamped onto the stage. (Because it is merely a picture of the sprite and not a sprite itself, it cannot be programmed). The function will not draw over sprites.

Example

The example demonstrates how to make the sprite track and stamp its image on the mouse when the space key is pressed in Python.

Code

sprite = Sprite('Tobi')
pen = Pen()

pen.clear()

while True:
  if (sprite.iskeypressed("space")):
    sprite.setx(sprite.mousex())
    sprite.sety(sprite.mousey())
    pen.stamp()

Output

Read More
All articles loaded
No more articles to load