#Trisha Ruiz
#6/20/2023
#start screen

#init
import pygame, sys, random
from pygame.locals import *
pygame.init()
import mainActionRPG #import whatever file you plan to open

#constants
width = 500
height = 500

#window
DISPLAYSURF = pygame.display.set_mode((width, height))
pygame.display.set_caption("start screen")

clock = pygame.time.Clock()

#text init
myfont = pygame.font.SysFont("monospace", 30)
color = pygame.Color(random.randint(0, 255),random.randint(0, 255),random.randint(0, 255))


#game loop
while True:
    clock.tick(5)
    DISPLAYSURF.fill("black")

    #draw text for button1
    startLabel = myfont.render("action rpg", 1, "white")
    pygame.draw.rect(DISPLAYSURF, color, (150, 250, 250, 40))
    DISPLAYSURF.blit(startLabel, (150, 250))

    button1 = pygame.Rect(150, 250, 250, 40)

    
    #draw button 2
    startLabel = myfont.render("surprise", 1, "white")
    pygame.draw.rect(DISPLAYSURF, color, (150, 300, 250, 40))
    DISPLAYSURF.blit(startLabel, (150, 300))

    button2 = pygame.Rect(150, 300, 250, 40)
    
    #event handler
    for event in pygame.event.get():

        if event.type == QUIT:
            pygame.quit()
            sys.exit()

        #when button clicked open other screen
        if event.type == MOUSEBUTTONDOWN:
            if pygame.mouse.get_pressed()[0]:
                mx = pygame.mouse.get_pos()[0]
                my = pygame.mouse.get_pos()[1]
                print("checking")
                
                if button1.collidepoint((mx, my)):
                    print("button 1")
                    mainActionRPG.play() #make sure code of other window is under play() function

                elif button2.collidepoint((mx, my)):
                    print("button 2")
                    
        
            
            
    
    pygame.display.update()

