当前位置: 首页>>代码示例>>Python>>正文


Python Img.sndget方法代码示例

本文整理汇总了Python中Img.sndget方法的典型用法代码示例。如果您正苦于以下问题:Python Img.sndget方法的具体用法?Python Img.sndget怎么用?Python Img.sndget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Img的用法示例。


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

示例1: Tool

# 需要导入模块: import Img [as 别名]
# 或者: from Img import sndget [as 别名]
'''
Created on 24 Jun 2015

@author: NoNotCar
'''
import Img
import pygame

destsound=Img.sndget("explode.wav")
class Tool(object):
    img=Img.blank32
    def use(self,x,y,world,p):
        pass
class Axe(Tool):
    img=Img.imgret2("Axe.png")
    def use(self,x,y,world,p):
        if world.get_obj(x,y):
            return world.get_obj(x,y).cut(world)
class Wrench(Tool):
    img=Img.imgret2("Wrench.png")
    def use(self,x,y,world,p):
        kmods=pygame.key.get_mods()
        if world.get_obj(x,y):
            if kmods & pygame.KMOD_LSHIFT:
                world.get_obj(x,y).rotate()
                return True
            elif kmods & pygame.KMOD_LCTRL:
                world.get_obj(x,y).wrench(world)
                return True
            elif world.get_obj(x,y).is_owner(p):
                world.dest_obj(x,y)
开发者ID:Nouranium,项目名称:Monolith,代码行数:33,代码来源:Tools.py

示例2: GhostSpawner

