コード例 #1
0
ファイル: state.py プロジェクト: cosmologicon/unifac
def beatboss():
	global mode, bosses, hazards, ships, stage, atboss, quitting
	for b in bosses:
		b.hp = -10000
	bosses = []
	hazards = []
	for s in ships:
		if s is not player:
			s.hp = -10000
	player.falling = True
	setmode("reset")
	del hq[:]
	del sq[:]
	del eq[:]
	sound.playsound("killboss")
	if stage < 4:
		addtext("Stage Complete")
		stage += 1
		atboss = False
		save()
	else:
		addtext("The passage is safe...")
		addtext("...for today.")
		addtext("Thanks for playing!")
		quitting = True	
コード例 #2
0
ファイル: state.py プロジェクト: wolmir/cristina
def beatboss():
    global mode, bosses, hazards, ships, stage, atboss, quitting
    for b in bosses:
        b.hp = -10000
    bosses = []
    hazards = []
    for s in ships:
        if s is not player:
            s.hp = -10000
    player.falling = True
    setmode("reset")
    del hq[:]
    del sq[:]
    del eq[:]
    sound.playsound("killboss")
    if stage < 4:
        addtext("Stage Complete")
        stage += 1
        atboss = False
        save()
    else:
        addtext("The passage is safe...")
        addtext("...for today.")
        addtext("Thanks for playing!")
        quitting = True
コード例 #3
0
ファイル: ship.py プロジェクト: cosmologicon/unifac
	def land(self):
		self.z = self.vz = self.az = 0
		self.njump = 0
		sound.playsound("splash")
		state.addsplash(self)
		if not settings.lowres:
			state.addsplash(self)
コード例 #4
0
 def land(self):
     self.z = self.vz = self.az = 0
     self.njump = 0
     sound.playsound("splash")
     state.addsplash(self)
     if not settings.lowres:
         state.addsplash(self)
コード例 #5
0
 def jump(self, f=1):
     if self.njump >= self.jumps:
         return
     self.njump += 1
     self.vz = 12 * f
     self.az = -30
     self.z = max(self.z, 0)
     sound.playsound("jump")
コード例 #6
0
ファイル: state.py プロジェクト: cosmologicon/unifac
def addhp(dhp):
	player.hp += dhp
	sound.playsound("heal")
	if player.hp > hpmax:
		player.hp = hpmax
		player.tblitz = 5
	else:
		addheal(player)
コード例 #7
0
ファイル: ship.py プロジェクト: cosmologicon/unifac
	def jump(self, f=1):
		if self.njump >= self.jumps:
			return
		self.njump += 1
		self.vz = 12 * f
		self.az = -30
		self.z = max(self.z, 0)
		sound.playsound("jump")
コード例 #8
0
ファイル: state.py プロジェクト: wolmir/cristina
def addhp(dhp):
    player.hp += dhp
    sound.playsound("heal")
    if player.hp > hpmax:
        player.hp = hpmax
        player.tblitz = 5
    else:
        addheal(player)
コード例 #9
0
 def hurt(self, dhp=1):
     self.hp -= dhp
     self.flashtime = self.tflash
     if self.hp <= 0:
         self.die()
     else:
         sound.playsound("hurt")
         if self.smokes:
             state.addsmoke(self, self.smokes)
コード例 #10
0
ファイル: ship.py プロジェクト: cosmologicon/unifac
	def hurt(self, dhp=1):
		self.hp -= dhp
		self.flashtime = self.tflash
		if self.hp <= 0:
			self.die()
		else:
			sound.playsound("hurt")
			if self.smokes:
				state.addsmoke(self, self.smokes)
コード例 #11
0
ファイル: ship.py プロジェクト: cosmologicon/unifac
	def fire(self):
		if self.cooltime > 0:
			return False
		state.projectiles.append(self.shottype(self, self.cannons[self.cannontick]))
		sound.playsound("shoot")
		self.cannontick += 1
		self.cannontick %= len(self.cannons)
		self.cooltime = self.tcooldown
		if self.tblitz:
			self.cooltime /= 10
