• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python simplegui.load_sound函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中simplegui.load_sound函数的典型用法代码示例。如果您正苦于以下问题:Python load_sound函数的具体用法?Python load_sound怎么用?Python load_sound使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了load_sound函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: loadSounds

def loadSounds():
    global matchSound
    global failSound
    global victorySound
    matchSound = simplegui.load_sound(GAME_ASSETS + "win.ogg")
    failSound = simplegui.load_sound(GAME_ASSETS + "lose.ogg")
    victorySound = simplegui.load_sound(GAME_ASSETS + "goal.ogg")
开发者ID:mwales,项目名称:education,代码行数:7,代码来源:game.py


示例2: __init__

 def __init__(self, url):
     self.url = url
     if CACHE_STORE.has_key(url):
         self.sound = CACHE_STORE[url]
     else:
         self.sound = simplegui.load_sound(url)
         CACHE_STORE[url] = self.sound
开发者ID:vutran,项目名称:asteroids,代码行数:7,代码来源:game.py


示例3: __init__

 def __init__(self):
     self.center_x = 99
     self.center_y = 260
     self.speed = 0
     self.gravity = 0
     self.image = simplegui.load_image(BIRD_IMAGE)
     self.flap_sound = simplegui.load_sound(FLAP_SOUND)
开发者ID:zincsoda,项目名称:flappy_bird,代码行数:7,代码来源:7_create_and_remove_pipes.py


示例4: __init__

 def __init__(self, pos, vel, angle, image, info, BOARD_WIDTH, BOARD_HEIGHT):
     self.pos = [pos[0], pos[1]]
     self.vel = [vel[0], vel[1]]
     self.thrust = False
     self.angle = angle
     self.angle_vel = 0
     self.FRICTION = 0.009
     self.BOARD_WIDTH = BOARD_WIDTH
     self.BOARD_HEIGHT = BOARD_HEIGHT
     self.MISSILE_SPEED = 7
     self.image = image
     self.image_center = info.get_center()
     self.image_size = info.get_size()
     self.radius = info.get_radius()
     self.timer = None
     self.time_passed = 0.0
     self.ship_thrust_sound = simplegui.load_sound("http://commondatastorage.googleapis.com/codeskulptor-assets/sounddogs/thrust.mp3")
     self.missile_info = ImageInfo([5, 5], [10, 10], 3, 40)
     self.missile_image = simplegui.load_image("http://commondatastorage.googleapis.com/codeskulptor-assets/lathrop/shot2.png")
     self.missile_sound = simplegui.load_sound("http://commondatastorage.googleapis.com/codeskulptor-assets/sounddogs/missile.mp3")
     self.missile_sound.set_volume(.7)
开发者ID:phaedraa,项目名称:Games,代码行数:21,代码来源:Asteroids.py


示例5: __init__

    def __init__(self):
        self.my_ship = Ship([WIDTH / 2, HEIGHT / 2], [0, 0], 0)
        self.rock_group = set()
        self.explosion_group = set()

        self.lives = 3
        self.started = False
        self.score = 0
        self.time = 0.5
        self.max_rock_velocity = 10
        self.points_to_velocity_map = {
            20: 13, 30: 17, 40: 21, 50: 25, 60: 29, 70: 33, 80: 37,
            90: 41, 100: 45
        }

        self.soundtrack = simplegui.load_sound(
            MEDIA_HOST + 'sounddogs/soundtrack.mp3')
        self.splash_info = ImageInfo([200, 150], [400, 300])
        self.splash_image = simplegui.load_image(
            MEDIA_HOST + 'lathrop/splash.png')
        self.asteroid_info = ImageInfo([45, 45], [90, 90], 40)
        self.asteroid_image = simplegui.load_image(
            MEDIA_HOST + 'lathrop/asteroid_blue.png')
        self.ship_explosion_image = simplegui.load_image(
            MEDIA_HOST + 'lathrop/explosion_alpha.png')
        self.asteroid_explosion_image = simplegui.load_image(
            MEDIA_HOST + 'lathrop/explosion_blue2.png')
        self.ship_thrust_sound = simplegui.load_sound(
            MEDIA_HOST + 'sounddogs/thrust.mp3')
        self.explosion_info = ImageInfo([64, 64], [128, 128], 17, 24, True)
        self.explosion_sound = simplegui.load_sound(
            MEDIA_HOST + 'sounddogs/explosion.mp3')
        self.debris_info = ImageInfo([320, 240], [640, 480])
        self.debris_image = simplegui.load_image(
            MEDIA_HOST + 'lathrop/debris3_brown.png')
        self.nebula_info = ImageInfo([400, 300], [800, 600])
        self.nebula_image = simplegui.load_image(
            MEDIA_HOST + 'lathrop/nebula_blue.s2014.png')
