comparison gamelib/scenes/mess.py @ 221:bcb7b2093118

Tweak cans
author Neil Muller <neil@dip.sun.ac.za>
date Thu, 26 Aug 2010 21:35:01 +0200
parents 326300c218a6
children 10d3265f0bfa
comparison
equal deleted inserted replaced
220:15a86dba9df0 221:bcb7b2093118
22 self.add_thing(CansOnShelf()) 22 self.add_thing(CansOnShelf())
23 self.add_thing(Tubes()) 23 self.add_thing(Tubes())
24 self.add_thing(ToMap()) 24 self.add_thing(ToMap())
25 25
26 26
27 class EmptyCan(CloneableItem): 27 class BaseCan(CloneableItem):
28 "After emptying the full can." 28 """Base class for the cans"""
29
30 INVENTORY_IMAGE = "empty_can.png"
31 CURSOR = CursorSprite('empty_can_cursor.png', 20, 30)
32 29
33 def interact_with_full_can(self, item, state): 30 def interact_with_full_can(self, item, state):
34 return Result("You bang the cans togther. It sounds like two cans being banged togther.", soundfile="can_hit.ogg") 31 return Result("You bang the cans togther. It sounds like two cans being banged togther.", soundfile="can_hit.ogg")
35 32
36 def interact_with_dented_can(self, item, state): 33 def interact_with_dented_can(self, item, state):
37 return self.interact_with_full_can(item, state) 34 return self.interact_with_full_can(item, state)
38 35
39 def interact_with_empty_can(self, item, state): 36 def interact_with_empty_can(self, item, state):
40 return self.interact_with_full_can(item, state) 37 return self.interact_with_full_can(item, state)
41 38
39 def interact_with_machete(self, item, state):
40 return Result("You'd managle it beyond usefulness")
42 41
43 class FullCan(CloneableItem): 42
43 class EmptyCan(BaseCan):
44 "After emptying the full can."
45
46 INVENTORY_IMAGE = "empty_can.png"
47 CURSOR = CursorSprite('empty_can_cursor.png', 20, 30)
48
49
50 def interact_with_titanium_leg(self, item, state):
51 return Result("Flattening the can doesn't look like a useful thing to do")
52
53
54 class FullCan(BaseCan):
44 "Found on the shelf." 55 "Found on the shelf."
45 56
46 INVENTORY_IMAGE = "full_can.png" 57 INVENTORY_IMAGE = "full_can.png"
47 CURSOR = CursorSprite('full_can_cursor.png', 20, 30) 58 CURSOR = CursorSprite('full_can_cursor.png', 20, 30)
48 59
50 dented = DentedCan("dented_can") 61 dented = DentedCan("dented_can")
51 state.add_item(dented) 62 state.add_item(dented)
52 state.replace_inventory_item(self, dented) 63 state.replace_inventory_item(self, dented)
53 return Result("You club the can with the femur. The can gets dented, but doesn't open.", soundfile="can_hit.ogg") 64 return Result("You club the can with the femur. The can gets dented, but doesn't open.", soundfile="can_hit.ogg")
54 65
55 def interact_with_full_can(self, item, state):
56 return Result("You bang the cans togther. It sounds like two cans being banged togther.", soundfile="can_hit.ogg")
57 66
58 def interact_with_dented_can(self, item, state): 67 class DentedCan(BaseCan):
59 return self.interact_with_full_can(item, state)
60
61 def interact_with_empty_can(self, item, state):
62 return self.interact_with_full_can(item, state)
63
64
65 class DentedCan(CloneableItem):
66 "A can banged on with the femur" 68 "A can banged on with the femur"
67 69
68 INVENTORY_IMAGE = "dented_can.png" 70 INVENTORY_IMAGE = "dented_can.png"
69 CURSOR = CursorSprite('dented_can_cursor.png', 20, 30) 71 CURSOR = CursorSprite('dented_can_cursor.png', 20, 30)
70 72
71 def interact_with_titanium_leg(self, item, state): 73 def interact_with_titanium_leg(self, item, state):
72 return Result("You club the can with the femur. The dents shift around, but it still doesn't open.", soundfile="can_hit.ogg") 74 return Result("You club the can with the femur. The dents shift around, but it still doesn't open.", soundfile="can_hit.ogg")
73
74 def interact_with_full_can(self, item, state):
75 return Result("You bang the cans togther. It sounds like two cans being banged togther.", soundfile="can_hit.ogg")
76
77 def interact_with_dented_can(self, item, state):
78 return self.interact_with_full_can(item, state)
79
80 def interact_with_empty_can(self, item, state):
81 return self.interact_with_full_can(item, state)
82 75
83 76
84 class TubeFragments(Item): 77 class TubeFragments(Item):
85 "Old tubes that need repair." 78 "Old tubes that need repair."
86 79