コード例 #12
0
ファイル: boss.py プロジェクト: cosmologicon/unifac
	def hurt(self, dhp):
		if self.form == 0 or self.form == 2:
			return
		if self.form == 1 and self.hp <= 1:
			sound.playsound("killboss")
			self.form = 2
			self.vz = -1
			self.az = 0
			self.z = 0
			return
		Boss.hurt(self, dhp)	
コード例 #13
0
ファイル: state.py プロジェクト: wolmir/cristina
def gameover():
    sound.playsound("gameover")
    setmode("gameover")
    addtext("Game over")
    addtext("Continuing...")
    effects.extend([thing.Slinker(s) for s in ships if s is not player])
    del ships[:]
    effects.extend([thing.Slinker(h) for h in hazards])
    del hazards[:]
    del hq[:]
    del sq[:]
コード例 #14
0
ファイル: boss.py プロジェクト: wolmir/cristina
 def hurt(self, dhp):
     if self.form == 0 or self.form == 2:
         return
     if self.form == 1 and self.hp <= 1:
         sound.playsound("killboss")
         self.form = 2
         self.vz = -1
         self.az = 0
         self.z = 0
         return
     Boss.hurt(self, dhp)
コード例 #15
0
ファイル: state.py プロジェクト: cosmologicon/unifac
def gameover():
	sound.playsound("gameover")
	setmode("gameover")
	addtext("Game over")
	addtext("Continuing...")
	effects.extend([thing.Slinker(s) for s in ships if s is not player])
	del ships[:]
	effects.extend([thing.Slinker(h) for h in hazards])
	del hazards[:]
	del hq[:]
	del sq[:]
コード例 #16
0
 def fire(self):
     if self.cooltime > 0:
         return False
     state.projectiles.append(
         self.shottype(self, self.cannons[self.cannontick]))
     sound.playsound("shoot")
     self.cannontick += 1
     self.cannontick %= len(self.cannons)
     self.cooltime = self.tcooldown
     if self.tblitz:
         self.cooltime /= 10
コード例 #17
0
ファイル: boss.py プロジェクト: wolmir/cristina
 def think(self, dt):
     Boss.think(self, dt)
     if self.form == 0 and self.z > 0 and self.vz > 0:
         self.z = self.vz = 0
         self.form = 1
     if self.form == 2 and self.z < -5 and self.vz < 0:
         self.vz = 8
         self.hp = self.hp0
         self.kx = 10
         self.betax = 0.25
         self.firetime = 0.1
         sound.playsound("addboss")
     if self.form == 2 and self.z > 5 and self.vz > 0:
         self.vz, self.z = 0, 5
         self.form = 3
コード例 #18
0
ファイル: boss.py プロジェクト: cosmologicon/unifac
	def think(self, dt):
		Boss.think(self, dt)
		if self.form == 0 and self.z > 0 and self.vz > 0:
			self.z = self.vz = 0
			self.form = 1
		if self.form == 2 and self.z < -5 and self.vz < 0:
			self.vz = 8
			self.hp = self.hp0
			self.kx = 10
			self.betax = 0.25
			self.firetime = 0.1
			sound.playsound("addboss")
		if self.form == 2 and self.z > 5 and self.vz > 0:
			self.vz, self.z = 0, 5
			self.form = 3
コード例 #19
0
ファイル: main.py プロジェクト: sinthy08/Ramzi-s-Programming
def main():
	def readCSV():
		fileName='thoughts.csv'
		with open(fileName) as csvfile:
			readCSV = csv.reader(csvfile, delimiter='\n')
			finished=[]
			for row in readCSV:
				finished.append(row)
		return finished

	while True:
		file = readCSV()
		randIndex = r(0, (len(file)-1))
		s('cls')
		if input("Do you want to think some more? ") == "y":
			print(file[randIndex][0])
			playsound("music.mp3")
コード例 #20
0
ファイル: state.py プロジェクト: wolmir/cristina
def addboss():
    global mode, bosses, atboss, ships
    setmode("boss")
    atboss = True
    sound.playmusic(tunes[(stage, True)])
    sound.playsound("addboss")
    save()
    ships = [player]
    player.hp = hpmax
    if stage == 1:
        bosses = [boss.Boss1((20, yc + 20, 0), 12)]
        ships.extend(bosses)
        ships.extend([
            ship.Blockade(0, 4, 11, 0.7),
        ])


