Ejemplo n.º 1
0
 def on_render(self):
     if self.mined == False:
         if self.animation == None or self.animation.action != "stand":
             self.animation = action.Action(self, stand.data)
     if self.mined == True:
         if self.animation == None or self.animation.action != "mined":
             self.animation = action.Action(self, mined.data)
     self.animation.on_render(self)
     pass
Ejemplo n.º 2
0
Archivo: view.py Proyecto: rschum/game
 def set_animation(self):
     view.View.set_animation(self)
     s = abs(self.speed().length())
     if s > 0 and s <= 4:
         if self.animation == None or self.animation.action != "walk":
             self.animation = action.Action(self, walk.data)
     elif s > 4:
         if self.animation == None or self.animation.action != "run":
             self.animation = action.Action(self, run.data)
     pass
Ejemplo n.º 3
0
    def on_render(self):
        if self.grid.get_charge() >= 50:
            if self.use_state != model.UseState.ON:
                self.use_state = model.UseState.ON
                self.animation = action.Action(self, on.data)
        else:
            if self.use_state != model.UseState.OFF:
                self.use_state = model.UseState.OFF
                self.animation = action.Action(self, off.data)

        self.animation.on_render(self)
        pass
Ejemplo n.º 4
0
 def on_render(self):
     if self.charge < 19:
         if self.charge_state != model.ChargeState.PERCENT_000:
             self.charge_state = model.ChargeState.PERCENT_000
             self.animation = action.Action(self, percent_000.data)
     if self.charge >= 20 and self.charge <= 39:
         if self.charge_state != model.ChargeState.PERCENT_020:
             self.charge_state = model.ChargeState.PERCENT_020
             self.animation = action.Action(self, percent_020.data)
     if self.charge >= 40 and self.charge <= 59:
         if self.charge_state != model.ChargeState.PERCENT_040:
             self.charge_state = model.ChargeState.PERCENT_040
             self.animation = action.Action(self, percent_040.data)
     if self.charge >= 60 and self.charge <= 79:
         if self.charge_state != model.ChargeState.PERCENT_060:
             self.charge_state = model.ChargeState.PERCENT_060
             self.animation = action.Action(self, percent_060.data)
     if self.charge >= 80 and self.charge <= 99:
         if self.charge_state != model.ChargeState.PERCENT_080:
             self.charge_state = model.ChargeState.PERCENT_080
             self.animation = action.Action(self, percent_080.data)
     if self.charge >= 100:
         if self.charge_state != model.ChargeState.PERCENT_100:
             self.charge_state = model.ChargeState.PERCENT_100
             self.animation = action.Action(self, percent_100.data)
     
     self.animation.on_render(self)
     pass
Ejemplo n.º 5
0
Archivo: view.py Proyecto: rschum/game
 def on_render(self):
     p = self.get_stored_percent()
     if p < .19:
         if self.capacity_state != model.CapacityState.PERCENT_000:
             self.capacity_state = model.CapacityState.PERCENT_000
             self.animation = action.Action(self, percent_000.data)
     if p >= .20 and p <= .39:
         if self.capacity_state != model.CapacityState.PERCENT_020:
             self.capacity_state = model.CapacityState.PERCENT_020
             self.animation = action.Action(self, percent_020.data)
     if p >= .40 and p <= .59:
         if self.capacity_state != model.CapacityState.PERCENT_040:
             self.capacity_state = model.CapacityState.PERCENT_040
             self.animation = action.Action(self, percent_040.data)
     if p >= .60 and p <= .79:
         if self.capacity_state != model.CapacityState.PERCENT_060:
             self.capacity_state = model.CapacityState.PERCENT_060
             self.animation = action.Action(self, percent_060.data)
     if p >= .80 and p <= .99:
         if self.capacity_state != model.CapacityState.PERCENT_080:
             self.capacity_state = model.CapacityState.PERCENT_080
             self.animation = action.Action(self, percent_080.data)
     if p >= 1.0:
         if self.capacity_state != model.CapacityState.PERCENT_100:
             self.capacity_state = model.CapacityState.PERCENT_100
             self.animation = action.Action(self, percent_100.data)
     self.animation.on_render(self)
     pass
