The first steps towards enemy generators
[koperkapel.git] / koperkapel / gamelib / items.py
1 # Item utilities
2
3 from ..serums import default_serums
4 from ..weapons import default_weapons
5
6
7 def build_serum(item):
8     actor = default_serums.assemble(item["serum"])
9     return actor
10
11
12 def build_weapon(item):
13     actor = default_weapons.assemble(item["weapon"])
14     return actor
15
16
17 ITEM_TYPES = {
18     "serum": build_serum,
19     "weapon": build_weapon,
20 }
21
22
23 def get_item(item):
24     item_type = item.pop("type")
25     game_pos = item.pop("pos")
26     actor = ITEM_TYPES[item_type](item)
27     actor.game_pos = game_pos
28     actor.anchor = (0, 0)
29     return actor