#	bosses = [boss.Boss((20, yc + 20, 0), 8)]
    elif stage == 2:
        bosses = [boss.Balloon((0, yc, 4.5), 14)]
        ships.extend(bosses)
    elif stage == 3:
        bosses = [
            boss.Bosslet((20, yc + 20, 0), 10),
            boss.Bosslet((-20, yc + 20, 0), 11),
            boss.Bosslet((-30, yc + 20, 0), 12),
            boss.Bosslet((30, yc + 20, 0), 13),
        ]
        ships.extend(bosses)
        ships.extend([
            ship.Blockade(2, 3, 9.5, 1),
            ship.Blockade(-2, 3, 10.5, 1.2),
            ship.Blockade(0, 4, 12.5, 0.7),
        ])
    elif stage == 4:
        bosses = [
            boss.Ghost((0, yc + 20, 0), 15),
        ]
        ships.extend(bosses)
コード例 #21
0
def menu(stats):
    os.system('cls')

    colors = ['yellow', 'magenta', 'cyan', 'white']

    with open('assets/logo.txt', encoding='utf-8') as f:
        print('\n')
        print(color(f.read(), random.choice(colors), margin=False))

    games_played = stats['wins'] + stats['losses']

    if games_played != 0:
        win_ratio = stats['wins'] / games_played * 100
        win_ratio = int(win_ratio * 10) / 10
    else:
        win_ratio = '?'

    print(color(f'Games played: {games_played}', 'cyan'),
          color(f'Wins: {stats["wins"]}', 'green'),
          color(f'Losses: {stats["losses"]}', 'red'),
          color(f'Win ratio: {win_ratio}%', 'yellow'))

    playsound('theme')
コード例 #22
0
ファイル: state.py プロジェクト: cosmologicon/unifac
def addboss():
	global mode, bosses, atboss, ships
	setmode("boss")
	atboss = True
	sound.playmusic(tunes[(stage, True)])
	sound.playsound("addboss")
	save()
	ships = [player]
	player.hp = hpmax
	if stage == 1:
		bosses = [boss.Boss1((20, yc + 20, 0), 12)]
		ships.extend(bosses)
		ships.extend([
			ship.Blockade(0, 4, 11, 0.7),
		])
#	bosses = [boss.Boss((20, yc + 20, 0), 8)]
	elif stage == 2:
		bosses = [boss.Balloon((0, yc, 4.5), 14)]
		ships.extend(bosses)
	elif stage == 3:
		bosses = [
			boss.Bosslet((20, yc + 20, 0), 10),
			boss.Bosslet((-20, yc + 20, 0), 11),
			boss.Bosslet((-30, yc + 20, 0), 12),
			boss.Bosslet((30, yc + 20, 0), 13),
		]
		ships.extend(bosses)
		ships.extend([
			ship.Blockade(2, 3, 9.5, 1),
			ship.Blockade(-2, 3, 10.5, 1.2),
			ship.Blockade(0, 4, 12.5, 0.7),
		])
	elif stage == 4:
		bosses = [
			boss.Ghost((0, yc + 20, 0), 15),
		]
		ships.extend(bosses)
コード例 #23
0
def get_guess():
    # return input if character is a letter of alphabet or "?"
    while True:
        try:
            guess = input('\tGuess a letter (? for hint): ')[0]
            guess = unidecode.unidecode(guess).upper()
        except IndexError:
            continue

        if guess == '?':
            if hints < 0:
                print(color('You ran out of hints!', 'red'))
                playsound('wrong')
                continue

        elif guess.isalpha():
            if guess in guessed_letters:
                print(color('You already guessed this letter!', 'red'))
                playsound('wrong')
                continue
        else:
            continue

        return guess
コード例 #24
0
ファイル: ship.py プロジェクト: cosmologicon/unifac
	def die(self):
		Ship.die(self)
		sound.playsound("kill")
