modify Lawn mower show

zhangcongyu_branch
marblexu 6 years ago
parent 705b3220f6
commit 8e386915d1

@ -51,7 +51,8 @@ ZOMBIE_LIST = 'zombie_list'
MAP_EMPTY = 0 MAP_EMPTY = 0
MAP_EXIST = 1 MAP_EXIST = 1
MAP_OFFSET_X = 25 BACKGROUND_OFFSET_X = 220
MAP_OFFSET_X = 35
MAP_OFFSET_Y = 100 MAP_OFFSET_Y = 100
#MENUBAR #MENUBAR

@ -48,7 +48,7 @@ class Level(tool.State):
self.level = pg.Surface((self.bg_rect.w, self.bg_rect.h)).convert() self.level = pg.Surface((self.bg_rect.w, self.bg_rect.h)).convert()
self.viewport = tool.SCREEN.get_rect(bottom=self.bg_rect.bottom) self.viewport = tool.SCREEN.get_rect(bottom=self.bg_rect.bottom)
self.viewport.x += 230 self.viewport.x += c.BACKGROUND_OFFSET_X
def setupGroups(self): def setupGroups(self):
self.sun_group = pg.sprite.Group() self.sun_group = pg.sprite.Group()
@ -76,7 +76,7 @@ class Level(tool.State):
self.cars = [] self.cars = []
for i in range(self.map_y_len): for i in range(self.map_y_len):
_, y = self.map.getMapGridPos(0, i) _, y = self.map.getMapGridPos(0, i)
self.cars.append(plant.Car(-35, y, i)) self.cars.append(plant.Car(-25, y+20, i))
def update(self, surface, current_time, mouse_pos, mouse_click): def update(self, surface, current_time, mouse_pos, mouse_click):
self.current_time = self.game_info[c.CURRENT_TIME] = current_time self.current_time = self.game_info[c.CURRENT_TIME] = current_time
@ -234,7 +234,7 @@ class Level(tool.State):
plant.setAttacked() plant.setAttacked()
def checkCarCollisions(self): def checkCarCollisions(self):
collided_func = pg.sprite.collide_circle_ratio(0.7) collided_func = pg.sprite.collide_circle_ratio(0.8)
for car in self.cars: for car in self.cars:
zombies = pg.sprite.spritecollide(car, self.zombie_groups[car.map_y], False, collided_func) zombies = pg.sprite.spritecollide(car, self.zombie_groups[car.map_y], False, collided_func)
for zombie in zombies: for zombie in zombies:

Loading…
Cancel
Save