#GRAPELING HOOK AND PLAYER
grappling_hook = ursina.Entity(model='cube', color=ursina.color.blue, scale=(0.1, 0.1, 2), position=(0, 0, -5))
grappling_hook.visible = False
def shoot_grappling_hook():
    grappling_hook.position = player.position
    grappling_hook.rotation = player.rotation
    grappling_hook.visible = True
    grappling_hook.animate_position(player.animate_position,player.select, curve=ursina.curve.linear, duration=0.5)
def reset_grappling_hook():
    grappling_hook.visible = False
    
    
    title_screen_active = True

# Function to start the game when the "Start" button is clicked
def start_game():
    global title_screen_active
    title_screen_active = False
    destroy(title_text)
    destroy(start_button)
    mouse.locked = True  # Lock the mouse for gameplay
    # Add code here to initialize your platformer game and start the gameplay
### Code graveyard
#ursina.Entity(position=(0,0,  0) ,scale=(0.25,0.25,0.25) ,color=ursina.color.green,collider='box',model=ursina.load_model("finish.obj"),texture='brick', texture_scale=(8,8))
## End code graveyard
# Create a background image for the title screen
title_screen_background = Entity(model='quad', texture='title_screen_background_texture.jpg', scale=(1.6, 1, 1))

# Create the game title text
title_text = Text(text='PLATTE FORMER', scale=2, y=0.3)

# Create the "Start" button
start_button = Button(text='Start', color=color.green, scale=(0.2, 0.1), y=-0.2, on_click=start_game)

def update():
    global title_screen_active
    if title_screen_active:
        mouse.locked = False  # Unlock the mouse for title screen
    else:
        mouse.locked = True   # Lock the mouse for gameplay
        