예제 #1
0
    def update(self):

        global Hospital
        global House
        global School
        global Workshop
        global ppl


        self.time += self.clock.tick()
        if self.time >= 100:
            self.counter +=1
            self.time = 0
            if self.counter <50:
                threades.transform_obj.move_free((-self.prev_disp[0],-self.prev_disp[1]))
                self.prev_disp = self.move_dir[int(random.random()*25)]
                threades.transform_obj.move_free(self.prev_disp)
            if self.counter >20 and self.counter <60:
                self.alpha +=6
                self.image.fill((0,0,0,int(self.alpha)))
                #threades.screen.blit(self.image,(0,40))
            if self.counter==40:
                display_text = model.text_file.earthquake_hit_text
                threades.message.push_message(display_text,'high')
            if self.counter == 80:
                threades.audio.play_music(True,'soundtrack')
                display_earthquake_images()
                threades.demolish_facility('Hospital')
                threades.demolish_facility('House')
                threades.demolish_facility('House')
                threades.demolish_facility('House')
                threades.demolish_facility('School')
                threades.demolish_facility('Workshop')
                model.ppl.change_total_population(-10)
            if self.counter > 81:
                if self.alpha >=2:
                    self.alpha -=2
                self.image.fill((0,0,0,int(self.alpha)))
                #threades.screen.blit(self.image,(0,40))
            if self.counter >220:
                event = game_events.Event(type = game_events.ACTIONCOMPLETEEVENT, facility_name = '', res_name = '' , res_quantity = 0)
                game_events.EventQueue.add(event)
                threades.natural_calamities.remove(earth_quake)
    def update(self):

        global Hospital
        global House
        global School
        global Workshop
        global ppl


        self.counter +=1
        if self.counter <50:
            threades.transform_obj.move_free((-self.prev_disp[0],-self.prev_disp[1]))
            self.prev_disp = self.move_dir[int(random.random()*25)]
            threades.transform_obj.move_free(self.prev_disp)
        if self.counter >20 and self.counter <50:
            self.alpha +=8
            self.image.set_alpha(self.alpha)
        if self.counter==40:
            display_text = ' Your Village Sheylan has ben hit by an Earthquake'
            threades.message.push_message(display_text,'high')
        if self.counter == 80:
            display_earthquake_images()
            threades.demolish_facility('Hospital')
            threades.demolish_facility('House')
            threades.demolish_facility('House')
            threades.demolish_facility('House')
            threades.demolish_facility('School')
            threades.demolish_facility('Workshop')
            model.ppl.change_total_population(-10)
        if self.counter > 81:
            if self.alpha >2:
                self.alpha -=2
            self.image.set_alpha(self.alpha)
        if self.counter >180:
            event = game_events.Event(type = game_events.ACTIONCOMPLETEEVENT, facility_name = '', res_name = '' , res_quantity = 0)
            game_events.EventQueue.add(event)
            threades.natural_calamities.remove(earthquake)
    def update(self):

        global Hospital
        global House
        global School
        global Workshop
        global ppl

        self.counter += 1
        if self.counter < 50:
            threades.transform_obj.move_free(
                (-self.prev_disp[0], -self.prev_disp[1]))
            self.prev_disp = self.move_dir[int(random.random() * 25)]
            threades.transform_obj.move_free(self.prev_disp)
        if self.counter > 20 and self.counter < 50:
            self.alpha += 8
            self.image.set_alpha(self.alpha)
        if self.counter == 40:
            display_text = _(
                ' Your Village Sheylan has ben hit by an Earthquake')
            threades.message.push_message(display_text, 'high')
        if self.counter == 80:
            display_earthquake_images()
            threades.demolish_facility('Hospital')
            threades.demolish_facility('House')
            threades.demolish_facility('House')
            threades.demolish_facility('House')
            threades.demolish_facility('School')
            threades.demolish_facility('Workshop')
            model.ppl.change_total_population(-10)
        if self.counter > 81:
            if self.alpha > 2:
                self.alpha -= 2
            self.image.set_alpha(self.alpha)
        if self.counter > 180:
            event = game_events.Event(type=game_events.ACTIONCOMPLETEEVENT,
                                      facility_name='',
                                      res_name='',
                                      res_quantity=0)
            game_events.EventQueue.add(event)
            threades.natural_calamities.remove(earthquake)