Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGonzalo Odiard <gonzalo@nautilus.localdomain>2009-11-11 04:13:36 (GMT)
committer Gonzalo Odiard <gonzalo@nautilus.localdomain>2009-11-11 04:13:36 (GMT)
commit33012399c1d2f6cb8aecbf97b554d6b309f79cb6 (patch)
tree09f91cfe4f876b38b50a7207093ec063b01b05d8
parent5f9199990fba1b343fda67e18e5aca33e7352982 (diff)
agrego indicacion de nacimiento
-rw-r--r--Animals.py10
-rw-r--r--images/heart.pngbin0 -> 311 bytes
2 files changed, 8 insertions, 2 deletions
diff --git a/Animals.py b/Animals.py
index cb7cbe2..0c2eca8 100644
--- a/Animals.py
+++ b/Animals.py
@@ -7,12 +7,14 @@ import World
print "Init aimals"
-EVENT_DEATH = 10
+EVENT_DEATH = -1
+EVENT_LOVE = -2
class WorldEvent:
path = os.path.join(os.path.dirname(os.path.abspath(__file__)),"images")
imageSkull = cairo.ImageSurface.create_from_png (os.path.join(path,"skull.png"))
+ imageHeart = cairo.ImageSurface.create_from_png (os.path.join(path,"heart.png"))
def __init__ (self,x,y,event):
self.x = x
@@ -28,7 +30,9 @@ class WorldEvent:
ctx.set_source_rgb(146.0/256.0,98.0/256.0,46.0/256.0)
if (self.event == EVENT_DEATH):
ctx.set_source_surface(WorldEvent.imageSkull,1,1)
- ctx.fill()
+ if (self.event == EVENT_LOVE):
+ ctx.set_source_surface(WorldEvent.imageHeart,1,1)
+ ctx.fill()
def getRandomDirection():
@@ -233,6 +237,7 @@ class Rabbit(AbstractAnimal):
((nearAnimal.edad - nearAnimal.ultimaActSexual) > self.frecuenciaSexual)):
# born rabbits
self.ultimaActSexual = self.edad
+ world.events.append(WorldEvent(self.posX,self.posY,EVENT_LOVE))
cantCrias = int(random.random()*self.maxNumeroCrias)
for n in range(cantCrias):
child = Rabbit(self.posX,self.posY,self._world)
@@ -357,6 +362,7 @@ class Fox(AbstractAnimal):
((nearAnimal.edad - nearAnimal.ultimaActSexual) > self.frecuenciaSexual) ):
#print "IUPI!!!!"
# born foxs
+ world.events.append(WorldEvent(self.posX,self.posY,EVENT_LOVE))
self.ultimaActSexual = self.edad
cantCrias = int(random.random()*self.maxNumeroCrias)
for n in range(cantCrias):
diff --git a/images/heart.png b/images/heart.png
new file mode 100644
index 0000000..70b004f
--- /dev/null
+++ b/images/heart.png
Binary files differ