开发者ID:wisienka91,项目名称:asteroids,代码行数:38,代码来源:asteroids.py


示例6: __init__

    def __init__(self, size, radius = 0, lifespan = float('inf'), sound_url = None):
        """All the resuable data

        :size:      @ output size of image
        :radius:    @ for collision determination
        :lifespan:  @ automatically disappear if not infinite, count in drawing frames
        :sound_url: @ sound file url

        """
        self.size     = size
        self.radius   = radius
        self.lifespan = lifespan

        self.sound = simplegui.load_sound(sound_url) if sound_url else None
开发者ID:jjliun,项目名称:Python,代码行数:14,代码来源:spaceship2.py


示例7: __init__

 def __init__(self, pos, vel, angle, image, info):
     self.pos = [pos[0],pos[1]]
     self.vel = [vel[0],vel[1]]
     self.thrust = False
     self.angle = angle
     self.angle_vel = 0
     self.image = image
     self.image_center = info.get_center()
     self.image_size = info.get_size()
     self.radius = info.get_radius()
     self.ANGULAR_VEL_CHANGE = 0.10
     self.info = info
     
     self.ship_thrust_sound = simplegui.load_sound("http://commondatastorage.googleapis.com/codeskulptor-assets/sounddogs/thrust.mp3")
     self.ship_thrust_sound.set_volume(1)
     
     self.friction_constant = SHIP_FRICTION_CONSTANT
开发者ID:deltaworld,项目名称:python-programming-coursera,代码行数:17,代码来源:mini-project+-+Student+4.py


示例8: init

def init():
    global paddle1_pos, paddle2_pos, paddle1_vel, paddle2_vel, message  # these are floats
    global score1, score2  # these are ints
    restart = simplegui.load_sound("http://www.mediacollege.com/downloads/sound-effects/star-wars/yoda/yoda_doordonot.wav")
    restart.play()
    paddle1_pos = (HEIGHT-PAD_HEIGHT)/2
    paddle2_pos = (HEIGHT-PAD_HEIGHT)/2
    paddle1_vel = 0
    paddle2_vel = 0
    score1 = 0
    score2 = 0
    message = ""
    start_serve = random.randrange(0,2)
    if (start_serve == 0):
        ball_init(False)
    else:
        ball_init(True)
开发者ID:GJena,项目名称:Games,代码行数:17,代码来源:pong.py


示例9: load

    def load(self):
        """
        **Start loading** of all images and sounds added
        since last `Loader.load()` execution.

        * In standard Python with SimpleGUICS2Pygame:
        draw a progression bar on canvas
        and wait until the loading is finished.

        * In SimpleGUI of CodeSkulptor: *don't* wait.
        """
        try:
            from simplegui import load_image, load_sound

            SIMPLEGUICS2PYGAME = False
        except ImportError:
            from SimpleGUICS2Pygame.simpleguics2pygame import load_image, \
                load_sound

            SIMPLEGUICS2PYGAME = True

        self._SIMPLEGUICS2PYGAME = SIMPLEGUICS2PYGAME

        if SIMPLEGUICS2PYGAME:
            handler_saved = self._frame._canvas._draw_handler
            self._frame._canvas._draw_handler = self._draw_loading

        for name in self._sounds:
            if SIMPLEGUICS2PYGAME:
                self._frame._canvas._draw()
            if isinstance(self._sounds[name], str):
                self._sounds[name] = load_sound(self._sounds[name])

        for name in self._images:
            if SIMPLEGUICS2PYGAME:
                self._frame._canvas._draw()
            if isinstance(self._images[name], str):
                self._images[name] = load_image(self._images[name])

        if SIMPLEGUICS2PYGAME:
            self._frame._canvas._draw()
            self._frame._canvas._draw_handler = handler_saved
开发者ID:moehuster,项目名称:python,代码行数:42,代码来源:simplegui_lib_loader.py


示例10: draw

