Most graphics related updates
[butaba-adventures.git] / npcs.py
1 # class for Non-Player characters in the game
2
3 import os.path
4
5 # NPC base class
6
7 class NPC:
8 # initalize the NPC
9 def __init__ (self, charname, row, col, imageleft, imageright, imagefront,
10 imageback, portrait, position, movement_area=(0,0,0,0), movement_speed = 10,
11 dialogues=[], currentdialog=0, is_dead=False):
12 # name of the character
13 self.charname = charname
14 # row and column to appear (in level)
15 self.row = row
16 self.col = col
17 # initial row and col - to track the movement area
18 self.initrow = row
19 self.initcol = col
20 # images to represent on level
21 self.imageleft = imageleft
22 self.imageright = imageright
23 self.imagefront = imagefront
24 self.imageback = imageback
25
26 # portrait on dialogues
27 self.portrait = portrait
28
29 # movement area limits (left, right top, and bottom) in which the NPC can
30 # move around in the level randomly.
31 self.leftlimit, self.rightlimit, self.toplimit, self.bottomlimit = movement_area
32
33 # chance of movement (speed) - that is chance of movement in a turn out of 500 -lower
34 # the value lower the speed
35 self.movement_speed = movement_speed
36
37 # position of the character
38 self.position = position
39
40 # dialogue set for NPC
41 # each dialogue in the set is a path to an XML file containing the dialogue
42 self.dialogues = dialogues
43 # index of the current dialogue which will be initiated with the main
44 # character
45 self.currentdialog = currentdialog
46 # whether the character is dead or alive. If dead no interaction of any
47 # kind can take place.
48 self.is_dead = is_dead
49
50 # Bulisa is Butaba's friend
51 class Bulisa (NPC):
52 def __init__ (self, row, col, imageleft, imageright, imagefront,
53 imageback, portrait, position, movement_area=(0,0,0,0),
54 dialogues=[], currentdialog=0):
55 NPC.__init__ (self, "Bulisa", row, col, imageleft, imageright, imagefront,
56 imageback, portrait, position, movement_area, 20, dialogues, currentdialog)
57