コード例 #1
0
ファイル: pong.py プロジェクト: oliviaosimon/Final-Project
 def __init__(self, position):
     ball_asset = ImageAsset("images/orb-150545_640.png") #pull from repository
     ball = Sprite(ball_asset, (0, 400))
     ball.scale = 0.07
     # custom attributes
     ball.direction = 1
     ball.go = True
     # Sounds
     pew1_asset = SoundAsset("sounds/pew1.mp3")
     pew1 = Sound(pew1_asset)
     pop_asset = SoundAsset("sounds/reappear.mp3")
     pop = Sound(pop_asset)
     super().__init__(ball_asset, position)
コード例 #2
0
 def __init__(self, app, sun):
     super().__init__(Bullet.asset, Bullet.collisionasset, (0,0), (0,0), sun)
     self.visible = False
     self.firing = False
     self.time = 0
     self.pew = Sound(Bullet.pewasset)
     self.pew.volume = 10
コード例 #3
0
    def __init__(self):
        super().__init__()

        self.gameover = False

        rectangle = RectangleAsset(1000, 1000, thinline, blue)
        rectangle1 = RectangleAsset(1000, 1000, thinline, white)

        Sprite(rectangle, (0, 0))
        Sprite(rectangle1, (0, 350))

        #initial positions
        Background((0, 0))
        Background((512, 0))
        Background((1024, 0))
        House1((300, 350))
        House2((900, 350))
        Grinch((1000, 335))
        Grinch((100, 335))
        Grinch((1500, 335))
        self.p1 = Present1((350, 50))
        self.Hlist = Heartlist()

        #sleigh
        sleigh_asset = ImageAsset("images/santa_sleigh_PNG72.png")
        sleigh = Sprite(sleigh_asset, (350, 50))
        sleigh.scale = 0.3

        #music
        jingle_asset = SoundAsset("sounds/Santa Claus Is Coming To Town.mp3")
        jingle = Sound(jingle_asset)
        jingle.volume = 8
        jingle.play()
コード例 #4
0
 def __init__(self, app, sun, sun2):
     super().__init__(Bullet.asset, (0, 0), (0, 0), sun, sun2)
     self.visible = False
     self.firing = False
     self.time = 0
     self.circularCollisionModel()
     self.pew = Sound(Bullet.pewasset)
     self.pew.volume = 10
コード例 #5
0
ファイル: Final.py プロジェクト: liama482/Final-Project
 def __init__(self, asset, position, prop):
     self.b = 0
     self.c = 0
     chk = 0  #preparing to check a condition
     self.ct = 1  #nothing has been clicked on
     super().__init__(asset, position)
     self.center = (0.5, 0.5)
     if prop == True:
         Draw.listenMouseEvent("mousedown", self.ym_dn)
     if prop == False:
         go = Sound(self.noise)
         go.play()
コード例 #6
0
 def __init__(self, position):
     super().__init__(SpaceShip.spaceship_asset, position)
     self.x=1
     self.y=1
     self.v=0.01
     self.scale=.5
     SpaceGame.listenKeyEvent("keydown", "right arrow", self.rightarrowKey)
     SpaceGame.listenKeyEvent('keydown', "left arrow", self.leftarrowKey)
     SpaceGame.listenKeyEvent('keydown', "up arrow", self.uparrowKey)
     SpaceGame.listenKeyEvent('keydown', "down arrow", self.downarrowKey)
     self.thrust = 0
     self.thrustframe = 1
     SpaceGame.listenKeyEvent("keydown", "space", self.thrustOn)
     SpaceGame.listenKeyEvent("keyup", "space", self.thrustOff)
     self.fxcenter = self.fycenter = 0.5
     self.pew=Sound(SpaceShip.shotasset)
     self.pew.volume=5
