import pygame
import random
import math
pygame.init()
screen_size = (1720, 1000)
screen = pygame.display.set_mode(screen_size)
clock = pygame.time.Clock()
def drawtext(screen,font, size, text, color, center):
main_text = pygame.font.SysFont(font, size).render(text, True, color)
mtc = main_text.get_rect()
mtc.center = center
screen.blit(main_text, mtc)
def drawrect(screen,color, x, y, sizex, sizey, outlineEnable, out_color, Outwidth, brr):
box = pygame.draw.rect(screen, color, (x - sizex / 2, y - sizey / 2, sizex, sizey), 0, brr)
if outlineEnable:
out = pygame.draw.rect(screen, out_color, (x - sizex / 2, y - sizey / 2, sizex, sizey), Outwidth, brr)
return box
running = True
state = "g1"
Money = 0
Up = 10
while running:
# poll for events
# pygame.QUIT event means the user clicked X to close your window
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
screen.fill("#AAAAAA")
if state == "g1":
G = drawrect(screen,"#FFFFFF",1720/2,1000/2,200,100,True,"#000000",5,10)
drawtext(screen,None,55,"get Money","#000000",(1720 / 2,1000/2))
if G.collidepoint(pygame.mouse.get_pos()):
if pygame.mouse.get_pressed()[0] == 1:
Money += Up
drawtext(screen,None,int(50/(len(str(Money)) ** 0.3)+100),"Money : %d"%Money,"#000000",(1720 / 2, 100))
Upgrade = drawrect(screen,"#FFFFFF",1720/2,900,200,100,True,"#000000",5,10)
if Upgrade.collidepoint(pygame.mouse.get_pos()):
if pygame.mouse.get_pressed()[0] == 1:
state = "Upgrade"
drawtext(screen, None, 55, "Upgrade", "#000000", (1720 / 2, 900))
if state == "upgrade":
pygame.display.flip()
clock.tick(360) # limits FPS to 60
pygame.quit()top of page

실제 작동 상태를 확인하려면 라이브 사이트로 이동하세요.
xqwf13
xqwf13
댓글 0개
좋아요
댓글(0)
더 이상 게시물에 대한 댓글 기능이 지원되지 않습니다. 자세한 사항은 사이트 소유자에게 문의하세요.
bottom of page