def draw(canvas):
    """
    Print str representation of each SimpleGUI object.

    :param canvas: simpleguics2pygame.Canvas or simplegui.Canvas
    """
    image = simplegui.load_image('')
    sound = simplegui.load_sound('')
    timer = simplegui.create_timer(1000, lambda: None)

    for name, o in (('button', button),
                    ('canvas', canvas),
                    ('frame',  frame),
                    ('image',  image),
                    ('input',  input),
                    ('label',  label),
                    ('sound',  sound),
                    ('timer',  timer)):
        print(name + str(type(o)) + repr(o) + str(o))

    frame.stop()
开发者ID:Yesterday69,项目名称:Django-blog,代码行数:21,代码来源:test_objects.py


示例11: ImageInfo

ship_image = simplegui.load_image("http://commondatastorage.googleapis.com/codeskulptor-assets/lathrop/double_ship.png")

# missile image - shot1.png, shot2.png, shot3.png
missile_info = ImageInfo([5,5], [10, 10], 3, 75)
missile_image = simplegui.load_image("http://commondatastorage.googleapis.com/codeskulptor-assets/lathrop/shot2.png")

# asteroid images - asteroid_blue.png, asteroid_brown.png, asteroid_blend.png
asteroid_info = ImageInfo([45, 45], [90, 90], 40)
asteroid_image = simplegui.load_image("http://commondatastorage.googleapis.com/codeskulptor-assets/lathrop/asteroid_blue.png")

# animated explosion - explosion_orange.png, explosion_blue.png, explosion_blue2.png, explosion_alpha.png
explosion_info = ImageInfo([64, 64], [128, 128], 17, 24, True)
explosion_image = simplegui.load_image("http://commondatastorage.googleapis.com/codeskulptor-assets/lathrop/explosion_alpha.png")

# sound assets purchased from sounddogs.com, please do not redistribute
soundtrack = simplegui.load_sound("http://commondatastorage.googleapis.com/codeskulptor-assets/sounddogs/soundtrack.mp3")
missile_sound = simplegui.load_sound("http://commondatastorage.googleapis.com/codeskulptor-assets/sounddogs/missile.mp3")
missile_sound.set_volume(.5)
ship_thrust_sound = simplegui.load_sound("http://commondatastorage.googleapis.com/codeskulptor-assets/sounddogs/thrust.mp3")
explosion_sound = simplegui.load_sound("http://commondatastorage.googleapis.com/codeskulptor-assets/sounddogs/explosion.mp3")

## CC 3.0 sound file by Jesus Lastra, http://opengameart.org/content/8-bit-pickup-1
extra_life_sound = simplegui.load_sound("http://mwales.net/junk/SFX_Pickup_44.mp3")

# helper functions to handle transformations
def angle_to_vector(ang):
    return [math.cos(ang), math.sin(ang)]

def vector_to_angle(v):
    return math.atan2(v[0],v[1])
开发者ID:mwales,项目名称:education,代码行数:30,代码来源:asteroids.py


示例12:

# project - Blackjack

import simplegui
import random

# load card sprite - 949x392 - source: jfitz.com
CARD_SIZE = (73, 98)
CARD_CENTER = (36.5, 49)
card_images = simplegui.load_image("http://commondatastorage.googleapis.com/codeskulptor-assets/cards.jfitz.png")
button_not_working = simplegui.load_sound("https://www.dropbox.com/s/fyd6o2bu2fq5v3g/button%20not%20working.ogg?dl=1")
won_game = simplegui.load_sound("https://www.dropbox.com/s/um0decuhbs5ljd9/won.ogg?dl=1")
deal_new_card = simplegui.load_sound("https://www.dropbox.com/s/47zech3mdxs4nzx/deal_card.ogg?dl=1")
deal_new_card.set_volume(0.3)

CARD_BACK_SIZE = (71, 96)
CARD_BACK_CENTER = (35.5, 48)
card_back = simplegui.load_image("http://commondatastorage.googleapis.com/codeskulptor-assets/card_back.png")    

# initialize some useful global variables
in_play = False
outcome = ""
score = 0

# define globals for cards
SUITS = ('C', 'S', 'H', 'D')
RANKS = ('A', '2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K')
VALUES = {'A':1, '2':2, '3':3, '4':4, '5':5, '6':6, '7':7, '8':8, '9':9, 'T':10, 'J':10, 'Q':10, 'K':10}


# define card class
class Card:
开发者ID:aman400,项目名称:Blackjack,代码行数:31,代码来源:Blackjack.py


示例13: str

    music.set_volume(vol / 10.0)
    volume_button.set_text("Volume = " + str(vol))


# create frame - canvas will be blank
frame = simplegui.create_frame("Music demo", 250, 250, 100)