コード例 #25
0
            print(color(f'Losses: {losses}', 'red'))
        # <= info

        print()
        print(color(f'>  {" ".join(guessed_word)}  <', 'yellow'))
        print('\n')

        # check if player lost or won
        if guessed_word == word:
            wins += 1
            won = True
            add_word(word)

            print(color(f'You won!\n', 'green'))

            playsound('win')
            break

        if lives == 0:
            losses += 1
            add_word(word)

            print(
                color('You lost!', 'red'),
                color(f'\n\tThe word is {word}', 'yellow'),
                color('\n\tThis person died because of your incompetency...\n',
                      'red'))

            playsound('loss')
            break
コード例 #26
0
from sound import playsound
playsound('bass.wav')
コード例 #27
0
def main():
    def moveMouse():
        constThing = 128
        for y in range(int((a.screen.size()[1]) / constThing)):
            for x in range(int((a.screen.size()[0]) / constThing)):
                a.mouse.smooth_move(x * constThing,
                                    y * constThing,
                                    duration=0.01)

    def verifyStart():
        return p.confirm(
            text=
            "Do you have a video open that you want to SMASH the Like and Notification Button?",
            buttons=["Yes", "No"])

    def findLikeAndNotification(theme, type):
        if theme == "light" or theme == "1" or theme == "l":
            if type == 0:
                likePosition = p.locateOnScreen('likeLight.png')
                notificationPosition = p.locateOnScreen('bellLight.png')
            elif type == 1:
                likePosition = p.locateOnScreen('likeLightAlt.png')
                notificationPosition = p.locateOnScreen('bellLightAlt.png')
            else:
                raise Exception("image type is not valid")
        elif theme == "dark" or theme == "2" or theme == "d":
            if type == 0:
                likePosition = p.locateOnScreen('likeDark.png')
                notificationPosition = p.locateOnScreen('bellDark.png')
            elif type == 1:
                likePosition = p.locateOnScreen('likeDarkAlt.png')
                notificationPosition = p.locateOnScreen('bellDarkAlt.png')
            else:
                raise Exception("image type is not valid")
        else:
            raise Exception('theme is not "dark" or "light"')

        return likePosition, notificationPosition

    if verifyStart() == "Yes":
        a.alert.alert(
            "To ensure maximum epicness, please hover your mouse over the like button, then press enter"
        )
        mouseLikeX, mouseLikeY = p.position()
        a.alert.alert("Now over the notifcation button, then press enter")
        mouseNotificationX, mouseNotificationY = p.position()
        theme = input(
            "Are you using light or dark theme youtube?\n1.light\n2.dark\n")
        a.alert.alert("Scanning Screen...")
        moveMouse()
        sleep(0.5)
        likePosition, notificationPosition = findLikeAndNotification(theme, 0)
        if likePosition == None or notificationPosition == None:
            likePosition, notificationPosition = findLikeAndNotification(
                theme, 1)
            if likePosition == None or notificationPosition == None:
                # This block executes if photo recognition didn't work at all, and it is using the mouse positions previously captured
                print(likePosition, notificationPosition)
                likeX, likeY = p.center(likePosition)
                notificationX, notificationY = p.center(notificationPosition)
                print(likeX, likeY)
                print(notificationX, notificationY)

                a.mouse.smooth_move(likeX, likeY)
                playsound('bass.wav')
                p.click()
                a.mouse.smooth_move(notificationX, notificationY)
                p.click()
                playsound("bass.wav")
                a.alert.alert("Buttons have been SMASHED!")
            # If this else block executes means that the first photos didn't work and the program tried to use the alternative photos
            else:
                print(likePosition, notificationPosition)
                likeX, likeY = p.center(likePosition)
                notificationX, notificationY = p.center(notificationPosition)
                print(likeX, likeY)
                print(notificationX, notificationY)

                a.mouse.smooth_move(likeX, likeY)
                playsound('bass.wav')
                p.click()
                a.mouse.smooth_move(notificationX, notificationY)
                p.click()
                playsound("bass.wav")
                a.alert.alert("Buttons have been SMASHED!")
        # If this else block executes means that the photo position recognition worked the first time!
        else:
            print(likePosition, notificationPosition)
            likeX, likeY = p.center(likePosition)
            notificationX, notificationY = p.center(notificationPosition)
            print(likeX, likeY)
            print(notificationX, notificationY)

            a.mouse.smooth_move(likeX, likeY)
            playsound('bass.wav')
            p.click()
            a.mouse.smooth_move(notificationX, notificationY)
            p.click()
            playsound("bass.wav")
            a.alert.alert("Buttons have been SMASHED!")
    else:
        a.alert.alert(
            "WELL THEN GO OPEN UP A VIDEO THAT YOU WANT TO SMASH THE LIKE AND NOTIFICATION BUTTONS!"
        )
