Sprite
The Sprite class represents a graphical object that can be displayed on a
stage. It supports
various functionalities such as costumes, sounds, movement, rotation,
collision detection, and
interaction with the mouse and keyboard.
Key features include:
- Adding and switching costumes
- Adding and playing sounds
- Movement and rotation
- Collision detection with other sprites and the stage edges
- Interaction with the mouse and keyboard
- Displaying text and thought bubbles
- Broadcasting and receiving messages
Usage example:
Sprite sprite = new Sprite();
sprite.addCostume("costume1", "path/to/image.png");
sprite.addSound("sound1", "path/to/sound.wav");
sprite.setPosition(100, 200);
sprite.move(10);
sprite.turnRight(90);
sprite.say("Hello, world!");
Note: This class is designed to be used within a stage, and many methods require the sprite to be added to a stage to function correctly.
