MCPcopy Create free account

hub / github.com/TomJohnH/streamlit-dungeon / functions

Functions33 in github.com/TomJohnH/streamlit-dungeon

↓ 5 callersFunctioncharacter_can_move
This function checks if the move is "legal" for a character in a given level matrix. Args: level_matrix (numpy.ndarray): A 2D array
game_def.py:14
↓ 5 callersFunctionsquared_distance
Calculate the squared distance between two points. Args: x1: The x-coordinate of the first point. y1: The y-coordinate of th
game_def.py:32
↓ 4 callersFunctionmove_callback
Args: direction (str): The direction to move the player in. Possible values are "left", "right", "up", and "down". Retur
streamlit_app.py:172
↓ 3 callersFunctioncreate_text_bubble_html
Create an HTML text bubble with the given text and position. Args: text: A string representing the text to be displayed in the bubble.
game_def.py:417
↓ 2 callersFunctionrandom_move
Move the movable_object in a random direction. Args: movable_object (object): The movable object containing its x and y coordinates.
game_def.py:217
↓ 1 callersMethod__init__
Initialize a new character instance. :param x: x-coordinate of the character :param y: y-coordinate of the character
streamlit_app.py:83
↓ 1 callersFunctiondistance_from_player
Calculate the squared distances between a player and a movable object for current position and four possible moves (left, right, up, down).
game_def.py:47
↓ 1 callersFunctionfetch_data
(level_name)
streamlit_app.py:234
↓ 1 callersFunctiongenerate_tile_html
(tile, col, row)
game_def.py:298
↓ 1 callersFunctionget_move_index
Get the index of the move with the shortest distance to the player. Args: player (object): The player object containing its x and y
game_def.py:76
↓ 1 callersMethodhtml
Generate the HTML code to display the game object. :return: string with the HTML code
streamlit_app.py:62
↓ 1 callersFunctionis_valid_move
Check if a move in the given direction is valid for the movable_object. Args: movable_object (object): The object to be moved contai
game_def.py:110
↓ 1 callersFunctionlocal_css
(file_name)
streamlit_app.py:29
↓ 1 callersFunctionmove_object
Move the object in the given direction by the given distance. Args: movable_object (object): The object to be moved containing its x
game_def.py:91
↓ 1 callersFunctionrandom_direction
()
game_def.py:225
↓ 1 callersFunctionrestart_game
()
streamlit_app.py:240
↓ 1 callersFunctiontile_html
(src, x, y, z)
game_def.py:335
Method__init__
Initialize a new game object instance. :param x: x-coordinate of the object :param y: y-coordinate of the object
streamlit_app.py:48
Method__init__
Initialize a new inanimate object instance. :param x: x-coordinate of the object :param y: y-coordinate of the object
streamlit_app.py:105
Functionadditional_layers_html
Generate HTML for additional layer elements such as torches, boxes, and voids. Args: level_name (str): The name of the level for whi
game_def.py:342
Functiondown_callback
()
streamlit_app.py:219
Functionencounter
(player, enemy)
game_def.py:248
Functiongenerate_chests_html
(chests_list)
game_def.py:400
Functiongenerate_monsters_html
Generates HTML for monsters. Args: monsters_state (list): A list of monster objects from the session state Returns: str: The
game_def.py:379
Functionget_text_boxes
Get the text bubble at the player's current position in the given level. Args: player_x: An integer representing the x position of the pl
game_def.py:437
Functionleft_callback
()
streamlit_app.py:210
Functionlevel_renderer
The heart of graphical engine, More optimized version. Generates the HTML for rendering a game level based on a dataframe and game objects.
game_def.py:288
Functionlevel_renderer_optimized
Optimized version of the level renderer function. Uses string concatenation instead of creating lists and joining them later. :param
game_def.py:308
Functionmove_to_player
Move the movable_object towards the player or perform a random move based on a random probability. Args: player (object): The player
game_def.py:136
Functionmove_to_player_optimized
Optimized version of move_to_player function with reduced calculations and better path finding. Args: player (object): The p
game_def.py:155
Functionright_callback
()
streamlit_app.py:213
Functiontreasures
(player, treasure)
game_def.py:267
Functionup_callback
()
streamlit_app.py:216