Generation

testsTue, 15 Nov 2022

#!/usr/bin/python2.7 import sys import pygame from pygame import sprite from random import randint from sprites import Robot, Wall from constant import * # Main pygame.init() screen = pygame.display.set_mode(SIZE) pygame.display.set_caption("iRobot visual. Author: Laletin Vadim KI10-01") background = pygame.image.load("laminat.png").convert() walls = sprite.Group() irobot = Robot(screen, walls) # Make walls around for i in range(0, WIDTH - SPRITE_WIDTH, SPRITE_WIDTH): up_wall = Wall(i, 0) up_wall.render(background) down_wall = Wall(i, HEIGHT - SPRITE_HEIGHT - OFFSET * 2) down_wall.render(background) walls.add(up_wall, down_wall) for i in range(SPRITE_HEIGHT, HEIGHT - SPRITE_HEIGHT * 2, SPRITE_HEIGHT): left_wall = Wall(0, i) left_wall.render(background) right_wall = Wall(WIDTH - SPRITE_WIDTH - OFFSET * 2, i) right_wall.render(background) walls.add(left_wall, right_wall) started = False fps = 60 clock = pygame.time.Clock() state = STATE_MOVE

Questions about programming?Chat with your personal AI assistant