Esempio n. 1
0
	def __init__(self,Name,Id,Pos,Dialog,AnimeXML,Icon=None,Wander=True,Shop=None,State="Idle",Direction=0):
		self.name=Name
		self.ID = Id
		self.icon=Icon
		self.dialog=Dialog
		self.wander=Wander
		self.wanderCount=0.0

		self.talking=False
		if Shop != None:
			self.shop = []
			for item in Shop:
				self.shop.append(ItemFactory.createItem(item))
		else:
			self.shop=Shop


		mask = pygame.mask.Mask((17,25))
		for x in range(6,11):
			for y in range(19,25):
				mask.set_at((x,y),1)

		animations = {"Idle":[loadAnimation(AnimeXML,"IdleN"),loadAnimation(AnimeXML,"IdleE"),loadAnimation(AnimeXML,"IdleS"),loadAnimation(AnimeXML,"IdleW")],"Run":[loadAnimation(AnimeXML,"RunN"),loadAnimation(AnimeXML,"RunE"),loadAnimation(AnimeXML,"RunS"),loadAnimation(AnimeXML,"RunW")]}
		self.graphicObject = GraphicObject(animations,[0.1,0.25],State,Direction)
		self.gameObject = GameObject([Pos[0],Pos[1]],{"Idle":mask},30,self.graphicObject,Id)
Esempio n. 2
0
	def __init__(self,name,clothingType,clothingColor,hairType,hairColor,preview=False):
		self.name = name
		self.job = Warrior(1)
		self.state = 0
		self.direction = 0

		items = [["EmptyPotion",3],["HealthPotion",5],["StrangePotion",20],["LeatherTunic","Purple"],["IronChestplate"],["WoodenShortSword"],["Test1"],["Test2"],["Test3"],["Test4"],["Test5"],["Test6"],["GreenSlimeball",5],["WoodenShortBow"]]
		inven = []
		for item in items:
			inven.append(ItemFactory.createItem(*item))
		self.inventory=Inventory(inven)

		#self.inventory=Inventory([ItemFactory.createItem("EmptyPotion",3),ItemFactory.createItem("HealthPotion",5),ItemFactory.createItem("StrangePotion",20),ItemFactory.createItem("LeatherTunic","Purple"),ItemFactory.createItem("IronChestplate"),ItemFactory.createItem("WoodenShortSword")])
		self.party=[]
		self.quests={}
		self.skills={"S1":None,"S1U":None,"S1R":None,"S1D":None,"S1L":None}

		self.talking = False
		self.shopping = False
		self.canMove = True

		#For saving:
		self.clothingType=clothingType
		self.clothingColor=clothingColor
		self.hairType=hairType
		self.hairColor=hairColor

		self.icon=None

		mask = pygame.mask.Mask((17,25))
		for x in range(6,11):
			for y in range(19,25):
				mask.set_at((x,y),1)

		animations = self.constructAnimations(clothingType,clothingColor,hairType,hairColor,preview)
		self.graphicObject = GraphicObject(animations,parent=self)
		self.gameObject = GameObject([0,0],{"Idle":mask},60,self.graphicObject,"Player",parent=self)

		animations = self.constructBattleAnimations(preview)
		hitbox = [pygame.rect.Rect([16,7,28,61]),pygame.rect.Rect([7,8,28,60])]
		self.battleGraphicObject = BattleGraphicObject(animations,[10,145],20,weapon=self.getInventory().getArm1())
		self.battleObject = BattleObject(self.battleGraphicObject,hitbox,10,self.name,self.getInventory().getArm1(),level=1,exp=15,**self.job.getStartStats())
Esempio n. 3
0
	def __init__(self,Name,Id,Pos,Dialog,ClothingType,ClothingColor,HairType,HairColor,Icon=None,Wander=True,Shop=None,State="Idle",Direction=0):
		self.name=Name
		self.ID = Id
		self.icon=Icon
		self.dialog=Dialog
		self.wander=Wander
		self.wanderCount=0.0

		self.talking=False
		if Shop != None:
			self.shop = []
			for item in Shop:
				self.shop.append(ItemFactory.createItem(item))
		else:
			self.shop=Shop

		if ClothingType==None:
			ClothingType=random.randint(1,player.ClothingTypes)
		if ClothingColor==None:
			ClothingColor=random.choice(player.Colors)
		else:
			ClothingColor=player.Colors[ClothingColor]
		if HairType==None:
			HairType=random.randint(1,player.HairTypes)
		if HairColor==None:
			HairColor=random.choice(player.Colors)
		else:
			HairColor=player.Colors[HairColor]

		mask = pygame.mask.Mask((17,25))
		for x in range(6,11):
			for y in range(19,25):
				mask.set_at((x,y),1)

		self.graphicObject = GraphicObject(self.constructAnimations({"Idle":[Animation(None,None,"IdleN"),Animation(None,None,"IdleE"),Animation(None,None,"IdleS"),Animation(None,None,"IdleW")],"Run":[Animation(None,None,"RunN"),Animation(None,None,"RunE"),Animation(None,None,"RunS"),Animation(None,None,"RunW")]},ClothingType,ClothingColor,HairType,HairColor),[0.1,0.25],State,Direction)
		self.gameObject = GameObject([Pos[0],Pos[1]],{"Idle":mask},30,self.graphicObject,Id)
Esempio n. 4
0
			if PlayerB.getState()=="Idle":
				PlayerB.setState("Run")
		if move[3]:
			if PlayerB.getDirection()!=0:
				PlayerB.setDirection(0)
			if PlayerB.getState()=="Idle":
				PlayerB.setState("Run")
		if (not move[1] and not move[3]) or (move[1] and move[3]):
			if PlayerB.getState()=="Run":
				PlayerB.setState("Idle")

		if battleEngine.update(tick):
			BATTLING = False
			loot = []
			for item in battleEngine.getLoot():
				loot.append(ItemFactory.createItem(item))
			battleEngine.getGraphicsEngine().victoryScreen(clock,inputEngine,battleEngine.getPlayerParty(),battleEngine.getGold(),battleEngine.getExp(),loot)
			oldScreen = screen.copy()
			graphicsEngine.update(0)
			newScreen = screen.copy()
			transitions.blurTrans(clock,screen,oldScreen,newScreen)
			Player.getInventory().addGold(battleEngine.getGold())
			for item in loot:
				Player.getInventory().addItem(item)
			for ally in battleEngine.getPlayerParty():
				ally.addExp(battleEngine.getExp())
	else:	#Overworld
		for inp in inputEngine.getInput():
			if inp[0] == "Quit":
				PLAYING = False
			elif inp[1] == "Down":