コード例 #28
0
ファイル: state.py プロジェクト: cosmologicon/unifac
def restorehealth():
	if player.hp < hpmax:
		sound.playsound("heal")
		player.hp = hpmax
コード例 #29
0
ファイル: display.py プロジェクト: TomMelt/PhysFilmMakers
def draw_screen(stdscr):

    # Clear and refresh the screen for a blank canvas
    stdscr.clear()
    stdscr.refresh()
    stdscr.nodelay(1)

    # Start colors in curses
    curses.start_color()
    curses.init_pair(1, curses.COLOR_CYAN, curses.COLOR_BLACK)
    curses.init_pair(2, curses.COLOR_RED, curses.COLOR_BLACK)
    curses.init_pair(3, curses.COLOR_BLACK, curses.COLOR_WHITE)

    while 1:
        # Initialization
        stdscr.clear()
        height, width = stdscr.getmaxyx()

        # Title String
        title = "PhysFilm Makers"[:width - 1]

        # Get current value of current, voltage and power
        I, V, P = get_readings()

        I = round(I, 2)
        V = round(V, 1)

        if I > 0.3:
            playsound(FREQUENCY=int(600 * (1 + I)))

        # Declaration of strings
        sub1 = "Current : {0:5.3f} mA".format(I)
        sub2 = "Voltage : {0:5.3f} V ".format(V)
        sub3 = "Power   : {0:5.3f} mW".format(P)
        statusbarstr = "Press '<Esc>' or 'q' to exit"

        # Centering calculations
        start_x_title = int((width // 2) - (len(title) // 2) - len(title) % 2)
        start_x_subtitle = int((width // 2) - (len(sub1) // 2) - len(sub1) % 2)
        start_y = int((height // 2) - 2)

        # Render status bar
        stdscr.attron(curses.color_pair(3))
        stdscr.addstr(height - 1, 0, statusbarstr)
        stdscr.addstr(
            height - 1,
            len(statusbarstr),
            " " * (width - len(statusbarstr) - 1),
        )
        stdscr.attroff(curses.color_pair(3))

        # Turning on attributes for title
        stdscr.attron(curses.color_pair(2))
        stdscr.attron(curses.A_BOLD)

        # Rendering title
        stdscr.addstr(start_y, start_x_title, title)

        # Turning off attributes for title
        stdscr.attroff(curses.color_pair(2))
        stdscr.attroff(curses.A_BOLD)

        # Print rest of text
        stdscr.addstr(start_y + 1, (width // 2) - 10, '-' * 20)
        stdscr.addstr(start_y + 2, start_x_subtitle, sub1)
        stdscr.addstr(start_y + 3, start_x_subtitle, sub2)
        stdscr.addstr(start_y + 4, start_x_subtitle, sub3)
        stdscr.addstr(start_y + 5, (width // 2) - 10, '-' * 20)

        # Refresh the screen
        stdscr.move(0, 0)

        key = stdscr.getch()
        if key == 27 or key == ord('q'):
            curses.echo()
            curses.nocbreak()
            curses.endwin()
            break

        stdscr.refresh()
コード例 #30
0
ファイル: state.py プロジェクト: wolmir/cristina
def restorehealth():
    if player.hp < hpmax:
        sound.playsound("heal")
        player.hp = hpmax
コード例 #31
0
from sound import playsound
playsound('music.mp3')
コード例 #32
0
 def die(self):
     Ship.die(self)
     sound.playsound("kill")