Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HOW FIX MY BOARD GAME
#1
Photo 
Hi, I try to make my board game like as photo.
my code :
import pygame
from sys import exit

rows = cols = 8
fps = 60
white = (255, 255, 255)
black = (0, 0, 0)

pygame.init()

screen = pygame.Rect(0, 0 , 600, 600)
surface = pygame.display.set_mode(screen.size)
pygame.display.set_caption('draughts')

class Board():
    def __init__(self):
        self.board = [] # 2d matrix
        self.red = self.black = 12
        self.red_king = self.black_king = 0

    def draw_squares(self, surface):
        surface.fill(black)
        board = pygame.Surface(512, 512)
        for i in (0 , 8):
            for j in ((i+1)//2, cols, 2):
                pygame.draw.rect(surface, white, (i*64), (j*64), 64, 64)
        surface.blit(board, (44, 44))

def main():
   run = True
   clock = pygame.time.Clock()
   board = Board()

   while run:
       for event in pygame.event.get():
           if event.type == pygame.QUIT:
               run = False


      board.draw_squares(surface)

      pygame.display.update()

   pygame.quit()

main()
Error:
File "C:/Users/Lampros/PycharmProjects/pythonProject15/main.py", line 40 board.draw_squares(surface) ^ IndentationError: unindent does not match any outer indentation level

[Image: board-with-checkers-vector-3523363]
https://www.vectorstock.com/royalty-free...or-3523363
Yoriz write Mar-31-2022, 08:35 PM:
Please post all code, output and errors (in their entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Reply


Messages In This Thread
HOW FIX MY BOARD GAME - by LAZABI - Mar-31-2022, 08:25 PM
RE: HOW FIX MY BOARD GAME - by deanhystad - Apr-01-2022, 04:15 AM
RE: HOW FIX MY BOARD GAME - by Axel_Erfurt - Apr-01-2022, 01:26 PM
RE: HOW FIX MY BOARD GAME - by BashBedlam - Apr-01-2022, 04:23 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to make a board with turtle, nothing happens when running script Quascia 3 735 Nov-01-2023, 03:11 PM
Last Post: deanhystad
  The game should now run and terminate once the board is full, but still can’t identif rango 0 1,476 Jul-22-2021, 03:24 AM
Last Post: rango
  Enabling interrupt on Adafruits button/led board Moris526 0 2,039 Apr-30-2021, 03:29 PM
Last Post: Moris526
  High-Precision Board Voltage Reading from Python into PD Liam484 1 2,109 Mar-29-2021, 02:57 PM
Last Post: Marbelous
  Interrupt for Adafruits Neotrellis button/led board Moris526 0 1,829 Dec-28-2020, 05:42 AM
Last Post: Moris526
  [Help] A function that generates an n x n sized board? vanicci 5 4,821 Aug-14-2018, 02:26 PM
Last Post: vanicci
  Serial communication with a board Bokka 2 5,394 Dec-07-2017, 07:34 AM
Last Post: Bokka
  snakes and ladders board creation help teddyben123 1 5,378 Aug-25-2017, 01:31 PM
Last Post: ichabod801
  Communicating C++ and Python in Jetson TK1 board. hlfan1234567 1 3,207 Jul-09-2017, 04:22 PM
Last Post: hlfan1234567

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020