# 需要导入模块: import Img [as 别名]
# 或者: from Img import sndget [as 别名]
        return self.eimgs[self.timer//3%2]
class GhostSpawner(Object):
    img=Img.imgsz("GhostSpawn",(32,40))
    time=60
    def update(self,world):
        if not self.time:
            dirs=[[1,0],[0,1],[-1,0],[0,-1]]
            shuffle(dirs)
            for dx,dy in dirs:
                if world.is_clear(self.x+dx,self.y+dy):
                    world.e.append(Entities.Ghost(self.x+dx,self.y+dy))
                    break
            self.time=randint(120,360)
        else:
            self.time-=1
shot=Img.sndget("Gun")
class CannonBlock(Object):
    destructible = False
    img=Img.img2("CannonBlock")
    def __init__(self,x,y):
        self.x=x
        self.y=y
        self.time=randint(60,120)
    def update(self,world):
        if not self.time:
            p=world.get_p(self.x,self.y)
            if p.x<self.x:
                world.e.append(Entities.CannonBall(self.x,self.y,-1))
                shot.play()
            elif p.x>self.x:
                world.e.append(Entities.CannonBall(self.x,self.y,1))
开发者ID:NoNotCar,项目名称:BombAdventures,代码行数:33,代码来源:Object.py

示例3: MechCategory

# 需要导入模块: import Img [as 别名]
# 或者: from Img import sndget [as 别名]
import Forestry
import Vehicles
import Img
import Power
import UM
import Robotics
import Crafting

pygame.init()
loc = os.path.dirname(os.getcwd()) + "/Assets/"
imgconv = "u", "l", "", "r"
colinpl = (255, 0, 0), (0, 255, 0), (0, 0, 255), (0, 255, 255), (255, 0, 255), (255, 255, 0), (0, 0, 0), (255, 255, 255)
hdirconv = {(0, -1): 0, (-1, 0): 1, (0, 1): 2, (1, 0): 3}
ps2map = [2, 1, 5, 6, 7, 0, 4, 9]
xboxmap = [0, 1, 2]
picksound = Img.sndget("Randomize2.wav")
sellsound = Img.sndget("Pickup_Coin.wav")


class MechCategory(object):
    img = Img.imgret2("Gear.png")
    iscat = True
    doc = "Tech stuff"

    def __init__(self):
        self.menu = [Buyers.CRotObjBuyer(Mech.SlowConv), Buyers.RotObjBuyer(Mech.Conv, 100),
                     Buyers.RotObjBuyer(Mech.RainConv, 1000),
                     Buyers.RotObjBuyer(Mech.DownTunnel, 200), Buyers.RotObjBuyer(Mech.DownTunnelL, 1000),
                     Buyers.RotObjBuyer(Mech.UpTunnel, 500),
                     Buyers.RotObjBuyer(Mech.Output, 100), Buyers.RotObjBuyer(Mech.Output2, 200),
                     Buyers.ObjBuyer(Mech.Input, 100), Buyers.RotObjBuyer(Mech.IOput, 300),
开发者ID:NoNotCar,项目名称:monolith,代码行数:33,代码来源:Players.py

示例4: World

# 需要导入模块: import Img [as 别名]
# 或者: from Img import sndget [as 别名]
import Pipe
import PipeGen
import Img
import pygame
import sys
import Direction as D
import random
pfill=Img.sndget("fill")
bfill=Img.sndget("bonus")
exp=Img.sndget("explode")
bexp=Img.sndget("bigexp")
success=Img.sndget("win")
build=Img.sndget("build")
alarm=Img.sndget("alarm")
pdf=pygame.font.get_default_font()
tfont=pygame.font.Font(pdf,32)
bfont=pygame.font.Font(pdf,64)
floors=[[Img.img32("Floor"),Img.img32("FloorFixed")],[Img.img32("EFloor"),Img.img32("EFloorFixed")]]
tt=Img.img("TileTab")
sel=Img.img32("Sel")
editorclasses=[Pipe.Source,Pipe.Drain,Pipe.Block,Pipe.GoldPipe,Pipe.SPipe,Pipe.BPipe,Pipe.XPipe,Pipe.X2Pipe,Pipe.OWPipe,
               Pipe.Resevoir,Pipe.TeleportB,Pipe.TeleportO,Pipe.OPipe]
class World(object):
    size=(13,13)
    score=0
    ttgo=3660
    ttflow=0
    fx=0
    fy=0
    nd=(0,1)
    done=False
开发者ID:NoNotCar,项目名称:OpenPipes,代码行数:33,代码来源:World.py

示例5: bombattack

# 需要导入模块: import Img [as 别名]
# 或者: from Img import sndget [as 别名]
from Entities import *
import FX
import Img
import Object
missile=Img.sndget("Expmiss")
laugh=Img.sndget("bosslaugh")
tp=Img.sndget("teleport")
def bombattack(world,ssize):
    while True:
        tx=randint(9-ssize,9+ssize)
        ty=randint(9-ssize,9+ssize)
        if world.is_clear(tx,ty):
            bomb=Bomb(tx,ty,2)
            bomb.timer=60
            world.e.append(bomb)
            break
def missileattack(world,ssize):
    while True:
        tx=randint(9-ssize,9+ssize)
        ty=randint(9-ssize,9+ssize)
        if world.is_clear(tx,ty):
            m=FX.Missile(tx*32,-48-(19-ty)*32,ty*32)
            world.fx.append(m)
            world.fx.append(FX.MissileTarget(tx*32,ty*32,m))
            missile.play()
            break
class BGhost(Ghost):
    imgs = imgstrip("BossGhost1")
    aimgs = imgstrip("BossGhost2")
    img = imgs[0]
    hp = 5
开发者ID:NoNotCar,项目名称:BombAdventures,代码行数:33,代码来源:Bosses.py

示例6: World

# 需要导入模块: import Img [as 别名]
# 或者: from Img import sndget [as 别名]
__author__ = 'NoNotCar'
import Img, Entities, Tiles, Object, FX, pygame
from random import randint
import BattlePlayers

powerup = Img.sndget("powerup")
exp = Img.sndget("explode")


class World(object):
    pconv=[BattlePlayers.Player,BattlePlayers.FatPlayer,BattlePlayers.SmallPlayer,BattlePlayers.ThinPlayer,BattlePlayers.CrazyPlayer]
    rtime=0
    rumbling=0
    def __init__(self, level, players,controllers):
        self.done = False
        self.level = level
        self.exitcode="NORMAL"
        self.e = []
        self.ps=[]
        savfile = open(Img.np("lvls//battle//"+level), "r")
        self.t = []
        self.o = []
        self.fx = []
        self.bfx = []
        pn=0
        savr = savfile.readlines()
        for row in savr[:20]:
            self.t.append([int(s) for s in row.split()])
        for x, row in enumerate(savr[20:]):
            self.o.append([None] * 20)
            crow = [int(s) for s in row.split()]
开发者ID:NoNotCar,项目名称:BombAdventures,代码行数:33,代码来源:BattleWorld.py

示例7: SquishyThing

# 需要导入模块: import Img [as 别名]
# 或者: from Img import sndget [as 别名]
'''
Created on 26 Aug 2015

@author: Thomas
'''
import Entity
import Img
sqsnd=Img.sndget("squish")
class SquishyThing(Entity.Entity):
    dire="L"
    img=Img.img2("Squishy")
    fimg=Img.hflip(img)
    solid=True
    s="Sq"
    def get_img(self,world):
        return self.img if self.dire=="L" else self.fimg
    def update(self, world, events):
        if not self.move(0, 1, world):
            dx=1 if self.dire=="R" else -1
            if not self.move(dx, 0, world):
                self.dire="L" if self.dire=="R" else "R"
    def squish(self, player, world):
        world.dest_obj(self)
        sqsnd.play()
class SquishyClever(SquishyThing):
    img=Img.img2("SquishyGreen")
    fimg=Img.hflip(img)
    s="SqC"
    def update(self, world, events):
        if not self.move(0, 1, world):
            dx=1 if self.dire=="R" else -1
开发者ID:NoNotCar,项目名称:jump,代码行数:33,代码来源:Enemies.py

示例8: makenoise

# 需要导入模块: import Img [as 别名]
# 或者: from Img import sndget [as 别名]
from math import ceil
bnoise=None
bnoise2=None
tnoise=None
def makenoise():
    global bnoise,bnoise2
    bnoise=perlin.SimplexNoise(256)
    bnoise2=perlin.SimplexNoise(256)
    global tnoise
    tnoise=perlin.SimplexNoise(256)
cashfont=Img.fload("cool",32)
bscale=128.0
b2scale=160.0
bcfont=Img.fload("cool",64)
threshold=1.2
exp=Img.sndget("bomb")
def ir(n):
    return int(round(n))
numerals=Img.imgstripxf("Numbers",5)+[Img.imgx("Ten")]
scales=[16,32,48,64]
class World(object):
    is_done=False
    winner=None
    invscale=3
    wscale=2
    def __init__(self,ps):
        hs=HomeSector(self,0,0,ps)
        self.ps=ps
        self.w={(0,0):hs}
    def update(self,events):
        for s in [s for s in self.w.itervalues()]:
开发者ID:NoNotCar,项目名称:TrapDungeon,代码行数:33,代码来源:World.py


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