+ return game_surface
+
+ def get_grid_surface(self, game_surface):
+ grid_size = 4
+ if self.grid_surface is None:
+ rect = game_surface.get_rect()
+ size = (rect.width, rect.height)
+ self.grid_surface = pygame.surface.Surface(
+ size, flags=pgl.SRCALPHA)
+ for i in range(0, rect.width, grid_size):
+ for j in range(0, rect.height, grid_size):
+ if (i + j) % (grid_size * 2) == 0:
+ continue
+ pygame.draw.rect(self.grid_surface, PALETTE.GREY,
+ (i, j, grid_size, grid_size))
+ return self.grid_surface
+
+ def grid_out(self, game_surface, rect):
+ orig = game_surface.copy()
+ game_surface.blit(self.get_grid_surface(game_surface), (0, 0))
+ game_surface.blit(orig, rect, rect)
+ pygame.draw.rect(game_surface, PALETTE.GREEN, rect, 8)
+
+ def introduction_to_screen_1(self, event):
+ game_surface = self.make_game_surface()
+ self.intro = 1
+
+ self.add(TextBoxWidget(
+ (24, 72), '\n'.join([
+ "These are your robot's status bits. On the left we have"
+ " the Most Significant Bit (MSB, currently set), then the"
+ " Red (unset), Green (set) and Blue (set) key bits, and"
+ " finally the four bits which control movement options, of"
+ " which only left is set. You can only move in directions"
+ " which are set.",
+ "Enter to continue.",
+ ]), fontsize=32,
+ colour=PALETTE.GREEN, padding=12, border=8,
+ bg_colour=PALETTE.BLACK, border_colour=PALETTE.GREEN,
+ box_width=400, view_port=(500, 800)))
+
+ self.grid_out(game_surface, (0, 0, 480, 60))
+
+ def introduction_to_screen_2(self, event):
+ game_surface = self.make_game_surface()
+ self.intro = 2