def main(): global FPSCLOCK, DISPLAYSURF, BASICFONT, BIGFONT, NETWORK, STATE pygame.init() FPSCLOCK = pygame.time.Clock() DISPLAYSURF = pygame.display.set_mode((WINDOWWIDTH, WINDOWHEIGHT)) pygame.display.set_caption('EDGE') NETWORK = NetworkListener() while True: while STATE == "TITLE": title() connection.Pump() NETWORK.Pump() opening = pygame.image.load('images/opening.png') opening_rect = opening.get_rect() opening = DISPLAYSURF.blit(opening, opening_rect) pygame.display.flip() pygame.time.delay(3000) g_time = time.time() #g_time -= 1 initProcess() while True: if STATE == "GAMEOVER": break connection.Pump() NETWORK.Pump() mainLoop() Gameover() connection.Pump() NETWORK.Pump()
def Loop(self): # set infinite loop while True: # update all connection.Pump() client.Pump() # need to send connection if __name__ == '__main__': main(tiles, descrp, gridpositions, positionx, positiony, size) game(arrayofcoords, tiles) # after first loop, send information that this player is ready if self.ready == False: connection.Send({"action": "playready", "playr": self.num}) self.ready = True # while there are less than 3 players, loop while self.rplay < 3: self.screen.fill((0, 0, 0)) self.screen.blit( self.font.render( "Not all players are ready, please wait...", True, (255, 255, 255)), (10, 10)) pygame.display.flip() # pump to check for changes connection.Pump() client.Pump() # keep window alive ############### pygame.event.pump() # once all players are ready, break out of while and send info to server self.allready = True connection.Send({'action': 'ready'}) ######## tests that we got out of the loop #### new while while self.actioncomplete == False: self.screen.fill((255, 255, 255)) pygame.display.flip() connection.Pump() client.Pump() #print("Number of ready players = ", self.rplay) ####used to be while print("Action complete") pygame.display.flip() connection.Pump() client.Pump() print("Current totals after action", self.points) ############################## #wait??? self.screen.blit( self.font.render(str(self.points[self.num - 1]), True, (0, 0, 0)), (10, 10)) pygame.display.flip() pygame.time.wait(1000000) ################# put send here and reset action to None after ##screen blit self.screen.blit( self.font.render(str(self.points[self.num - 1]), True, (0, 0, 0)), (10, 10)) pygame.display.flip() pygame.time.wait(1000000)
def game2(arrayofcoords,tiles,money,finished,maingame, score = None, rounds = None): #updated size of the display #Keep this the same for display purposes? size =[600,600] #initalising some colours that can be used later white = [255,255,255] #again initalizing the sreen screen = pygame.display.set_mode(size) #filling it in white screen.fill(white) #adding title text basicfont = pygame.font.SysFont(None, 24) text = basicfont.render('The Pirate Game', True, (255, 0, 0), (255, 255, 255)) screen.blit(text,(225,25)) #displaying the action tiles for x in range(2): for y in range(3): screen.blit(normallineh, [(x+1)*64+5, (y+1)*64]) for x in range(3): for y in range(2): screen.blit(normallinev, [(x+1)*64, (y+1)*64+5]) # BLITTING THE TILES ONTO THE GRID # blits at the right positions for i in range(len(arrayofcoords[0])): if i <= 1: screen.blit(tiles[0][i], [arrayofcoords[0][i]*64+12, arrayofcoords[1][i]*64+20]) else: screen.blit(money[0][i-2], [arrayofcoords[0][i]*64+12, arrayofcoords[1][i]*64+20]) fontobject = pygame.font.Font(None,30) #press any key to continue code if finished == False: screen.blit(fontobject.render("Press any key to continue" ,True,(0,0,0)), (20,500)) pygame.display.flip() keypressed = False while keypressed == False: #pygame.event.get() event = pygame.event.poll() if event.type == KEYDOWN: keypressed = True elif finished == True and maingame == False: screen.blit(fontobject.render("Waiting for other players" ,True,(0,0,0)), (20,500)) pygame.display.flip() connection.Pump() client.Pump() #needed pygame.event.pump() elif finished == True and maingame == True: connection.Pump() client.Pump() screen.blit(fontobject.render("Your current score: " + str(score), True, (0,0,0)),(20,500)) screen.blit(fontobject.render("Round: " + str(rounds), True, (0,0,0)), (300,500)) pygame.display.flip()
def intro_screen(self): #Intro screen with play and instructions button while self.intro: connection.Pump() self.Pump() for event in pygame.event.get(): connection.Pump() self.Pump() # end the game in necessary if event.type == pygame.QUIT: connection.Pump() self.Pump() connection.Send({"action": 'playerdisconnect', "num": self.playernumber}) connection.Pump() self.Pump() exit(0) mouse = pygame.mouse.get_pos() click = pygame.mouse.get_pressed() #Adds objects to screen self.screen.blit(self.bg,(0,0))# Background self.screen.blit(self.maintitle, (220,50))#title pygame.draw.rect(self.screen, [255,100,100], (485,325,150,100)) pygame.draw.rect(self.screen, [255,100,100], (485,500,150,100)) self.screen.blit(self.playgametxt, (485, 345)) self.screen.blit(self.instructionstxt, (486, 535)) #gives you acces to view certain things if self.my_turn==True and self.access==True: self.screen.blit(self.yourtunrfirsttxt, (250,250)) if self.my_turn==False and self.gamestart==False: self.screen.blit(self.waitingtxt, (325,250)) if self.my_turn==False and self.gamestart==True: self.screen.blit(self.waitingforstarttxt, (275,250)) #Starts main menu loop when click play if 485 < mouse[0]<635 and 325 < mouse[1] <425: pygame.draw.rect(self.screen, [255,50,50], (485,325,150,100)) self.screen.blit(self.playgametxt, (485, 345)) #if click[0] and self.gamestart==True and self.my_turn==True or self.otherstart==True and self.access==True: if click[0] and self.access==True: connection.Pump() self.Pump() connection.Send({"action": "otherplayercanstart", "access": True}) self.deckcreate() self.deal_out() self.Loop() #Starts instruction when clicked if 485 < mouse[0]<635 and 500 < mouse[1] <600: pygame.draw.rect(self.screen, [255,50,50], (485,500,150,100)) self.screen.blit(self.instructionstxt, (486, 535)) if click[0]: self.instructionrunning=True self.instructions() pygame.display.update() #Update display
def Network_changesquare(self,data): #print for testing purposes print("CHANGING SQUARE") #setting the current square array at place zero to the value for x self.currentsquare[0] = data['x'] #setting the current square array at place one to the value for y self.currentsquare[1] = data['y'] #added to capture counter #setting the current square array at place one to the value for counter self.currentsquare[2] = data['counter'] #setting the xcoord variable to the x value in the array xcoord = self.currentsquare[0] #setting the ycoord variable to y value in the ycoord = self.currentsquare[1] #determining position of the square in arrayofcoords for i in range(len(arrayofcoords[0])): for j in range(len(arrayofcoords[0])): if xcoord == arrayofcoords[0][j] and ycoord == arrayofcoords[1][j]: #setting position as where the action tile was found self.position = j #break out of the loop if the position is required break # update values connection.Pump() client.Pump() #if position is in the first two if self.position <=1: #set the action value to be the tiles descrp self.action = tilesdescrp[self.position] ############## ACCESS TO TILES tiles[0][self.position] = tiles[1][self.position] game2(arrayofcoords,tiles,money,True,True) #testing purposes print("Client action: ", self.action) else: self.action = moneydescrp[self.position-2] money[0][self.position-2] = money[1][self.position-2] #self.points is an array game2(arrayofcoords,tiles,money,True,True,self.points[self.num-1],self.rounds) #testing purposes print("Client action: ", self.action) #sending the action back to the server #is self.num 2 for player 2 or 1??? # player 2 for player 2 connection.Send({'action':'actiontodo','actionsarray':self.action, 'number':self.num}) #Pumping the server and the client to ensure they receive new data connection.Pump() client.Pump()
def update(self): self.Pump() connection.Pump() self.screen.fill(WHITE) self.chat_box.draw(self.screen) pygame.display.flip() for event in pygame.event.get(): if event.type == pygame.QUIT: exit(1) elif event.type == pygame.KEYDOWN: if event.key == pygame.K_BACKSPACE: self.chat_box.input_box.text.subtract(1) elif control_pressed( pygame.key.get_pressed()) and event.key == pygame.K_v: # the user wants to paste something self.chat_box.input_box.text.paste() elif event.key == pygame.K_RETURN: connection.Send({ 'action': 'send_message', 'room_id': self.room_id, 'text_items': [ t.serialize() for t in self.chat_box.input_box.text.text_items ] }) #self.chat_box.add(self.chat_box.input_box.text.get_text()) elif event.key in DISPLAY_KEYS: to_add = chr(event.key) if event.key == pygame.K_q: self.chat_box.input_box.text.delete_lines(2) if shift_pressed(pygame.key.get_pressed()): to_add = shift(to_add) self.chat_box.input_box.text.add(to_add)
def Pump(self): connection.Pump() ConnectionListener.Pump(self) Concurrent.Pump(self) # try and reconnect every 30 seconds if self.serverconnection != 1 and time() > self.lastConnect + 30: self.Connect()
def instructions(self): while self.instructionrunning: self.clock.tick(60) # update connection connection.Pump() # update the listener self.Pump() for event in pygame.event.get(): # end the game in necessary if event.type == pygame.QUIT: exit(0) mouse = pygame.mouse.get_pos() click = pygame.mouse.get_pressed() self.screen.blit(self.bg, (0, 0)) self.screen.blit(self.instructionsimg, (0, 0)) pygame.draw.rect(self.screen, [255, 100, 100], (920, 575, 200, 75)) self.screen.blit(self.exit, (965, 590)) if 965 < mouse[0] and 590 < mouse[1]: pygame.draw.rect(self.screen, self.red, (920, 575, 200, 75)) #start, wide, height self.screen.blit(self.exit, (965, 590)) if event.type == pygame.MOUSEBUTTONDOWN: self.instructionrunning = False self.intro_screen() pygame.display.update()
def update(self, x, y): # look for new events/messages connection.Pump() self.Pump() # clear screen self.x = x self.y = y # self.gameid += 1 # self.num += 1 data['x'] = self.x data['y'] = self.y data['gameid'] = self.gameid data['num'] = self.num # pygame.display.update(self.dot) pygame.draw.circle(Dot.screen, DOT_1, (self.x, self.y), RADIUS, 0) print "local update" #server communication n send coordinates: data self.Send({ 'action': "place", 'x': self.x, 'y': self.y, 'gameid': self.gameid, 'num': self.num })
def update(self): connection.Pump() self.Pump() if self.is_waiting_to_start: for event in pygame.event.get(): # quit if the quit button was pressed if event.type == pygame.QUIT: exit() return # sleep to make the game 60 fps self.clock.tick(60) # clear the screen self.screen.fill(0) self._handle_actions() self._draw_table() self._draw_player() if self.is_turn: self._draw_buttons() if time.time() - self.error_time < 8: self.screen.blit(self.error_raise_msg, (self.width - 135, self.height - 80)) self._draw_others() # update the screen pygame.display.update()
def run(self): #CHAMADA EM REDE self.name = "JORGE" #BUSCA O NOME DA FUNCAO E PASSA O PARAMETRO NO CASO O MEU NOME self.Send({"action": "testeChamadaJorge", "name": self.name}) #CHAMADA EM REDE run = 1 while run: #CONEXAO REDE connection.Pump() self.Pump() self.chamadaEventoAoClicar(Utils.listaTodasPedrasEJogadores) self.chamadaEventoAoClicarDominoMesa() self.chamadaImagensDomino(Utils.listaPedrasJogadorUm, 1) self.chamadaImagensDomino(Utils.listaPedrasJogadorDois, 2) self.chamadaImagensDomino(Utils.listaPedrasJogadorTres, 3) self.chamadaImagensDomino(Utils.listaPedrasJogadorQuatro, 4) pygame.display.update()
def score_screen(self): screen.fill(TEAL) title = self.big_font.render("Scores", 1, BLACK) back_text = self.small_font.render("Back", 1, BLACK) refresh = self.small_font.render("Refresh", 1, BLACK) screen.blit(title, (300, 10)) pygame.draw.rect(screen, LIME, self.back_button) screen.blit(back_text, (700, 500)) pygame.draw.rect(screen, LIME, self.refresh_button) screen.blit(refresh, (700, 150)) if self.scores is None: # no scores in database no_scores = self.normal_font.render("No Scores available", 1, BLACK) screen.blit(no_scores, (300, 100)) else: y = 50 pos = 1 for scores in self.scores: name = scores[0] score = scores[1] score = self.normal_font.render( str(pos) + ": " + name.upper() + ": " + str(score), 1, BLACK) screen.blit(score, (10, y)) pos += 1 y += 30 connection.Pump( ) # only check for messages during score screen, as networking is on used in this one location # for the menu code. Any other needs for calling pump are in the game.py code, so not here. self.Pump()
def __init__(self): pygame.init() # memulai pygame self.screen = pygame.display.set_mode((500, 500)) # buat layar # inialisasi untuk status permainan (koordinasi dengan server) self.flag = [[0 for xrange in range(500)] for yrange in range(500)] self.inisialisasi() self.statuswin = None self.num = None self.running = False self.statusturn = None self.movement = [[0 for a in range(100)] for b in range(100)] print self.movement[0][0] # self.screen.fill((190,190,190)) host, port = "10.151.62.84", 6969 print "Connect to: ", host, ":", port self.Connect((host, int(port))) self.gameid = None # Membuat layar menunggu untuk client yang pertama konek ke server if not self.running: thread = Thread(target=self.tunggu()) thread.start() # untuk mengecek sudahkah ada musuh yang masuk while not self.running: for event in pygame.event.get(): if event.type == pygame.QUIT: exit() connection.Pump() self.Pump() sleep(0.01)
def clientdua(self): # print 123 # if self.playerke == 1: # self.statusturn = True # else: # self.statusturn = False``` connection.Pump() self.Pump() for event in pygame.event.get(): if self.statusturn == True: if event.type == pygame.QUIT: exit() elif event.type == pygame.MOUSEBUTTONDOWN: posX = event.pos[0] posY = event.pos[1] for i in range(5): for j in range(5): if (posX <= (i + 1) * 100 and posX >= i * 100 and posY >= j * 100 and posY <= (j + 1) * 100): posXdraw = i * 100 + 30 posYdraw = j * 100 + 20 if self.flag[posXdraw][posYdraw] == 0: self.cowok(posXdraw, posYdraw, 0, self.gameid) self.flag[posXdraw][posYdraw] = 1 print "Drawing Cowok" self.movement[i][j] = 2 self.calcScore(i, j, 2) elif pygame.key.get_pressed()[pygame.K_SPACE]: print "spasi nih sob"
def check_connection(): seconds = 0 while seconds < TIME_OUT and not connection.isConnected: connection.Pump() Client.Pump() seconds += 1 time.sleep(1) return connection.isConnected
def serverstuff(self): #Experimental connection.Pump() self.Pump() connection.Send({ "action": "myaction", "blah": 123, "things": [3, 4, 3, 4, 7] })
def Loop(self): self.Pump() connection.Pump() self.events() self.draw() if "connecting" in self.statusLabel: self.statusLabel = "connecting" + "".join(["." for s in range(int(self.frame / 30) % 4)])
def Loop(self): self.Pump() connection.Pump() self.Events() self.Draw([(self.players[p]['color'], self.players[p]['lines']) for p in self.players]) if "connecting" in self.statusLabel: self.statusLabel = "connecting" + "".join(["." for s in range(int(self.frame / 30) % 4)])
def update(self): if self.me+self.otherplayer==36: self.didiwin=True if self.me>self.otherplayer else False return 1 #sleep to make the game 60 fps self.justplaced-=1 self.clock.tick(60) connection.Pump() self.Pump() #clear the screen self.screen.fill(0) self.drawBoard() self.drawHUD() self.drawOwnermap() for event in pygame.event.get(): #quit if the quit button was pressed if event.type == pygame.QUIT: exit() #update the screen #1 mouse = pygame.mouse.get_pos() #2 xpos = int(math.ceil((mouse[0]-32)/64.0)) ypos = int(math.ceil((mouse[1]-32)/64.0)) #3 is_horizontal = abs(mouse[1] - ypos*64) < abs(mouse[0] - xpos*64) #4 ypos = ypos - 1 if mouse[1] - ypos*64 < 0 and not is_horizontal else ypos xpos = xpos - 1 if mouse[0] - xpos*64 < 0 and is_horizontal else xpos #5 board=self.boardh if is_horizontal else self.boardv isoutofbounds=False #6 try: if not board[ypos][xpos]: self.screen.blit(self.hoverlineh if is_horizontal else self.hoverlinev, [xpos*64+5 if is_horizontal else xpos*64, ypos*64 if is_horizontal else ypos*64+5]) except: isoutofbounds=True pass if not isoutofbounds: alreadyplaced=board[ypos][xpos] else: alreadyplaced=False if pygame.mouse.get_pressed()[0] and not alreadyplaced and not isoutofbounds and self.turn and self.justplaced<=0: self.justplaced=10 elif is_horizontal: self.boardh[ypos][xpos]=True self.Send({"action": "place", "x":xpos, "y":ypos, "is_horizontal": is_horizontal, "num": self.num, "gameid": self.gameid}) else: self.boardv[ypos][xpos]=True self.Send({"action": "place", "x":xpos, "y":ypos, "is_horizontal": is_horizontal, "num": self.num, "gameid": self.gameid}) pygame.display.flip()
def __init__(self): # init pygame, font, width, height pygame.init() pygame.font.init() self.width, self.height = 400, 500 # init the screen, title self.screen = pygame.display.set_mode((self.width, self.height)) pygame.display.set_caption("Tic-Tac-Toe") # init pygame clock self.clock = pygame.time.Clock() #init the graphics self.initGraphics() # init turn self.turn = True # init board, 2D array of bool self.board = [[False for x in range(3)] for y in range(3)] # init ownerboard, same 2D array but of 0s self.owner = [[0 for x in range(3)] for y in range(3)] # init win states self.didiwin = False self.didilose = False # get server address, default: localhost:8000, connect to it address = input("Address of Server: ") try: if not address: host, port = "localhost", 8000 else: host, port = address.split(":") self.Connect((host, int(port))) except: print("Error Connecting to Server") print("Usage:", "host:port") print("e.g.", "localhost:31425") print("Default:", "localhost:8000") exit() print("Boxes client started") # set running state to False initially self.running = False # keep checking if it should start while not self.running: self.Pump() connection.Pump() sleep(0.01) # determine attributes from player, if 0, player0, X, else player1, O if self.num == 0: self.turn = True self.marker = self.xplayer self.othermarker = self.oplayer else: self.turn = False self.marker = self.oplayer self.othermarker = self.xplayer
def LogicUpdate(self): if self.start_pump: #if we are connected self.Pump() #podsixnet library working connection.Pump() #podsixnet library working #if not self.locked: #if we are allowed to move windows # self.HandleWindows() #handle windows movement self.HandleWindows() if self.stage: #if we have a stage (where the game is played self.stage.LogicUpdate() #update the stage
def wait(self): print "waiting" self.running = False while not self.running: connection.Pump() self.Pump() self.screen.fill([255,255,255]) self.drawAll() pygame.display.flip()
def Loop(self): self.Pump() connection.Pump() self.Events() self.Draw([(self.players[p]['color'], self.players[p]['lines']) for p in self.players]) if "connecting" in self.statusLabel: self.statusLabel = "connecting" + ("." * ((self.frame / 30) % 4))
def updateConnection(self): connection.Pump() self.Pump() # check timeout ticks = pygame.time.get_ticks() if self.last and ticks - self.last > Player.TIMEOUT * 30: self.Network_disconnected({"action": "disconnected"}) elif self.last and ticks - self.last > Player.TIMEOUT: raise ServerTimeout
def Loop(self): # main client loop. Monitors network and once the game has started it allows moves. self.Pump() connection.Pump() if self.ready: self.player_move() self.events() self.draw() sleep(1/60)
def __init__(self): """ Initialise les paramètres graphiques et permet la connection au serveur. Tant que la méthode startgame n'est pas déclenchée, est à l'écoute d'un message du serveur. """ pygame.init() #Ouverture de la fenêtre Pygame self.fenetre = pygame.display.set_mode((1200, 700), pygame.RESIZABLE) #Creation des images du menu self.fond_menu = pygame.image.load("fond_menu.png").convert() self.fond_uni = pygame.image.load("fond_uni.png").convert() #Création de la police du jeu self.police = pygame.font.Font("coda.ttf", 20) #Load font object. self.police_small = pygame.font.Font("coda.ttf", 17) #Load font object. #définition des couleurs self.COLOR_INACTIVE = pygame.Color('lightskyblue3') self.COLOR_ACTIVE = pygame.Color('dodgerblue2') self.COLOR_ERROR = pygame.Color('tomato2') #définition des polices self.police1 = pygame.font.SysFont('calibri', 15) self.police2 = pygame.font.SysFont('calibri', 25) self.police3 = pygame.font.SysFont('calibri', 35) self.dico_stop = {} self.fin = False self.Connect() #En appuyant sur entrée sans préciser d'adresse, le client se connecte automatiquement #au localhost. address = input("Adresse du serveur : ") try: if not address: host, port = "localhost", 8000 else: host, port = address.split(":") self.Connect((host, int(port))) except: print("Erreur lors de la connextion au serveur") print("Utilisation:", "host:port") print("exemple : ", "localhost:31425") exit() print("Joueur connecté") self.running = False while not self.running: self.Pump() connection.Pump() sleep(0.01)
def __init__(self, model): #pygame.mixer.init() self._model = model ##self._beep_sound=pygame.mixer.Sound("beep.wav") self._connected = False self.Connect() while not self._connected: self.Pump() connection.Pump() sleep(0.01)
def get_users(ip): network_listener = NetworkListener(ip, 4330) Player_ID = 0 while (True): connection.Pump() if Player_ID != 0: connection.Send({'action': 'top'}) network_listener.Pump() if server_state['action'] == 'top': return (server_state['users'], server_state['users'][-1])
def __init__(self): pygame.init() size = width, height = 600, 600 self.screen = pygame.display.set_mode(size) pygame.display.set_caption("Setup") self.bg = (200, 200, 200) self.players = [] self.players.append(Player(pygame.image.load("player1.png"))) self.players.append(Player(pygame.image.load("player2.png"))) self.players[1].rect.x = width - self.players[1].rect.width # print(self.players[1].rect.x) # ball display self.ball = Ball(pygame.image.load("ball.png")) self.ball.rect.x = width/3 self.ball.rect.y = height/4 + height/2 self.positiveX = 1 self.positiveY = 1 self.ball.out = 0 self.gameID = None self.player = None self.clock = pygame.time.Clock() self.screen.fill(self.bg) # self.Connect() # Trying multi PC address = input('Address os server: ') try: if not address: host, port = "localhost", 8000 else: host, port = address.split(":") self.Connect((host, int(port))) except: print("Error Connecting to server") exit() print("Connection Done") self.running = False while not self.running: self.check_exit() self.Pump() connection.Pump() sleep(0.01) pygame.display.set_caption("Gameid: {} - player:{}".format(self.gameID, self.player))
def update(self): connection.Pump() self.Pump() #sleep to make the game 60 fps self.clock.tick(60) #clear the screen self.screen.fill(0) self.drawBoard() for event in pygame.event.get(): #quit if the quit button was pressed if event.type == pygame.QUIT: exit() # setting up the mouse positioning # get the position of mouse mouse = pygame.mouse.get_pos() # in relation to the grid because each square is 64x64 pixels xpos = int(math.ceil((mouse[0]-32)/64.0)) ypos = int(math.ceil((mouse[1]-32)/64.0)) # check if the mouse is closer to the horizontal or vertical line is_horizontal = abs(mouse[1] - ypos*64) < abs(mouse[0] - xpos*64) # get new postiion on the grid based on is_horizontal variable ypos = ypos - 1 if mouse[1] - ypos*64 < 0 and not is_horizontal else ypos xpos = xpos - 1 if mouse[0] - xpos*64 < 0 and is_horizontal else xpos # initialise the board variable based on whichever is correct board=self.boardh if is_horizontal else self.boardv isoutofbounds=False # draw the hover line, checks if out of bounds. If the line is alr drawn, don't draw the hover line try: if board[ypos][xpos] is None: self.screen.blit(self.hoverlineh if is_horizontal else self.hoverlinev, [xpos*64+5 if is_horizontal else xpos*64, ypos*64 if is_horizontal else ypos*64+5]) except: isoutofbounds=True pass if not isoutofbounds: owner = board[ypos][xpos] else: owner = None # what happens in the game when you click the button if pygame.mouse.get_pressed()[0] and owner is None and not isoutofbounds: if time.time() - self.last_click > self.min_click_time: self.last_click = time.time() print("click") self.Send({"action": "place", "x":xpos, "y":ypos, "is_horizontal": is_horizontal, "gameid": self.gameid, "num": self.num, 'turn': self.player}) #update the screen pygame.display.flip()