Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/TomJohnH/streamlit-dungeon
/ functions
Functions
33 in github.com/TomJohnH/streamlit-dungeon
⨍
Functions
33
◇
Types & classes
3
↓ 5 callers
Function
character_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 callers
Function
squared_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 callers
Function
move_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 callers
Function
create_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 callers
Function
random_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 callers
Method
__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 callers
Function
distance_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 callers
Function
fetch_data
(level_name)
streamlit_app.py:234
↓ 1 callers
Function
generate_tile_html
(tile, col, row)
game_def.py:298
↓ 1 callers
Function
get_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 callers
Method
html
Generate the HTML code to display the game object. :return: string with the HTML code
streamlit_app.py:62
↓ 1 callers
Function
is_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 callers
Function
local_css
(file_name)
streamlit_app.py:29
↓ 1 callers
Function
move_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 callers
Function
random_direction
()
game_def.py:225
↓ 1 callers
Function
restart_game
()
streamlit_app.py:240
↓ 1 callers
Function
tile_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
Function
additional_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
Function
down_callback
()
streamlit_app.py:219
Function
encounter
(player, enemy)
game_def.py:248
Function
generate_chests_html
(chests_list)
game_def.py:400
Function
generate_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
Function
get_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
Function
left_callback
()
streamlit_app.py:210
Function
level_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
Function
level_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
Function
move_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
Function
move_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
Function
right_callback
()
streamlit_app.py:213
Function
treasures
(player, treasure)
game_def.py:267
Function
up_callback
()
streamlit_app.py:216