def setup(self): self.screen_rect = get_screenrect() self.player_rect = pygame.Rect(20, self.screen_rect.height - 40, 50, 15) self.player_rect.centerx = self.screen_rect.centerx self.setup_ball() self.setup_blocks()
def __init__(self, x, y, game): self.game = game self.screenrect = get_screenrect() self.size = random.randint(3, 6) self.range = random.randint(35, 60) self.current_range = self.size + 1 self.current_job = None self.target = None self.scan_speed = random.randint(100, 200) self.scan_timer = 0 self.found_waiting_timer = 0 self.found_waiting_time = 500 self.position = pygame.Vector2(x, y) self.velocity = pygame.Vector2(random.random(), random.random()) self.state = None self.change_state("scanning", "Ant Init") self.colors = { "searching": (50, 50, 50), "scanning": (100, 100, 100), "found": (150, 150, 150), "found_waiting": (175, 175, 150), "moving_to_exit": (200, 200, 200), } self.speeds = { "searching": 0.05, "found": 0.05, "moving_to_exit": 0.1, } self.speed = 0.05
def __init__(self): self.screenrect = get_screenrect() self.sidebar_width = 200 self.game_area = pygame.Rect( 0, 0, self.screenrect.width - self.sidebar_width, self.screenrect.height) self.ant_count = 4 self.ants = [] self.create_ants(self.ant_count) self.sidebar = Sidebar( pygame.Rect( self.screenrect.width - self.sidebar_width, 0, self.sidebar_width, self.screenrect.height, ), self, ) # right now a job is just a position # we want the ant to pick up the thing # and move it to a spot to drop it off self.jobs = [] self.working_jobs = [] self.done_jobs = [] self.drop_off = pygame.Rect(20, 20, 20, 20) self.create_jobs(self.ant_count)
def __init__(self): self.screenrect = get_screenrect() self.world = World(Data.world_data) self.player = Player() self.camera = Camera() self.menu = GameMenu() self.dialog = Dialog() # figure out where this should go self.map_pad = 128
def __init__(self, manager): self.manager = manager self.screenrect = get_screenrect() self.player = Player(64, 64) self.world = World(levels.data) self.world.load("World") self.camera = Camera() self.menu = GameMenu() # ? self.map_pad = 128
def __init__(self): self.screenrect = get_screenrect() self.padding = 16 self.dialog_rect = pygame.Rect( self.padding, self.padding, self.screenrect.width - (self.padding * 2), self.screenrect.height // 2) self.image = None self.active = False self.lines = None self.render_lines(["test", "test2"])
def __init__(self): self.screenrect = get_screenrect() self.image = None self.active = False self.menu_items = ["Status", "Quests", "Magic", "Equipment"] self.menu_width = 200 self.page_width = self.screenrect.width - self.menu_width self.padding = 16 self.menu = MenuWidget(self.menu_items, self.page_width, 20, text_color=(255, 255, 255), font_size=32) self.render()
def __init__(self): self.money= 500 self.irand= randint(3, 10) self.screenrect = get_screenrect() self.surface = pygame.Surface((1280, 720)) self.background_image = load_image("bg.png") self.surface.blit(self.background_image, (0, 0)) self.game_timer = 0 self.wave_times2 = [[100]] self.wave_times = [ [100, 1000, 1500, 2500, 3000, 6000], [100, 500, 1000], [100, 500, 1300, 2400] ] self.wave_time_index = 0 self.money_index = 500 self.current_wave = self.wave_times[self.wave_time_index] self.current_wave_completed = False self.current_wave_index = 0 self.tower_pos = [ [150, 50, "down"], [150, 120, "down"], ] self.slots = [] self.towers = [] self.waypoint_list = [ [100, 0], [100, 620], [400, 620], [400, 100], [700, 100], [700, 620], [1000, 620], [1000, 100], [1280, 100] ] self.enemies = [] self.spawned = 0 self.killed = 0 self.wave_text = text_surface("Wave: 1", font_size=24) self.money_text = text_surface("Danish Dollars: 500", font_size=24) self.health_index = 100 self.health_text = text_surface("Health: 100", font_size=24) self.post_init() self.lost = text_surface("YOU LOST!", font_size=50)
def __init__(self): self.screenrect = get_screenrect() self.surface = pygame.Surface((480, 320)) self.background_image = load_image("bg.png") self.surface.blit(self.background_image, (0, 0)) self.game_timer = 0 self.wave_times2= [[100]] self.wave_times = [ [100, 1000, 1500, 2500, 3000, 6000], [100, 500, 1000], [100, 500, 1300, 2400] ] self.wave_time_index = 0 self.current_wave = self.wave_times[self.wave_time_index] self.current_wave_completed = False self.current_wave_index = 0 self.tower_pos = [ [60, 32, "down"], [150, 32, "down"], [240, 32, "down"], [330, 32, "down"], [370, 124, "up"], [280, 124, "up"], [190, 124, "up"], [100, 124, "up"], [60, 218, "up"], [150, 218, "up"], [240, 218, "up"], [330, 218, "up"], ] self.slots = [] self.towers = [] self.waypoint_list = [ [0, 100], [440, 100], [440, 194], [35, 194], [35, 286], [380, 286], ] self.enemies = [] self.spawned = 0 self.killed = 0 self.wave_text = text_surface("Wave: 1", font_size=24) self.post_init()
def __init__(self, x, y): self.screenrect = get_screenrect() self.size = 8 self.rect = pygame.Rect(x, y, self.size, self.size) self.color = (0, 255, 0) self.speed = 0.125
def __init__(self): self.screenrect = get_screenrect() self.image = None self.active = False self.render()