當前位置: 首頁>>代碼示例>>Python>>正文


Python Img.img2方法代碼示例

本文整理匯總了Python中Img.img2方法的典型用法代碼示例。如果您正苦於以下問題:Python Img.img2方法的具體用法?Python Img.img2怎麽用?Python Img.img2使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Img的用法示例。


在下文中一共展示了Img.img2方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1:

# 需要導入模塊: import Img [as 別名]
# 或者: from Img import img2 [as 別名]
__author__ = 'NoNotCar'
import pygame, sys
pygame.init()
screen = pygame.display.set_mode((640, 704))
import World
import Tiles
import Img

clock = pygame.time.Clock()
selmenu=0
selobjs=[0 for _ in Tiles.tilemenus+Tiles.objmenus]
w=World.World(True)
expimg=Img.img2("Exp")
pexpimg=Img.img2("ExpPen")
bombimg=Img.img2("Bomb")
while True:
    kmods=pygame.key.get_mods()
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            sys.exit()
        elif event.type==pygame.KEYDOWN and event.key==pygame.K_s and kmods&pygame.KMOD_LCTRL:
            w.save()
            print "SAVED"
        elif event.type==pygame.KEYDOWN:
            menus=Tiles.tilemenus+Tiles.objmenus
            menu=menus[selmenu]
            if event.key==pygame.K_w:
                selobjs[selmenu]=(selobjs[selmenu]-1)%len(menu)
            elif event.key==pygame.K_s:
                selobjs[selmenu]=(selobjs[selmenu]+1)%len(menu)
            elif event.key==pygame.K_a:
開發者ID:NoNotCar,項目名稱:BombAdventures,代碼行數:33,代碼來源:editor.py

示例2: World

# 需要導入模塊: import Img [as 別名]
# 或者: from Img import img2 [as 別名]
import Img


class World(object):
    def __init__(self, txt, mus, back, load):
        self.textures = txt
        self.music = mus
        self.back = back
        self.loadcolour = load


worlds = [World([Img.img2("Grass"), Img.img2("Block"), Img.img2("Grass2")], "forbidden", (125, 255, 255), (125, 225, 0)),
          World([Img.img2("Snow"), Img.img2("CastleBlock"), Img.img2("FrozenIn")], "Chr", (240, 240, 240),
                (255, 255, 255)),
          World([Img.img2("Spacefloor"), Img.img2("CastleBlock"), Img.img2("CastleIn")], "Space", (0, 0, 0),
                (50, 50, 50)),
          World([Img.img2("Sand"), Img.img2("Block"), Img.img2("CastleInGrey"), Img.img2("Oil")], "Desert",
                (181, 117, 0), (250, 250, 0)),
          World([Img.img2("Spacefloor"), Img.img2("PuzzBlockDest"), Img.img2("PuzzBlock"),Img.img2("IceSpace")], "ChOrDs", (255, 255, 255),
                (255, 255, 255)),
          World([Img.img2("RockSnow"), Img.img2("RedBlock"), Img.img2("CastleIn"), Img.img2("RockIce")], "Volcanic",
                (255, 93, 0), (200, 59, 0)),
          World([Img.img2("PinkGround"), Img.img2("PinkBlock"), Img.img2("Pink2"), Img.img2("PinkIce")], "DOMINIK_4", (255, 186, 245),
                (255, 81, 226)),
          World([Img.img2("RedGrass"), Img.img2("RedBlock"), Img.img2("CastleIn"), Img.img2("RockIce")], "Devil",
                (84, 2, 0), (133, 5, 1))]
castle = World([Img.img2("CastleFloor"), Img.img2("CastleBlock"), Img.img2("CastleIn")], "boss", (125, 125, 125),
               (200, 200, 200))
final1=World([Img.img2("Grass"), Img.img2("Flowers"), Img.img2("Tree")], "forbidden", (125, 255, 255), (125, 225, 0))
final2=World([Img.img2("EndFloor"), Img.img2("EndBrick"), Img.img2("EndBlock")], "boss", (0, 0, 0),
                (50, 50, 50))
開發者ID:NoNotCar,項目名稱:BombAdventures,代碼行數:33,代碼來源:Worlds.py

示例3:

# 需要導入模塊: import Img [as 別名]
# 或者: from Img import img2 [as 別名]
__author__ = 'NoNotCar'
import pygame, sys, os
pygame.init()
pygame.font.init()
screen = pygame.display.set_mode((640, 704))
import BattleWorld, Img
from random import choice
import Controllers

pdf = pygame.font.get_default_font()
tfont=pygame.font.Font(pdf,60)
sfont=pygame.font.Font(pdf,20)
clock = pygame.time.Clock()
expimg=Img.img2("Exp")
pexpimg=Img.img2("ExpPen")
bombimg=Img.img2("Bomb")
tickimg=Img.img2("Tick")
crossimg=Img.img2("Null")
pimgs=[Img.img2("men/"+x) for x in ["Man2","FMan","SMan","Tman"]]#+[Img.imgstrip("men/CMan")[0]]
breaking = False
Img.musplay("ChOrDs.ogg")
while not breaking:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            sys.exit()
        elif event.type == pygame.MOUSEBUTTONDOWN:
            breaking = True
    screen.fill((255, 0, 0))
    Img.bcentre(tfont,"BOMB BATTLES",screen)
    Img.bcentre(sfont,"Click to start",screen,50)
    pygame.display.flip()
開發者ID:NoNotCar,項目名稱:BombAdventures,代碼行數:33,代碼來源:battle.py

示例4: Grass

# 需要導入模塊: import Img [as 別名]
# 或者: from Img import img2 [as 別名]
    Grass(),
    Goal(),
    Ice(),
    SokoHole(),
    SokoHoleFilled(),
    SokoPlate(),
    SokoPlateAct(),
    BonusGoal(),
    WarpGoal(),
    ManPlate(),
    ManPlateAct(),
    DarkMatter(),
)
eobjs = (
    (
        (Img.img2("Block"), 1),
        (Img.imgstrip("Ghost")[0], 0),
        (Img.img2("Men/Man2"), 0),
        (Img.imgstrip2("Thud")[0], 0),
        (Img.img32("RangeUp"), 0),
        (Img.img2("Grass2"), 1),
        (Img.imgstrip("FGhost")[0], 0),
        (Img.img2("SokoBlok"), 0),
        (Img.img2("SokoLok"), 1),
        (Img.img2("ExpBlock"), 1),
        (Img.img2("Pen"), 0),
        (Img.img2("ExBomb"), 0),
        (Img.imgsz("GhostSpawn", (32, 40)), 1),
        (Img.imgstrip2("Slime")[0], 0),
        (Img.img2("CannonBlock"), 1),
        (Img.img2("Men/SMan"), 0),
開發者ID:NoNotCar,項目名稱:BombAdventures,代碼行數:33,代碼來源:Tiles.py


注:本文中的Img.img2方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。