🎮ArcadeLab

How

by AstroLegend76
43 lines1.4 KB
▶ Play
import arcade

# Constants
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600
SCREEN_TITLE = "Family Journey"

class MyGame(arcade.Window):
    def __init__(self, width, height, title):
        super().__init__(width, height, title)
        # We start at the first location
        self.location = "Restaurant"

    def on_draw(self):
        """ Render the screen. """
        arcade.start_render()
        
        # Display the current location on the screen
        arcade.draw_text(f"Current Location: {self.location}", 
                         20, SCREEN_HEIGHT - 40, arcade.color.WHITE, 20)
        
        # Instructions for the user
        arcade.draw_text("Press SPACE to move to the next location!", 
                         20, 100, arcade.color.GREEN, 16)

    def on_key_press(self, key, modifiers):
        """ Called whenever a key is pressed. """
        if key == arcade.key.SPACE:
            if self.location == "Restaurant":
                self.location = "Cafe"
            elif self.location == "Cafe":
                self.location = "Mall"
            elif self.location == "Mall":
                self.location = "Hotel Lobby"
            elif self.location == "Hotel Lobby":
                self.location = "Sensory Suite"
            elif self.location == "Sensory Suite":
                self.location = "Game Over - The Family is Happy!"

# Run the game
if __name__ == "__main__":
    game = MyGame(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)
    arcade.run()

Game Source: How

Creator: AstroLegend76

Libraries: none

Complexity: simple (43 lines, 1.4 KB)

The full source code is displayed above on this page.

Remix Instructions

To remix this game, copy the source code above and modify it. Add a ARCADELAB header at the top with "remix_of: how-astrolegend76" to link back to the original. Then publish at arcadelab.ai/publish.