コード例 #7
0
 def __init__(self, asset, app, position, velocity, sun):
     self.bullets = []
     for i in range(Ship.bullets):
         self.bullets.append(Bullet(app, sun))
     super().__init__(asset, position, velocity, sun)
     self.initposition = position
     self.initvelocity = self.vx, self.vy
     self.initrotation = self.rotation
     self.app = app
     self.mass = 1.0
     self.circularCollisionModel()
     self.imagex = 0
     self.reappear = Sound(Ship.reappearasset)
     self.reappear.volume = 40
     self.waitspawn = 0
     self.respawnplayed = False
     healthpos = 'left' if position[0] < app.width / 2 else 'right'
     self.health = HealthBar(asset, Ship.healthcount, healthpos, app)
     self.dead = False
コード例 #8
0
 def __init__(self, position):
     super().__init__(ExplosionBig.asset, position)
     self.image = 0
     self.center = (0.5, 0.5)
     self.boom = Sound(ExplosionBig.boomasset)
     self.boom.play()
コード例 #9
0
ファイル: gaaaamee.py プロジェクト: VinzentM/empty-app
"""
from ggame import App, RectangleAsset, ImageAsset, SoundAsset, Sprite, Sound
from ggame import LineStyle, Color

SCREEN_WIDTH = 640
SCREEN_HEIGHT = 480

green = Color(0x00ff00, 1)
black = Color(0, 1)
noline = LineStyle(0, black)
bg_asset = RectangleAsset(SCREEN_WIDTH, SCREEN_HEIGHT, noline, green)
bg = Sprite(bg_asset, (0,0))

# Sounds
pew1_asset = SoundAsset("sounds/pew1.mp3")
pew1 = Sound(pew1_asset)
pop_asset = SoundAsset("sounds/reappear.mp3")
pop = Sound(pop_asset)
# A ball! This is already in the ggame-tutorials repository
ball_asset = ImageAsset("images/orb-150545_640.png")
ball = Sprite(ball_asset, (0, 0))
# Original image is too big. Scale it to 1/10 its original size
ball.scale = 0.1
ball.y = 200
# custom attributes
ball.dir = 1
ball.go = True
# Sounds
pew1_asset = SoundAsset("sounds/pew1.mp3")
pew1 = Sound(pew1_asset)
pop_asset = SoundAsset("sounds/reappear.mp3")
コード例 #10
0
ファイル: soundtest.py プロジェクト: averywallis/Radar
from ggame import Sound, SoundAsset

e5 = Sound(SoundAsset("sounds/00_part1_entry-5.wav"))
e6 = Sound(SoundAsset("sounds/00_part1_entry-6.wav"))
e7 = Sound(SoundAsset("sounds/00_part1_entry-7.wav"))
e7.play()
コード例 #11
0
SCREEN_WIDTH = 640
SCREEN_HEIGHT = 480

green = Color(0x00ff00, 1)
black = Color(0, 1)
noline = LineStyle(0, black)
bg_asset = RectangleAsset(SCREEN_WIDTH, SCREEN_HEIGHT, noline, green)
bg = Sprite(bg_asset, (0,0))

# A ball! This is already in the ggame-tutorials repository
ball_asset = ImageAsset("images/dog-png-29.png")
ball = Sprite(ball_asset, (0, 0))
# Sounds
pew1_asset = SoundAsset("sounds/pew1.mp3")
pew1 = Sound(pew1_asset)
pop_asset = SoundAsset("sounds/reappear.mp3")
pop = Sound(pop_asset)
dog1_asset = SoundAsset("sounds/dog-panting-breathing-fast-daniel_simon.mp3")
dog = Sound(dog1_asset)
bark_asset = SoundAsset("sounds/Dog_woof.mp3")
bark = Sound(bark_asset)
# Original image is too big. Scale it to 1/10 its original size
ball.scale = 0.3
# custom attributes
ball.dir = 1
ball.go = True
def reverse(b):
    b.dir *= -1
def step():
    if ball.go:
コード例 #12
0
 def __init__(self, position):
     super().__init__(Explosion.image, position)
     self.image = 0
     self.center = (0.5, 0.5)
     self.boom = Sound(Explosion.sound)
     self.boom.play()