예제 #1
0
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
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
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
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
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
def restorehealth():
	if player.hp < hpmax:
		sound.playsound("heal")
		player.hp = hpmax
예제 #29
0
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")