class Equipments(Objects): def __init__(self): self.weapon = Weapon() self.jewel = Jewel() self.head = Head() self.chest = Chest() self.legs = Legs() self.shoes = Shoes() self.loot = [] #generate the random first stuff when the player is created def first_stuff(self, level): self.weapon = Weapon.generate_random_weapon(self, level) self.jewel = Jewel.generate_random_jewel(self, level) self.head = Head.generate_random_head(self, level) self.chest = Chest.generate_random_chest(self, level) self.legs = Legs.generate_random_legs(self, level) self.shoes = Shoes.generate_random_shoes(self, level) #Calculate all the new stats based on the stuff equiped (HP / MP /DAMAGE / ARMOR) def stuff_HP(self): return self.jewel.get_bonus_HP() + self.head.get_bonus_HP() + self.chest.get_bonus_HP() + self.legs.get_bonus_HP() + self.shoes.get_bonus_HP() def stuff_MP(self): return self.jewel.get_bonus_MP() def stuff_min_damage(self): return self.weapon.get_min_damage() def stuff_max_damage(self): return self.weapon.get_max_damage() def stuff_armor(self): return self.head.get_bonus_armor() + self.chest.get_bonus_armor() + self.legs.get_bonus_armor() + self.shoes.get_bonus_armor()
def build_head(): pymelLogger.debug('Starting: build_head()...') Neck.build() Head.build() pymelLogger.debug('End: build_head()...')
def main(): print('hello') musics = GetMusicList(r'F:\Music\cur_music_list.txt') music_list = Head.ReadMusicList(Head.MUSIC_LIST_STAGING) AddToMusicList(musics, music_list) Head.WriteMusicList(music_list, Head.MUSIC_LIST_STAGING) print('welcome')
def __init__(self): self.weapon = Weapon() self.jewel = Jewel() self.head = Head() self.chest = Chest() self.legs = Legs() self.shoes = Shoes() self.loot = []
def RunMenu(): #hàm chạy menu game pygame.mixer.music.load('sound/background.mp3') pygame.mixer.music.play(-1, 0, 0) global money_win run = True while run: screen.blit(BG_menu, (0, 0)) if play.draw_button(): pygame.mixer.music.load('sound/button.mp3') pygame.mixer.music.play(1) a = RunOption1() b = RunOption2() Eracing.Run(a, b) if store.draw_button(): pygame.mixer.music.load('sound/button.mp3') pygame.mixer.music.play(1) Store() if history.draw_button(): pygame.mixer.music.load('sound/button.mp3') pygame.mixer.music.play(1) Run_History() if setting.draw_button(): pygame.mixer.music.load('sound/button.mp3') pygame.mixer.music.play(1) Run_setting() if mini.draw_button(): pygame.mixer.music.load('sound/button.mp3') pygame.mixer.music.play(1) screen.blit(pygame.image.load('Menu/mini.jpg'), (0, 0)) score = minigame.run() if score >= 0 and score <= 10: RunMenu() else: money_win = score * 10 - 10 Head.update(money_win) RunMenu() MoneySuface = font.render(str(int(Head.money)), True, (0, 0, 0)) screen.blit(MoneySuface, (820, 20)) for event in pygame.event.get(): if event.type == pygame.QUIT: file_obj = open(username + '.txt', mode='w') file_obj.write(password + '\n') file_obj.write(str(int(Head.money))) file_obj.close() sys.exit() if exit.draw_button(): file_obj = open(username + '.txt', mode='w') file_obj.write(password + '\n') file_obj.write(str(int(Head.money))) file_obj.close() sys.exit() pygame.display.update()
def RATING(YourChoose, Your_betting): # Hàm xếp hạng kêt qua cuộc đua global score_bet RESULT(result[0], car1) RESULT(result[1], car2) RESULT(result[2], car3) RESULT(result[3], car4) RESULT(result[4], car5) if result[YourChoose - 1] == 1: screen.blit(pygame.image.load('Reward/win.png'), (300, 0)) Head.update(Your_betting) score_bet = 1 else: screen.blit(pygame.image.load('Reward/lose.png'), (300, 0)) Your_betting = -Your_betting Head.update(Your_betting) score_bet = 2
def ChooseMoney(): # Hàm chọn số tiền cá cược betting = 0 comment = font.render('CHOOSE AMOUNT OF YOUR BET', 1, (3, 252, 244)) back = Head.button(1, 1, 'BACK') while betting == 0: screen.blit(BG_choose, (0, 0)) screen.blit(comment, (290, 400)) if Money_option1.draw_button(): if Head.money >= 100: pygame.mixer.music.load('sound/button.mp3') pygame.mixer.music.play(1) betting = 100 elif Money_option2.draw_button(): if Head.money >= 200: pygame.mixer.music.load('sound/button.mp3') pygame.mixer.music.play(1) betting = 200 elif Money_option3.draw_button(): if Head.money >= 400: pygame.mixer.music.load('sound/button.mp3') pygame.mixer.music.play(1) betting = 400 for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() pygame.display.update() return betting
def main(argv): noofhair = '' radiusofhead = '' left_eye_radius = '' right_eye_radius = '' try: opts, args = getopt.getopt(argv, "hf:", ["head="]) except getopt.GetoptError: usage() sys.exit(2) for opt, arg in opts: if (opt == "-h"): usage() sys.exit() elif opt in ("-f", "--head"): noofhair = argv[1] radiusofhead = argv[2] left_eye_radius = argv[3] right_eye_radius = argv[4] left_eye = Eye.Eye(left_eye_radius) right_eye = Eye.Eye(right_eye_radius) left_eye_abnormal = Eye.Eye(0) right_eye_abnormal = Eye.Eye(0) mouth_height_width = Mouth.Mouth(0, 0) normalhead = Head.Head(noofhair, radiusofhead, left_eye, right_eye, mouth_height_width) print("Normal Head:" + "\n") print(normalhead.toString() + "\n") abnormalhead = Head.Head(noofhair, radiusofhead, left_eye_abnormal, right_eye_abnormal, mouth_height_width) print("Abnormal Head:" + "\n") print(abnormalhead.toString()) normalhead = Head.Head(noofhair, radiusofhead, left_eye_abnormal, right_eye_abnormal, mouth_height_width) # Mouth.Mouth.setHeight(1) print("\n") print("After Closing Eyes and Mouth for Normal Head" + "\n") print(normalhead.toString() + "\n") normalhead.headAche()
def ListDir(dir, output_file): fout = open(output_file, 'w') for cur_path, sub_dir, files in os.walk(dir): for file in files: file.encode(encoding='gbk') path_filename = os.path.join(cur_path, file) if Head.JudgeMusicFile(path_filename): fout.write(io_util.get_md5(path_filename)) fout.write('\t' + path_filename + '\t' + file + '\n') fout.close()
import Hand import Head import movement import RPi.GPIO as GPIO GPIO.cleanup() # reset GPIO LeftHand = Hand.Hand(3, 5, 7, 8, 10) RightHand = Hand.Hand(11, 13, 15, 12, 16) BigHead = Head.Head(19, 21, 23, 22, 24) movesystem = movement.movement(22, 24, 36, 35)
# AlienTest.py from Alien import * from Eye import * from Nose import * from Mouth import * from Head import * import sys, getopt if __name__ == '__main__': eyeLeft1 = Eye(2) eyeRight1 = Eye(2) nose = Nose(3, 3, 2) mouth = Mouth(5, 2) eyeLeft2 = Eye(2) eyeRight2 = Eye(3) normalHead = Head(100, 4, eyeLeft1, eyeRight1, nose, mouth) abnormalHead = Head(100, 4, eyeLeft2, eyeRight2, nose, mouth) print("Normal Head", normalHead.toString()) print("\n\nAbnormal Head", abnormalHead.toString()) normalHead.getLeft().close() normalHead.getRight().close() normalHead.getMouth().close() if normalHead.headAche(): print("\nHead Ache") else: print("\nNo Head Ache")
import pygame from pygame.locals import * import sys, random import Eracing, minigame, Head, user, dulieu from winsound import * Head.init() pygame.init() screen_width = 1000 screen_height = 600 screen = pygame.display.set_mode((screen_width, screen_height)) pygame.display.set_caption('MONSTER RACING') BG_menu = pygame.transform.scale(pygame.image.load('Menu/BG.jpg'), (screen_width, screen_height)) BG_option = pygame.transform.scale(pygame.image.load('Option/BG.jpg'), (screen_width, screen_height)) font = pygame.font.SysFont('Consolas', 30) #define global variable character = 0 length = 0 #bua img #define button game start = Head.button(430, 500, 'START') play = Head.button(100, 300, 'PLAY') store = Head.button(420, 300, 'STORE') setting = Head.button(720, 300, 'SETTING') exit = Head.button(720, 450, 'EXIT')
def import_head_rig(): pymelLogger.debug('Starting: connect_head_body()...') Head.attachToBody() pymelLogger.debug('End: connect_head_body()...')
def __init__(self): self.body = deque([]) self.head = Head.Head(self.starting_pos, (0, 0))
import os import Head import Input as i import Production as pro import Output as o info = Head.Info() #调用Input()函数,和用户交互,获取输入信息 i.Input(info) num = info.num_t for j in range(0, num): #如果有多个温度,先确定温度点和对应的ACE文件后缀名 temp = str(info.temperature[j]) acename = str(info.ACEname[j]) # message_total文件负责记录一次加工的所有信息,先清空 message_total_file = info.note_path + 'meassage_total_' + temp + 'K' message_total = open(message_total_file, 'w') # 清空xsdir之前的信息 xsdir_file = info.output_path + 'xsdir_' + temp + 'K' xsdir = open(xsdir_file, 'w') # 将输入文件中的所有核素名建一个列表 inputfiles = os.listdir(info.input_path) # 开始循环 for file in inputfiles: #加工对应核素的对应温度的ACE文件 pro.produce(info, file, acename, temp, message_total) nuclide = pro.nuclide
def Store(): # Hàm vẽ store lên màn hình anh = [ 'Spell/TangToc.png', 'Spell/LamCham.png', 'Spell/DungYen.png', 'Spell/LuiVeSau.png', 'Spell/VeNha.png', 'Spell/VeDich.png', 'Spell/TocBien.png' ] tangtoc = 0 lamcham = 0 dungyen = 0 luivesau = 0 venha = 0 vedich = 0 tocbien = 0 Run = True while Run: screen.blit(pygame.image.load('Store/BG.png'), (0, 0)) screen.blit(pygame.image.load('Store/purchase.png'), (400, 80)) if back.draw_button(): pygame.mixer.music.load('sound/button.mp3') pygame.mixer.music.play(1) Run = False if purchase.draw_button(): pygame.mixer.music.load('sound/button.mp3') pygame.mixer.music.play(1) k = random.choice(anh) if Head.money > 0: Head.update(-50) if k == 'Spell/TangToc.png': tangtoc += 1 if k == 'Spell/LamCham.png': lamcham += 1 if k == 'Spell/DungYen.png': dungyen += 1 if k == 'Spell/LuiVeSau.png': luivesau += 1 if k == 'Spell/VeNha.png': venha += 1 if k == 'Spell/VeDich.png': vedich += 1 if k == 'Spell/TocBien.png': tocbien += 1 MoneySuface = font.render(str(int(Head.money)), True, (0, 0, 0)) screen.blit(MoneySuface, (810, 20)) tangtoc_label = font.render(f"{tangtoc}", 1, (211, 49, 21)) screen.blit(tangtoc_label, (60, 530)) lamcham_label = font.render(f"{lamcham}", 1, (211, 49, 21)) screen.blit(lamcham_label, (200, 530)) dungyen_label = font.render(f"{dungyen}", 1, (211, 49, 21)) screen.blit(dungyen_label, (340, 530)) luivesau_label = font.render(f"{luivesau}", 1, (211, 49, 21)) screen.blit(luivesau_label, (490, 530)) venha_label = font.render(f"{venha}", 1, (211, 49, 21)) screen.blit(venha_label, (630, 530)) vedich_label = font.render(f"{vedich}", 1, (211, 49, 21)) screen.blit(vedich_label, (780, 530)) tocbien_label = font.render(f"{tocbien}", 1, (211, 49, 21)) screen.blit(tocbien_label, (920, 530)) for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() pygame.display.update()
happy = pygame.image.load('Spell/happy.png') # dùng để xác định thắng thua #hàm chỉnh đường đua canh = pygame.image.load('Spell/canh.png') # COLOR #tiền trong game WHITE = (255, 255, 255) RED = (255, 0, 0) GREEN = (0, 255, 0) BLACK = (0, 0, 0) GREY = (113, 142, 150) pygame.init() pygame.mixer.init() Head.init() FPS = 60 fpsClock = pygame.time.Clock() # BACKGROUND screen = pygame.display.set_mode((WINDOWWIDTH, WINDOWHEIGHT)) pygame.display.set_caption('Racing') font = pygame.font.SysFont('Consolas', 30) text_Surface = font.render('START RACING', True, RED, BLACK) Surface2 = pygame.Surface((500, 300)) #win11 = pygame.image.load('Set/1.1/win/1.png') #win12 = # HÀM
import pygame as pg import sys, os import Head pg.init() Head.init() # define screen = pg.display.set_mode((1000, 600)) FONT = pg.font.SysFont('Consolas', 40) # Hàm hiện giao diện nhập username cho người chơi def Input_Username(): screen = pg.display.set_mode((1000, 600)) clock = pg.time.Clock() username = '' done = False while not done: for event in pg.event.get(): if event.type == pg.QUIT: sys.exit() if event.type == pg.KEYDOWN: if event.key == pg.K_RETURN: pg.mixer.music.load('sound/button.mp3') pg.mixer.music.play(1) done = True if event.key == pg.K_BACKSPACE: username = username[:-1] else: # Add the character to the password string.