Beispiel #1
0
    def __init__(self, ai_settings, screen):
        """初始化外星人并设置其起始位置"""
        super(Alien, self).__init__()
        self.screen = screen
        self.ai_settings = ai_settings

        # 加载外星人图像,并设置其rect属性
        self.image = pygame.load('image/alien.bmp')
        self.rect = self.image.get_rect()

        # 每个外星人最初都在屏幕左上角附近
        self.rect.x = self.rect.width
        self.rect.y = self.rect.height

        # 存储外形人的精确位置
        self.x - float(self.rect.x)
    def __init__(self):
        """ Constructor function """

        # Call the parent's constructor
        super().__init__()

        # -- Attributes
        self.name = "Briar"
        self.max_hit_points = 50
        self.current_hit_points = 50
        self.max_speed = 10
        self.armor_amount = 8
        self.calories = 500
        self.attack = 20

        # Set speed vector of player
        self.change_x = 0
        self.change_y = 0

        # This holds all the images for the animated walk left/right. The lists might need to be empty?
        # of our player
        self.walking_frames_l = [pygame.load('images/Characters/png/1x/hero2/WalkLeft_1.png'), pygame.load('images/Characters/png/1x/hero2/WalkLeft_2.png'), pygame.load('images/Characters/png/1x/hero2/WalkLeft_3.png'), pygame.load('images/Characters/png/1x/hero2/WalkLeft_4.png')]
        self.walking_frames_r = ['images/Characters/png/1x/hero2/WalkRight_1.png', 'images/Characters/png/1x/hero2/WalkRight_2.png', 'images/Characters/png/1x/hero2/WalkRight_3.png', 'images/Characters/png/1x/hero2/WalkRight_4.png']
        self.walking_frames_u = ['images/Characters/png/1x/hero2/WalkUp_1.png', 'images/Characters/png/1x/hero2/WalkUp_2.png','images/Characters/png/1x/hero2/WalkUp_3.png', 'images/Characters/png/1x/hero2/WalkUp_4.png' ]
        self.walking_frames_d = ['images/Characters/png/1x/hero2/WalkDown_1.png', 'images/Characters/png/1x/hero2/WalkDown_2.png', 'images/Characters/png/1x/hero2/WalkDown_3.png', 'images/Characters/png/1x/hero2/WalkDown_4.png']





        # What direction is the player facing?
        self.direction = "R"

        # List of sprites we can bump against
        self.area = None

        # Set the image the player starts with
        self.image = self.walking_frames_r[0]

        # Set a reference to the image rect.
        self.rect = self.image.get_rect()   #### Probably need to edit this now.
Beispiel #3
0
import pygame
from pygame.locals import *
pygame.init()

FPS = 30
WINDOWWIDTH = 720  # 720
WINDOWHEIGHT = 460  # 460

#COLORS
BLACK = (  0,  0,  0)
WHITE = (255,255,255)
GREEN = (  0,255,  0)

#image objects    
doorImageSurf = pygame.load('doorimage')  #문 이미지 넣을 것
item1 = pygame.load('ddd')
item2 = pygame.load('ddds')

#mapData
mapDataList = ({'ground':[(0,0),(WINDOWWIDTH,WINDOWHEIGHT*0.2)]]
                ,'item' :[((0,0),---)]  #이미지 파일 넣을것
                ,'door' :[((0,0),1)]
                ,'spawn':[(0,0)]},
               {'ground':[((0,0),(WINDOWWIDTH,WINDOWHEIGHT))]
                ,'item' :[((0,0),---)]  #이미지 파일 넣을 것
                ,'door' :[((0,0),1)]
                ,'spawn':[(0,0)]})



def main():
    def __init__(self):
        pygame.sprite.Sprite.__init__()
        self.im = pygame.load(
            pygame.image.load('персонажи/Reptile/идет/вправо/0.png'))

        self.rect = self.im.get_rect()
    def __init__(self):
        pygame.sprite.Sprite.__init__()
        self.im = pygame.load(pygame.image.load('sprite/pygame_idle.png'))

        self.rect = self.im.get_rect()
Beispiel #6
0
def load_sprites():
    sprites["wall_tile"] = pygame.load("art\\wall_tile.png")
    sprites["floor_tile"] = pygame.load("art\\floor_tile.png")
    pass
	def load_image(self, file_or_fileobj):
		self.image = pygame.load(file_or_fileobj)
Beispiel #8
0
def load_sprites():
	sprites["wall_tile"] = pygame.load("art\\wall_tile.png")	
	sprites["floor_tile"] = pygame.load("art\\floor_tile.png")
	pass