Grandma’s Soup

../_images/grandmas_soup_game.png
class quest.examples.grandmas_soup.GrandmasSoupGame[source]

Help Grandma find all the ingredients for her soup.

GrandmasSoupGame shows off the full range of features in the Quest framework, loading a map and letting the player explore it. Grandma and the Vegetables are subclasses of NPC. A quest.modal.DialogueModal is used for the conversations with Grandma. To run this example, run:

$ python -m quest.examples.grandmas_soup

After you play it, check out the sorce code by clicking on “source” in the blue bar just above.

dialogue

A Dialogue containing the game’s conversation.

modal

A DialogueModal to show the dialogue.

items

A list to keep track of which items the player has collected.

setup_maps()[source]

Sets up the standard island map.

setup_walls()[source]

As in other examples, assigns all sprites in the “Obstacles” layer to be walls.

setup_npcs()[source]

Creates and places Grandma and the vegetables.

talk_with_grandma()[source]

Opens the dialogue modal to show conversation with Grandma. This is called when the player collides with Grandma.

got_item(description)[source]

Adds the item’s description to the items list. This is called when the player collides with a vegetable.

Parameters

description – The item description.

class quest.examples.grandmas_soup.Grandma(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]

Grandma is an NPC.

repel_distance

How far back the player should be pushed after colliding with Grandma. This is necessary because otherwise when the dialogue modal closed, it would immediately reopen. Grandma is interesting, but not that interesting.

on_collision(sprite, game)[source]

When the player collides with Grandma, she repels the player and then talk_with_grandma() is called to open the dialogue modal.

repel(sprite)[source]

Backs the sprite away from self

class quest.examples.grandmas_soup.Vegetable(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]

A vegetable is an NPC that can be picked up.

on_collision(sprite, game)[source]

When the player collides with a vegetable, it tells the game and then kills itself.

class quest.examples.grandmas_soup.Carrots(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]
class quest.examples.grandmas_soup.Mushroom(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]
class quest.examples.grandmas_soup.Potatoes(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]
class quest.examples.grandmas_soup.Tomatos(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]