Sprite¶
-
class
quest.sprite.QuestSprite(filename=None, scale=1, image_x=0, image_y=0, image_width=0, image_height=0, center_x=0, center_y=0, repeat_count_x=1, repeat_count_y=1)[source]¶ The base class for sprites in Quest.
A
QuestSpriteis a subclass ofarcade.Spritewith a few additional methods to help integrate into the Quest framework.-
description¶ A string description of the sprite.
-
strategy¶ If set, should be a
quest.strategy.Strategy, or another class instance with achoose_course()method.
-
speed¶ The sprite’s speed.
- Parameters
filename – The only required argument is the name of the sprite’s image file.
kwargs – There are many optional keyword arguments inherited from
arcade.Sprite.
-
set_course(vector)[source]¶ Update the change_x and change_y properties using a vector.
Normally, sprites’ intended movement is set using the change_x and change_y properties. This method updates change_x and change_y based on an (x, y) vector whose magnitude is scaled to the sprite’s speed. This is helpful when you have an (x, y) vector, for example a
quest.helpers.Directionor a vector to another sprite, and want to have this sprite head that direction at its speed. For example, if you wanted a sprite to always try to move down at its speed:def on_update(self): self.set_course(Direction.DOWN.to_vector())
-
on_collision(other_sprite, game)[source]¶ Called when the sprite collides with another sprite.
Override this method to change the sprite’s collision behavior. For example, an NPC sprite which represents an item that can be collected by the player would probably call a method on game to update the inventory and then call
self.kill().
-
-
class
quest.sprite.Wall(filename=None, scale=1, image_x=0, image_y=0, image_width=0, image_height=0, center_x=0, center_y=0, repeat_count_x=1, repeat_count_y=1)[source]¶ Wall.
-
class
quest.sprite.Player(filename=None, scale=1, image_x=0, image_y=0, image_width=0, image_height=0, center_x=0, center_y=0, repeat_count_x=1, repeat_count_y=1)[source]¶