本文整理汇总了Python中inventory.Inventory.pos方法的典型用法代码示例。如果您正苦于以下问题:Python Inventory.pos方法的具体用法?Python Inventory.pos怎么用?Python Inventory.pos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类inventory.Inventory
的用法示例。
在下文中一共展示了Inventory.pos方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Level
# 需要导入模块: from inventory import Inventory [as 别名]
# 或者: from inventory.Inventory import pos [as 别名]
class Level(LevelBase):
prevlevel = 0
dialog = 0
pdialog = 0
timer = 0
oldPos = (0, 0)
dialog = 0
btimer = 0
def __init__(self, g, player_new, dimentions, p=0):
LevelBase.__init__(self, g, player_new, dimentions)
self.prevlevel = p
self.title = "Jail"
# current level
TW, TH = 32, 32
# load tile set
g.tga_load_tiles(os.path.join("textures", "tiles5.png"), (TW, TH), self.tdata)
g.tga_load_level(os.path.join("levels", "level17.tga"), 1)
g.bounds = pygame.Rect(TW, TH, (len(g.tlayer[0]) - 2) * TW, (len(g.tlayer) - 2) * TH)
g.code_events(self.edata)
self.vats = Inventory(g, "clonevat")
self.vats.pos((18, 13))
g.run_codes(self.cdata, (0, 0, g.dimentions[0], g.dimentions[1]))
# ugly, ugly monsters
def add_monster(self, g, r, a):
# e = Enemy(self.g, (r.rect.x, r.rect.y), 'monster1')
e = Monster1(self.g, (r.rect.x, r.rect.y))
# upon moving
def playerMove(self, g, r, a):
if self.prevlevel == 18:
g.player.rect.x, g.player.rect.y = r.rect.x, r.rect.y
g.view.x = r.rect.x
g.view.y = r.rect.y
# when you're over a change level tile
def change_level(self, g, r, a):
if a.__class__.__name__ != "Player":
return
if g.player.pos[0] == 38:
g.currentLevel = 18
if g.player.pos[0] == 1:
g.currentLevel = 16
# level events
def level_loop(self):
g = self.g
示例2: Level
# 需要导入模块: from inventory import Inventory [as 别名]
# 或者: from inventory.Inventory import pos [as 别名]
class Level(LevelBase):
prevlevel = 0
dialog = 0
pdialog = 0
timer = 0
oldPos = (0, 0)
dialog = 0
btimer = 0
lockedatmessage = 0
inbattle = 0
def __init__(self, g, player_new, dimentions, p = 0):
LevelBase.__init__(self, g, player_new, dimentions)
self.prevlevel = p
self.title = 'Airport'
# current level
TW,TH = 32,32
# load tile set
g.tga_load_tiles(os.path.join("textures", "tiles6.png"), (TW,TH), self.tdata)
g.tga_load_level(os.path.join("levels", "level28.tga"), 1)
g.bounds = pygame.Rect(TW,TH,(len(g.tlayer[0])-2)*TW,(len(g.tlayer)-2)*TH)
g.code_events(self.edata)
self.vats = Inventory(g, 'plane')
self.vats.pos((18, 9))
g.run_codes(self.cdata,(0,0,g.dimentions[0],g.dimentions[1]))
self.g.player.hidden = 0
self.pan_camera(None)
self.initBack('bg3.png', 190, 512)
self.effect = GameEffect(g,'wind')
pygame.mixer.music.load(os.path.join("ambient", "amb15.ogg"))
pygame.mixer.music.play(40000)
self.fox = Character("fox.png","facefox.tga", g, 'fox')
self.fox.pos((31, 15))
self.fox.direction = 0
self.fox.health = 40
self.fox.healthmax = 40
self.director = Character("director.png","facedirector.png", g, 'director')
self.director.pos((36, 16))
self.director.direction = 1
if 'scene16' in g.saveData:
self.fox.hidden = 1
if 'scene17' in g.saveData:
self.fox.feeling = 'dead'
self.director.hidden = 1
# plane is gone if you got imas backup tape
if 'i_tape' in g.saveData:
self.vats.removeself()
self.invbox = 0
# ugly, ugly monsters
def add_monster (self,g,r,a):
Monster5(self.g, (r.rect.x, r.rect.y))
# upon moving
def playerMove(self, g,r,a):
print 'player move'
if self.prevlevel == 29:
g.player.rect.x,g.player.rect.y = r.rect.x,r.rect.y - 2
g.view.x = r.rect.x
g.view.y = r.rect.y
# draw back of level
def draw_back(self):
test = self.draw_gradent((105,70,70), (0, 30, 255))
self.g.screen.blit(test, (0,0))
# when you're over a change level tile
def change_level(self, g,r,a):
if a.__class__.__name__ != 'Player':
return
if g.player.pos[0] == 64:
g.currentLevel = 29
if g.player.pos[0] == 1:
g.currentLevel = 27
print g.player.pos
# level events
def level_loop(self):
g = self.g
if self.g.player.pos[0] > 24:
if not 'scene16' in g.saveData:
g.intermission = 1
self.pan_camera(self.fox)
if self.dialog == 0:
self.dialog = 1
if self.dialog != 0:
if g.keyup:
self.dialog += 1
self.contains_msg_box_counter = 0
if self.dialog == 2:
#.........这里部分代码省略.........
示例3: add_switch
# 需要导入模块: from inventory import Inventory [as 别名]
# 或者: from inventory.Inventory import pos [as 别名]
def add_switch(self,g,r,a):
switch = Inventory(self.g, 'switch')
pos = g.screen_to_tile((r.rect.x + g.view.x, r.rect.y + g.view.y))
switch.pos(pos)
self.switches.append(switch)
示例4: add_spike
# 需要导入模块: from inventory import Inventory [as 别名]
# 或者: from inventory.Inventory import pos [as 别名]
def add_spike(self,g,r,a):
spike = Inventory(self.g, 'spike')
pos = g.screen_to_tile((r.rect.x + g.view.x, r.rect.y + g.view.y))
spike.pos(pos)
示例5: add_save_inventory
# 需要导入模块: from inventory import Inventory [as 别名]
# 或者: from inventory.Inventory import pos [as 别名]
def add_save_inventory (self,g,r,a):
save = Inventory(self.g, 'save')
pos = g.screen_to_tile((r.rect.x + g.view.x, r.rect.y + g.view.y))
save.pos(pos)
示例6: add_shot3
# 需要导入模块: from inventory import Inventory [as 别名]
# 或者: from inventory.Inventory import pos [as 别名]
def add_shot3(self, g,r,a):
shot4 = Inventory(self.g, 'shot4')
pos = g.screen_to_tile((r.rect.x + g.view.x, r.rect.y + g.view.y))
shot4.pos(pos)
示例7: add_water
# 需要导入模块: from inventory import Inventory [as 别名]
# 或者: from inventory.Inventory import pos [as 别名]
def add_water(self, g,r,a):
sprinkler = Inventory(self.g, 'sprinkler')
pos = g.screen_to_tile((r.rect.x + g.view.x, r.rect.y + g.view.y))
sprinkler.pos(pos)
self.sprinklers.append(sprinkler)
示例8: Level
# 需要导入模块: from inventory import Inventory [as 别名]
# 或者: from inventory.Inventory import pos [as 别名]
class Level(LevelBase):
prevlevel = 0
dialog = 0
pdialog = 0
timer = 10
ticker = 0
def __init__(self, g, player_new, dimentions, p = 0):
LevelBase.__init__(self, g, player_new,dimentions)
self.prevlevel = p
self.title = 'Engineers Lab'
# current level
currentLevel = os.path.join("levels", "level2.tga")
TW,TH = 32,32
# load tile set
tileTexture = os.path.join("textures", "tiles0.png")
g.tga_load_tiles(tileTexture, (TW,TH), self.tdata)
g.tga_load_level(currentLevel, 1)
g.bounds = pygame.Rect(TW,TH,(len(g.tlayer[0])-2)*TW,(len(g.tlayer)-2)*TH)
g.code_events(self.edata)
self.microwave = Inventory(g, 'microwave')
self.microwave.pos((6, 9))
self.professor = Character("professor.png","faceprofessor.tga", g)
self.professor.pos((6, 9))
self.professor.direction = 0
self.assistant = Character("assistant.png","faceassistant.png", g)
self.assistant.pos((12, 9))
self.assistant.direction = 1
g.intermission = 1
# already done the cut scene
if 'scene1' in g.saveData:
g.intermission = 0
self.professor.pos((11, 9))
self.dialog = 9
self.g.sprites.remove(self.assistant)
# if you've put the transmitter in
if 'scene3' in g.saveData:
self.assistant = Character("assistant.png","faceassistant.png", g)
self.assistant.pos((13, 9))
self.professor.pos((8, 9))
self.assistant.direction = 1
self.dialog = 10
g.intermission = 1
# already had the talk after putting in the transmitter
if 'scene4' in g.saveData:
self.dialog = 19
g.intermission = 0
self.g.sprites.remove(self.assistant)
if 'scene5' in g.saveData:
self.dialog = 20
self.professor.pos((11,9))
self.professor.faceup = 1
g.run_codes(self.cdata,(0,0,g.dimentions[0],g.dimentions[1]))
# upon moving
def playerMove(self, g,r,a):
if self.prevlevel == 3:
g.player.rect.x = r.rect.x
g.player.rect.y = r.rect.y
if self.prevlevel == 5:
# why do you eat so much chicken?
pop = g.tile_to_screen((6,9))
g.player.rect.x = pop[0]
g.player.rect.y = pop[1]
# when you're over a change level tile
def change_level(self, g,r,a):
if not g.event or a.__class__.__name__ != 'Player':
return
#back to castle st
if g.player.pos == (1, 9):
self.g.currentLevel = 1
if g.player.pos == (13, 9):
self.g.currentLevel = 3
# The door is open
if 'scene4' in g.saveData:
if g.player.pos == (7, 9):
g.currentLevel = 5
# draw back of level
def draw_back(self):
test = self.draw_gradent((18,20,34), (0, 0, 0))
self.g.screen.blit(test, (0,0))
# blinking machines
#.........这里部分代码省略.........
示例9: Level
# 需要导入模块: from inventory import Inventory [as 别名]
# 或者: from inventory.Inventory import pos [as 别名]
class Level(LevelBase):
prevlevel = 0
dialog = 0
pdialog = 0
timer = 0
oldPos = (0, 0)
dialog = 0
btimer = 0
fillingwithwater = 0
def __init__(self, g, player_new, dimentions, p = 0):
LevelBase.__init__(self, g, player_new, dimentions)
self.prevlevel = p
self.title = 'Jail'
# current level
TW,TH = 32,32
# load tile set
tileTexture = os.path.join("textures", "tiles5.png")
g.tga_load_tiles(tileTexture, (TW,TH), self.tdata)
currentLevel = os.path.join("levels", "level14.tga")
g.tga_load_level(currentLevel, 1)
g.bounds = pygame.Rect(TW,TH,(len(g.tlayer[0])-2)*TW,(len(g.tlayer)-2)*TH)
g.code_events(self.edata)
self.robot = Character("robot0.png","facerobot.tga", g,'robot')
self.robot.pos((13, 20))
self.robot.direction = 0
#(2, 3) 'i_arms' in g.saveData
self.arms = Inventory(g, 'arms')
self.arms.pos((2,3))
# if you've given her arms
if 'scene7' in g.saveData:
self.dialog = 6
self.robot.feeling = 'arms'
# if you read the newspaper, she fights you to get to the top
self.newspaper = 0
if 'scene17' in g.saveData:
self.newspaper = Inventory(g, "newspaper")
self.newspaper.pos((6, 20))
if 'scene19' in g.saveData:
self.robot.feeling = 'dead'
self.robot.hidden = 1
g.run_codes(self.cdata,(0,0,g.dimentions[0],g.dimentions[1]))
# upon moving
def playerMove(self, g,r,a):
if self.prevlevel == 15:
g.player.rect.x,g.player.rect.y = r.rect.x,r.rect.y
g.view.x = r.rect.x
g.view.y = r.rect.y
# when you're over a change level tile
def change_level(self, g,r,a):
if a.__class__.__name__ != 'Player':
return
if g.player.pos[0] == 38:
g.currentLevel = 15
# level events
def level_loop(self):
g = self.g
if 'scene7' in g.saveData:
self.g.clayer[4][18] = 0
self.g.tlayer[4][18] = 1
else:
self.g.clayer[4][18] = 1
self.g.tlayer[4][18] = 25
# player position
if g.player.pos == (13, 20) and not 'scene18' in g.saveData:
if g.event:
self.pdialog = 1
if 'i_arms' in g.saveData:
self.pdialog = 2
if self.pdialog == 0:
if not 'scene7' in g.saveData:
self.robot.feeling = 'blink'
if self.pdialog == 1:
self.dialog = 0
self.robot.feeling = ''
str = "Hello! Welcome to the Octagon Correctional Facility."
str += "\nYou must be a visitor, as you weren't tagged when you arrived."
str += "\nI'd love to help you, but I've misplaced my arms."
self.info_box(str, self.robot)
elif self.pdialog == 2:
if g.keyup and self.timer > 30:
self.dialog += 1
self.timer = 0
self.contains_msg_box_counter = 0
if 'scene7' in g.saveData and self.dialog == 1:
self.dialog = 6 # if you already got the item
if self.dialog == 1:
#.........这里部分代码省略.........
示例10: Level
# 需要导入模块: from inventory import Inventory [as 别名]
# 或者: from inventory.Inventory import pos [as 别名]
class Level(LevelBase):
prevlevel = 0
dialog = 0
pdialog = 0
timer = 0
oldPos = (0, 0)
dialog = 0
btimer = 0
def __init__(self, g, player_new, dimentions, p = 0):
LevelBase.__init__(self, g, player_new, dimentions)
self.prevlevel = p
self.title = 'Jail'
# current level
TW,TH = 32,32
# load tile set
g.tga_load_tiles(os.path.join("textures", "tiles5.png"), (TW,TH), self.tdata)
g.tga_load_level(os.path.join("levels", "level19.tga"), 1)
g.bounds = pygame.Rect(TW,TH,(len(g.tlayer[0])-2)*TW,(len(g.tlayer)-2)*TH)
g.code_events(self.edata)
# and an odd object called flutter box. flutter shutter (37, 13)
self.terrorist = Character("terrorist.png","faceterrorist.tga", g)
self.terrorist.pos((3, 20))
self.terrorist.direction = 0
self.terrorist.faceup = 1
self.flutterbox = Inventory(g, 'flutterbox')
self.flutterbox.pos((37, 13))
self.flutterswitch = Inventory(g, 'flutterswitch')
self.flutterswitch.pos((37, 20))
g.run_codes(self.cdata,(0,0,g.dimentions[0],g.dimentions[1]))
# ugly, ugly monsters
def add_monster (self,g,r,a):
print 'add_monster ',r.rect
e = Monster1(self.g, (r.rect.x, r.rect.y))
# upon moving
def playerMove(self, g,r,a):
if self.prevlevel == 20:
g.player.rect.x,g.player.rect.y = r.rect.x,r.rect.y
g.view.x = r.rect.x
g.view.y = r.rect.y
# when you're over a change level tile
def change_level(self, g,r,a):
if a.__class__.__name__ != 'Player':
return
if g.player.pos[1] == 1:
g.currentLevel = 18
if g.player.pos == (39, 27) or g.player.pos == (39, 28):
g.currentLevel = 20
# level events
def level_loop(self):
g = self.g
# 16, 13
if self.switches[0].open:
self.g.clayer[13][16] = 0
self.g.tlayer[13][16] = 2
else:
self.g.clayer[13][16] = 1
self.g.tlayer[13][16] = 25
#(26, 13)
if self.switches[1].open:
self.g.clayer[13][26] = 0
self.g.tlayer[13][26] = 2
else:
self.g.clayer[13][26] = 1
self.g.tlayer[13][26] = 25
# opened up the flutter box (13, 20)
if 'scene10' in g.saveData:
self.g.clayer[20][11] = 0
self.g.tlayer[20][11] = 2
else:
self.g.clayer[20][11] = 1
self.g.tlayer[20][11] = 25
# door to leave (38, 27)
if 'scene11' in g.saveData:
self.g.clayer[27][38] = 0
self.g.tlayer[27][38] = 2
else:
self.g.clayer[27][38] = 1
self.g.tlayer[27][38] = 25
if g.player.pos == (37, 20):
if 'i_flutterbox' in g.saveData:
if g.event:
self.pdialog = 1
#.........这里部分代码省略.........
示例11: Level
# 需要导入模块: from inventory import Inventory [as 别名]
# 或者: from inventory.Inventory import pos [as 别名]
class Level(LevelBase):
prevlevel = 0
dialog = 0
pdialog = 0
timer = 0
oldPos = (0, 0)
dialog = 0
btimer = 0
lockedatmessage = 0
inbattle = 0
def __init__(self, g, player_new, dimentions, p = 0):
LevelBase.__init__(self, g, player_new, dimentions)
self.prevlevel = p
self.title = 'Office Complex Top'
# current level
TW,TH = 32,32
# load tile set
g.tga_load_tiles(os.path.join("textures", "tiles6.png"), (TW,TH), self.tdata)
g.tga_load_level(os.path.join("levels", "level31.tga"), 1)
g.bounds = pygame.Rect(TW,TH,(len(g.tlayer[0])-2)*TW,(len(g.tlayer)-2)*TH)
g.code_events(self.edata)
self.initBack('bg1.png', 730)
self.backuptape = Inventory(g, 'tape', (37, 22))
self.backuptape.pos((37, 22))
self.backup = Character('backup.png', 'facebackup.png', g, 'backup')
self.backup.pos((28, 25))
self.backup.direction = 0
if 'scene21' in g.saveData:
self.backup.hidden = 1
# coming back and saying high to the guy.
if 'scene20' in g.saveData and not 'scene21' in g.saveData:
del g.saveData['scene20']
g.run_codes(self.cdata,(0,0,g.dimentions[0],g.dimentions[1]))
self.coins = 0
# upon moving
def playerMove(self, g,r,a):
print 'player move'
# draw back of level
def draw_back(self):
test = self.draw_gradent((105,70,70), (0, 30, 255))
self.g.screen.blit(test, (0,0))
# when you're over a change level tile
def change_level(self, g,r,a):
if a.__class__.__name__ != 'Player':
return
print g.player.pos
if g.player.pos[0] == 1:
g.currentLevel = 30
# level events
def level_loop(self):
g = self.g
# Some hints as to the past
if g.player.pos == (28, 25) and not 'scene20' in g.saveData:
if self.pdialog != 0:
if g.keyup:
self.contains_msg_box_counter = 0
self.pdialog += 1
if g.event and self.pdialog == 0:
self.backup.face_the_player()
g.intermission = 1
self.pdialog = 1
self.backup.walkto((29, 25))
self.backup.direction = 1
g.player.direction = 0
if self.pdialog == 2:
str = "Hello"
self.info_box(str, self.backup)
elif self.pdialog == 3:
str = "You don't know me..."
str += "\nbut I know you, ha. Haha!"
self.info_box(str, self.backup)
elif self.pdialog == 4:
str = "Who knows if I'm myself, when I am who what's on a tape? "
str += "\nSeveral times I've been built because of a timer."
str += "\nWhat happened in between these gaps is anyone's guess."
self.info_box(str, self.backup)
elif self.pdialog == 5:
str = "You came to tell me what you're doing."
str += "\nBut I already know!"
self.info_box(str, self.backup)
elif self.pdialog == 6:
str = "See, you can't have her tape."
str += "\nI need it. For the future, you see."
self.info_box(str, self.backup)
elif self.pdialog == 7:
str = "The insult 'tool' never really fits to most situations."
str += "\nBut now it's apt!"
#.........这里部分代码省略.........
示例12: Level
# 需要导入模块: from inventory import Inventory [as 别名]
# 或者: from inventory.Inventory import pos [as 别名]
class Level(LevelBase):
prevlevel = 0
dialog = 0
pdialog = 0
timer = 0
oldPos = (0, 0)
dialog = 0
btimer = 0
def __init__(self, g, player_new, dimentions, p = 0):
LevelBase.__init__(self, g, player_new, dimentions)
self.prevlevel = p
self.title = 'Elevator'
# current level
TW,TH = 32,32
# load tile set
g.tga_load_tiles(os.path.join("textures", "tiles5.png"), (TW,TH), self.tdata)
g.tga_load_level(os.path.join("levels", "level21.tga"), 1)
g.bounds = pygame.Rect(TW,TH,(len(g.tlayer[0])-2)*TW,(len(g.tlayer)-2)*TH)
g.code_events(self.edata)
#see two dead fish. Symbolisim
self.vats = Inventory(g, 'fish0')
self.vats.pos((19, 19))
self.vats = Inventory(g, 'fish1')
self.vats.pos((28, 19))
g.run_codes(self.cdata,(0,0,g.dimentions[0],g.dimentions[1]))
self.initBack('bg2.png', 680)
self.g.player.hidden = 0
# ugly, ugly monsters
def add_monster (self,g,r,a):
#e = Enemy(self.g, (r.rect.x, r.rect.y), 'monster0')
Monster0(self.g, (r.rect.x, r.rect.y))
# upon moving
def playerMove(self, g,r,a):
if self.prevlevel == 22:
g.player.rect.x,g.player.rect.y = r.rect.x,r.rect.y
g.view.x = r.rect.x
g.view.y = r.rect.y
# draw back of level 242422
def draw_back(self):
test = self.draw_gradent((0,0,0), (24, 24, 22))
self.g.screen.blit(test, (0,0))
# when you're over a change level tile
def change_level(self, g,r,a):
if a.__class__.__name__ != 'Player':
return
print g.player.pos
if g.player.pos[0] == 38:
g.currentLevel = 22
# level events
def level_loop(self):
g = self.g
if g.player.pos == (6, 27):
if g.event:
g.currentLevel = 20
#message at (33, 27)
if g.player.pos == (33, 27):
if g.event:
self.pdialog = 2
if self.pdialog == 2:
str = "Casting two fish,"
str = "\nA man you shall meet you bearing a pitcher of water."
self.info_box(str)
self.timer += 1
if self.oldPos != g.player.pos:
self.pdialog = 0
self.oldPos = g.player.pos