# set up control elements 
frame.add_button("play", play,100)
frame.add_button("pause", pause,100)
frame.add_button("rewind",rewind,100)
frame.add_button("laugh",laugh,100)
frame.add_button("Vol down", vol_down,100)
frame.add_button("Vol up", vol_up,100)

# initialize volume, create button whose label will display the volume
vol = 7
volume_button = frame.add_label("Volume = " + str(vol))


# load some sounds
music = simplegui.load_sound("http://commondatastorage.googleapis.com/codeskulptor-assets/Epoq-Lepidoptera.ogg")
laugh = simplegui.load_sound("http://commondatastorage.googleapis.com/codeskulptor-assets/Evillaugh.ogg")

# make the laugh quieter so my ears don't bleed
laugh.set_volume(.1)

frame.start()


开发者ID:Crescent-Saturn,项目名称:Hello_Python,代码行数:28,代码来源:exemples-sound.py


示例14: D

import simplegui as S,math as M,random as R
_="_blue"
y="http://commondatastorage.googleapis.com/codeskulptor-assets/"
j=y+"sounddogs/"
q=y+"lathrop/"
z=m=t=s=0
W=800
H=600
C=[W/2,H/2]
l=3
Z=[0,1]
L=lambda s:S.load_image(s+".png")
O=lambda s:S.load_sound(s)
r=lambda a,b:R.random()*(b-a)+a
A=lambda a:[M.cos(a),M.sin(a)]
h=O(j+"thrust.mp3")
def D(a,b,c,d,e,f,g=0):a.draw_image(b,c,d,e,f,g)
class I:
 def __init__(s,c,z,r=0,l=0,a=0):s.c=c;s.z=z;s.r=r;s.a=a;s.l=l if l else float('inf')
class X:
 def __init__(s,p,v,a,g,i,n,d=0):
  s.p=p;s.v=v;s.a=a;s.g=g;s.i=i;s.c=n.c;s.z=n.z;s.r=n.r
  if d:d.rewind();d.play()
 def d(s,c,a=0):D(c,s.i,[s.c[0]+a,s.c[1]],s.z,s.p,s.z,s.a)
 def w(s):s.a+=s.g;s.p[1]+=s.v[1];s.p[0]+=s.v[0];s.p[0]%=W;s.p[1]%=H
class T(X):
 def __init__(s,p,v,a,i,n):X.__init__(s,p,v,0,0,i,n);s.t=0
 def e(s):s.t=1-s.t;[h.rewind,h.play][s.t]()
 def f(a):
  global z;k=A(a.a);p=a.p[:];v=a.v[:]
  for i in Z:p[i]+=40*k[i];v[i]+=8*k[i]
开发者ID:tpowellcio,项目名称:pylearn,代码行数:31,代码来源:SpaceshipSmall.py


示例15:

# define timers
timer = simplegui.create_timer(stopwatch_interval, tick)
message_colour_timer = simplegui.create_timer(colour_interval, message_colour_tick)
message_blink_timer = simplegui.create_timer(blink_interval, message_blink_tick)
music_timer = simplegui.create_timer(music_interval, music_tick)

# load graphics
background = simplegui.load_image("http://www.chloeunrau.com/stuff/es-c.jpg")
cheevo5 = simplegui.load_image("http://www.chloeunrau.com/stuff/es-5a.jpg")
cheevo10 = simplegui.load_image("http://www.chloeunrau.com/stuff/es-10a.jpg")
cheevo25 = simplegui.load_image("http://www.chloeunrau.com/stuff/es-25a.jpg")
cheevo50 = simplegui.load_image("http://www.chloeunrau.com/stuff/es-50a.jpg")
cheevo100 = simplegui.load_image("http://www.chloeunrau.com/stuff/es-100a.jpg")

# load sounds
music = simplegui.load_sound("http://www.chloeunrau.com/stuff/music.ogg")
music.set_volume(0.5)
# music source:
# http://www.flashkit.com/
sound_cheevo = simplegui.load_sound("http://www.chloeunrau.com/stuff/achievement.ogg")
sound_cheevo.set_volume(1.0)
sound_score = simplegui.load_sound("http://www.chloeunrau.com/stuff/score.ogg")
sound_score.set_volume(0.3)
sound_fail = simplegui.load_sound("http://www.chloeunrau.com/stuff/fail.ogg")
sound_fail.set_volume(0.5)
sound_score_streak = simplegui.load_sound("http://www.chloeunrau.com/stuff/score-streak.ogg")
sound_score_streak.set_volume(0.5)
sound_reset = simplegui.load_sound("http://www.chloeunrau.com/stuff/reset.ogg")
sound_reset.set_volume(1.0)
sound_game_over = simplegui.load_sound("http://www.chloeunrau.com/stuff/game-over.ogg")
sound_game_over.set_volume(1.0)
开发者ID:unrau,项目名称:Extreme-Stopwatch,代码行数:31,代码来源:Extreme+Stopwatch.py