Ejemplo n.º 6
0
Archivo: view.py Proyecto: rschum/game
 def __init__(self):
     view.View.__init__(self)
     self.dimensions.x = 100
     self.dimensions.y = 100
     self.animation = action.Action(self, stand.data)
     pass
Ejemplo n.º 7
0
 def __init__(self):
     view.View.__init__(self)
     self.dimensions.x = 32
     self.dimensions.y = 64
     self.animation = action.Action(self, percent_000.data)
     pass
Ejemplo n.º 8
0
    def on_render(self):
        if self.health_state == model.HealthState.HEALTHY:
            if self.created_delta() <= 10:
                if self.growth_state != model.GrowthState.SEED:
                    if self.healthy_seed is not None:
                        self.growth_state = model.GrowthState.SEED
                        self.animation = action.Action(self,
                                                       self.healthy_seed.data)
            elif self.created_delta() <= 20:
                if self.growth_state != model.GrowthState.SPROUT:
                    if self.healthy_sprout is not None:
                        self.growth_state = model.GrowthState.SPROUT
                        self.animation = action.Action(
                            self, self.healthy_sprout.data)
            elif self.created_delta() <= 30:
                if self.growth_state != model.GrowthState.SAPLING:
                    if self.healthy_sapling is not None:
                        self.growth_state = model.GrowthState.SAPLING
                        self.animation = action.Action(
                            self, self.healthy_sapling.data)
            elif self.created_delta() <= 40:
                if self.growth_state != model.GrowthState.MATURE:
                    if self.healthy_mature is not None:
                        self.growth_state = model.GrowthState.MATURE
                        self.animation = action.Action(
                            self, self.healthy_mature.data)
            elif self.created_delta() > 40:
                if self.growth_state != model.GrowthState.RIPE:
                    if self.healthy_ripe is not None:
                        self.growth_state = model.GrowthState.RIPE
                        self.animation = action.Action(self,
                                                       self.healthy_ripe.data)

        if self.health_state == model.HealthState.DAMAGED:
            if self.created_delta() <= 10:
                if self.growth_state != model.GrowthState.SEED:
                    if self.damaged_seed is not None:
                        self.growth_state = model.GrowthState.SEED
                        self.animation = action.Action(self,
                                                       self.damaged_seed.data)
            elif self.created_delta() <= 20:
                if self.growth_state != model.GrowthState.SPROUT:
                    if self.damaged_sprout is not None:
                        self.growth_state = model.GrowthState.SPROUT
                        self.animation = action.Action(
                            self, self.damaged_sprout.data)
            elif self.created_delta() <= 30:
                if self.growth_state != model.GrowthState.SAPLING:
                    if self.damaged_sapling is not None:
                        self.growth_state = model.GrowthState.SAPLING
                        self.animation = action.Action(
                            self, self.damaged_sapling.data)
            elif self.created_delta() <= 40:
                if self.growth_state != model.GrowthState.MATURE:
                    if self.damaged_mature is not None:
                        self.growth_state = model.GrowthState.MATURE
                        self.animation = action.Action(
                            self, self.damaged_mature.data)
            elif self.created_delta() > 40:
                if self.growth_state != model.GrowthState.RIPE:
                    if self.damaged_ripe is not None:
                        self.growth_state = model.GrowthState.RIPE
                        self.animation = action.Action(self,
                                                       self.damaged_ripe.data)

        self.animation.on_render(self)
        pass
Ejemplo n.º 9
0
 def set_animation(self):
     if abs(self.speed().length()) == 0:
         if self.animation == None or self.animation.action != "stand":
             self.animation = action.Action(self, stand.data)
     pass
Ejemplo n.º 10
0
Archivo: view.py Proyecto: rschum/game
 def __init__(self):
     view.View.__init__(self)
     self.animation = action.Action(self, healthy_seed.data)
     pass