示例16: info

# info(self, center, size, radius = 0, lifespan = None, animated = False):
# missile image - shot1.png, shot2.png, shot3.png
missile_info = ImageInfo([5,5], [10, 10], 3, 30)
missile_image = simplegui.load_image("http://commondatastorage.googleapis.com/codeskulptor-assets/lathrop/shot2.png")

# asteroid images - asteroid_blue.png, asteroid_brown.png, asteroid_blend.png
asteroid_info = ImageInfo([45, 45], [90, 90], 40, 1200)
asteroid_image = simplegui.load_image("http://commondatastorage.googleapis.com/codeskulptor-assets/lathrop/asteroid_blue.png")

# animated explosion - explosion_orange.png, explosion_blue.png, explosion_blue2.png, explosion_alpha.png
# def __init__(self, center, size, radius = 0, lifespan = None, animated = False):
explosion_info = ImageInfo([64, 64], [128, 128], 17, 120, True)
explosion_image = simplegui.load_image("http://commondatastorage.googleapis.com/codeskulptor-assets/lathrop/explosion_alpha.png")

# sound assets purchased from sounddogs.com, please do not redistribute
soundtrack = simplegui.load_sound("http://commondatastorage.googleapis.com/codeskulptor-assets/sounddogs/soundtrack.mp3")
missile_sound = simplegui.load_sound("http://commondatastorage.googleapis.com/codeskulptor-assets/sounddogs/missile.mp3")
missile_sound.set_volume(.5)
ship_thrust_sound = simplegui.load_sound("http://commondatastorage.googleapis.com/codeskulptor-assets/sounddogs/thrust.mp3")
explosion_sound = simplegui.load_sound("http://commondatastorage.googleapis.com/codeskulptor-assets/sounddogs/explosion.mp3")

good_sound = simplegui.load_sound("https://www.dropbox.com/s/no4xabzohgqdv4l/mgod_clip.mp3")
#good_sound = explosion_sound
# ship angle_vel
SHIP_ANGLE_VEL = 0
ANGLE_DELTA = math.pi/30
NAKE_SHIP_POS = [45, 45]
THRUSTER_SHIP_POS = [45+90, 45]
THRUST_SPEED = 3.618
started = False
开发者ID:eli9999,项目名称:python-study,代码行数:30,代码来源:ricerocks.py


示例17: ImageInfo

ship_image = simplegui.load_image("http://commondatastorage.googleapis.com/codeskulptor-assets/lathrop/double_ship.png")

# missile image - shot1.png, shot2.png, shot3.png
missile_info = ImageInfo([5,5], [10, 10], 3, 50)
missile_image = simplegui.load_image("http://commondatastorage.googleapis.com/codeskulptor-assets/lathrop/shot2.png")

# asteroid images - asteroid_blue.png, asteroid_brown.png, asteroid_blend.png
asteroid_info = ImageInfo([45, 45], [90, 90], 40)
asteroid_image = simplegui.load_image("http://commondatastorage.googleapis.com/codeskulptor-assets/lathrop/asteroid_blue.png")

# animated explosion - explosion_orange.png, explosion_blue.png, explosion_blue2.png, explosion_alpha.png
explosion_info = ImageInfo([64, 64], [128, 128], 17, 24, True)
explosion_image = simplegui.load_image("http://commondatastorage.googleapis.com/codeskulptor-assets/lathrop/explosion_alpha.png")

# sound assets purchased from sounddogs.com, please do not redistribute
soundtrack = simplegui.load_sound("http://www.soundjay.com/free-music/sounds/iron-man-01.mp3")
missile_sound = simplegui.load_sound("http://commondatastorage.googleapis.com/codeskulptor-assets/sounddogs/missile.mp3")
missile_sound.set_volume(.3)
ship_thrust_sound = simplegui.load_sound("http://commondatastorage.googleapis.com/codeskulptor-assets/sounddogs/thrust.mp3")
explosion_sound = simplegui.load_sound("http://www.pacdv.com/sounds/fart-sounds/fart-2.wav")

# helper functions to handle transformations
def angleToVector(ang):
    return [math.cos(ang), math.sin(ang)]

def dist(p, q):
    return math.sqrt((p[0] - q[0]) ** 2 + (p[1] - q[1]) ** 2)


# Ship class
class Ship:   
开发者ID:EthanRS,项目名称:Rice-University-Python-Projects,代码行数:31,代码来源:Asteriods.py


示例18: init

# implementation of card game - Memory

import simplegui
import random

sound = simplegui.load_sound("http://hangtar.fikszradio.hu/Otorai_tea/2008/Otorai_tea_20080619/07%20-%20Rick%20Astley%20-%20Never%20Gonna%20Give%20You%20Up.mp3")
image = simplegui.load_image("http://myhometruths.com/wp-content/uploads/2013/02/rick-astley.jpg")
moves = 0
i = 0
index = [0,0]
state = 0
card_list1 = range(0,8)
card_list2 = range(0,8)
main_list = card_list1 + card_list2
exposed_list = []
rick = 0

while i < 16:
     exposed_list.append(False)
     i += 1

# helper function to initialize globals
def init():
    global state, exposed_list
    i = 0
    state = 0
    random.shuffle(main_list)
    for i in range(0,16):
        exposed_list[i] = False
     
# define event handlers
开发者ID:RobPiwowarek,项目名称:Python-course,代码行数:31,代码来源:memory.py


示例19: new_game

CARDS = X_CARDS * Y_CARDS
CARD_WIDTH = 150
CARD_HEIGHT = 175
X_PAD = 20
Y_PAD = 20
SLOT_WIDTH = CARD_WIDTH + X_PAD
SLOT_HEIGHT = CARD_HEIGHT + Y_PAD

# define media assets
FRONT_IMAGE = simplegui.load_image('http://i.istockimg.com/file_thumbview_approve/6910013/2/stock-illustration-6910013-slot-symbols.jpg')
FRONT_IMAGE_BW = simplegui.load_image('https://dl.dropboxusercontent.com/u/1237849/stock-illustration-6910013-slot-symbols-black-and-white.jpg')
FRONT_IMAGE_POS = { 0: (67, 70), 1: (193, 69), 2: (310, 69),
                   3: (65, 191), 4: (311, 313), 5: (311, 191),
                   6: (66, 313), 7: (190, 313) }
BACK_IMAGE = simplegui.load_image('http://media-hearth.cursecdn.com/attachments/2/101/cardback-rankedladder.png')
CARD_FLIP_SOUND = simplegui.load_sound('http://www.soundrangers.com/demos/gambling/card_deal02.mp3')

# helper function to initialize globals
def new_game():
    global cards, exposed, state, card_clicked, card1, card2, match, turns, matched
    cards = list(range(CARDS / 2)) + list(range(CARDS / 2))
    random.shuffle(cards)
    exposed = [False for i in range(CARDS)]
    matched = [False for i in range(CARDS)]
    state = 0
    turns = 0
    card_clicked = None
    card1 = None
    card2 = None
    match = False
    
开发者ID:danielnbarbosa,项目名称:python-class-games,代码行数:30,代码来源:memory.py


示例20: angle_to_vector

# Global constants
WIDTH = 800
HEIGHT = 600
FIRING_POSITION = [WIDTH // 2, HEIGHT]
FIRING_LINE_LENGTH = 60
FIRING_ANGLE_VEL_INC = 0.02
BUBBLE_RADIUS = 20
COLOR_LIST = ["Red", "Green", "Blue", "White"]

# global variables
firing_angle = math.pi / 2
firing_angle_vel = 0
bubble_stuck = True

# firing sound
firing_sound = simplegui.load_sound("http://commondatastorage.googleapis.com/codeskulptor-assets/Collision8-Bit.ogg")


# helper functions to handle transformations
def angle_to_vector(ang):
    return [math.cos(ang), math.sin(ang)]

def dist(p,q):
    return math.sqrt((p[0]-q[0])**2+(p[1]-q[1])**2)


# class defintion for Bubbles
class Bubble:
    
    def __init__(self, sound = None):
        self.pos = list(FIRING_POSITION)
开发者ID:deltaworld,项目名称:python-programming-coursera,代码行数:31,代码来源:03+stuck+bubbles+template.py



注:本文中的simplegui.load_sound函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python simpleguitk.create_frame函数代码示例发布时间:2022-05-27
下一篇:
Python simplegui.load_image函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap