Exemplo n.º 1
0
 def LoadAssets():
     if(Enemy._SURFACES is None):
         Enemy._SURFACES = [
             assets.load_image("Food.png"  ),
             assets.load_image("Caught.png"),
             assets.load_image("Bomb.png"  )
         ];
Exemplo n.º 2
0
	def __init__(self, root, package_root, json_dict):
		self.cost=json_dict["cost"]
		self.id=json_dict["id"]
		self.name=json_dict["name"]
		self.inventory_image=assets.load_image(package_root, json_dict["inventory_image"])
		self.equipped_image=assets.load_image(package_root, json_dict["equipped_image"])
		self.mass=json_dict["mass"]
		self.hardpoint=json_dict["mount_type"]
		self.rarity=rarity.Rarity(json_dict["rarity"])
		self.fire_required=json_dict["required"]
		self.passive_equip=json_dict["equip"]
		self.passive_dequip=json_dict["dequip"]
		self.fire_events=json_dict["fire_events"]
		self.root=root
Exemplo n.º 3
0
    def __init__(self):
        director.set_clear_color(COLOR_WHITE);

        ## Logo
        self._logo     = assets.load_image("AmazingCow_Logo_Big.png");
        logo_size      = self._logo.get_size();
        self._logo_pos = (GAME_WIN_CENTER_X - logo_size[0] * 0.5,
                          GAME_WIN_CENTER_Y - logo_size[1]); ## A bit above center

        ## Text
        self._text = Text(FONT_NAME, FONT_SIZE + 15,
                         -1, -1,  ## Dummy values.
                         "amazingcow", COLOR_BLACK);
        text_size = self._text.get_size();
        self._text.set_position(
            GAME_WIN_WIDTH  * 0.5 - text_size[0] * 0.5,
            self._logo_pos[1] + logo_size[1] + 20,
        );

        ## Timer
        self._timer = CowClock(0.4, 5, self._on_timer_tick, self._on_timer_done);
        self._timer.start();

        ## Others
        self._curr_rgb = list(COLOR_WHITE);
        self._dst_rgb  = (random.randint(0, 255),
                          random.randint(0, 255),
                          random.randint(0, 255));

        self._update_colors = False;
Exemplo n.º 4
0
    def LoadAssets():
        if(Taz._FRAMES is not None):
            return;

        Taz._FRAMES = [];
        for i in xrange(0, Taz._FRAMES_COUNT):
            Taz._FRAMES.append(assets.load_image("TazFrame%d.png" %(i)));
Exemplo n.º 5
0
    def __init__(self):
        director.set_clear_color(COLOR_WHITE)

        ## Logo
        self._logo = assets.load_image("AmazingCow_Logo_Big.png")
        logo_size = self._logo.get_size()
        self._logo_pos = (GAME_WIN_WIDTH * 0.5 - logo_size[0] * 0.5,
                          GAME_WIN_HEIGHT * 0.5 - logo_size[1])
        ## A bit above center

        ## Text
        self._text = Text(
            FONT_NAME,
            FONT_SIZE + 15,
            -1,
            -1,  ## Dummy values.
            "amazing cow labs",
            COLOR_BLACK)
        text_size = self._text.get_size()
        self._text.set_position(
            GAME_WIN_WIDTH * 0.5 - text_size[0] * 0.5,
            self._logo_pos[1] + logo_size[1] + 20,
        )

        ## Timer
        self._timer = CowClock(0.4, 5, self._on_timer_tick,
                               self._on_timer_done)
        self._timer.start()

        ## Others
        self._curr_rgb = list(COLOR_WHITE)
        self._dst_rgb = (random.randint(0, 255), random.randint(0, 255),
                         random.randint(0, 255))

        self._update_colors = False
Exemplo n.º 6
0
    def __init__(self, suie_context):
        self.suie_context = suie_context
        self.background = suie.Image(assets.load_image('backgrounds.forestSunset', 'png'),
                                     (0, 0),
                                     (self.suie_context.screen_width, self.suie_context.screen_height))

        self.test_rect = suie.Rectangle((10, 10), (100, 100), fill_color=(255, 0, 0))
Exemplo n.º 7
0
    def __init__(self):
        pipe_size = (8, PLAYFIELD_BOTTOM - PLAYFIELD_TOP + ENEMY_SPACING)

        ## Surface
        self.top_surface = assets.load_image("playfield_top.png")
        self.bottom_surface = pygame.transform.flip(self.top_surface, False,
                                                    True)
        self.pipe_surface = pygame.Surface(pipe_size)
        self.side_surface = pygame.Surface(
            (self.top_surface.get_height(),
             (PLAYFIELD_BOTTOM - PLAYFIELD_TOP) + ENEMY_SPACING))

        ## Position
        wcenter = GAME_WIN_WIDTH * 0.5
        top_surface_width = self.top_surface.get_width()
        top_surface_center = top_surface_width * 0.5
        top_surface_height = self.top_surface.get_height()

        self.top_pos = (wcenter - top_surface_center,
                        PLAYFIELD_TOP - top_surface_height - ENEMY_SPACING)

        self.bottom_pos = (wcenter - top_surface_center, PLAYFIELD_BOTTOM)

        self.pipe_pos = (wcenter - self.pipe_surface.get_width() / 2 + 3,
                         PLAYFIELD_TOP - ENEMY_SPACING)

        self.lside_pos = (self.top_pos[0],
                          self.top_pos[1] + top_surface_height)
        self.rside_pos = (self.top_pos[0] + top_surface_width -
                          top_surface_height,
                          self.top_pos[1] + top_surface_height)

        ## Colorize the surfaces.
        self.pipe_surface.fill(COLOR_PIPE)
        self.side_surface.fill(COLOR_PLAYFIELD)
Exemplo n.º 8
0
    def __init__(self):
        #Surface
        self.left_surface  = assets.load_image("cannon.png");
        self.right_surface = pygame.transform.flip(self.left_surface, True, False);
        self.surface       = self.left_surface;

        ## Pos / Size
        self.width  = self.surface.get_width ();
        self.height = self.surface.get_height();

        self.x = PLAYER_START_X - (self.width / 2);
        self.y = (PLAYFIELD_TOP + (PLAYFIELD_BOTTOM - self.height)) / 2;

        ## Movement
        self.speed = 0;

        self.min_y = PLAYFIELD_TOP;
        self.max_y = PLAYFIELD_BOTTOM - self.height;

        ## Cannon
        self.cannon_offset    = (self.width / 2, self.height / 2);
        self.cannon_direction = DIRECTION_LEFT;

        ## HouseKeeping
        self.should_shoot = False;
Exemplo n.º 9
0
    def __init__(self):
        director.set_clear_color(COLOR_BLACK);

        wcenter = (GAME_WIN_WIDTH * 0.5);

        ## RamIt Logo.
        self._ram_it_logo      = assets.load_image("RamIt_Logo.png");
        self._ram_it_logo_size = self._ram_it_logo.get_size();
        self._ram_it_logo_pos  = (wcenter - (self._ram_it_logo_size[0] * 0.5),
                                  150);

        ## Play
        self._play_text = Text(FONT_NAME, 40, -1, -1, "Play");
        play_size = self._play_text.get_size();
        self._play_text.set_position(wcenter - (play_size[0] * 0.5),
                                      250);

        ## Credits
        self._credits_text = Text(FONT_NAME, 40, -1, -1, "Credits");
        credits_size = self._credits_text.get_size();
        self._credits_text.set_position(wcenter - (credits_size[0] * 0.5),
                                        350);

        ## AmazingCow
        self._amazingcow_text = Text(FONT_NAME, FONT_SIZE, -1, -1, "amazingcow - 2016");
        amazing_size = self._amazingcow_text.get_size();
        self._amazingcow_text.set_position(wcenter - (amazing_size[0] * 0.5),
                                           GAME_WIN_HEIGHT - (amazing_size[1] + 20));

        ## Selection
        self._curr_selection = -1;
        self._update_selection(1, play_sound = False); ## Force the blinking on play...
Exemplo n.º 10
0
 def __init__(self):
     pygame.sprite.Sprite.__init__(self)
     self.rect=Rect(0,0,96,96)
     self.original= load_image("oyente%d.png" % (1+randrange(5)) )
     self.image = self.original
     self.state= OYENTE_DESPIERTO
     self.renderState()
     self.onScoreTick = None
Exemplo n.º 11
0
    def __init__(self):
        ##
        director.set_clear_color(COLOR_WHITE);

        ## Logo
        self.logo     = assets.load_image("AmazingCow_Logo_Small.png");
        logo_size     = self.logo.get_size();
        self.logo_pos = ((GAME_WIN_WIDTH * 0.5) - (logo_size[0] * 0.5), 15);

        color_surface(
            self.logo,
            director.randint(0, 255),
            director.randint(0, 255),
            director.randint(0, 255)
        );


        ## Message
        msg = [
            "This remake was made with <3 by Amazing Cow.",
            "We hope that you enjoy this little game (!)"
            "",
            "We have other projects at:",
            "www.amazingcow.com",
            "",
            "This game is entirely FREE SOFTWARE",
            "This means that you're welcome to",
            "SHARE and HACK IT (!!!)",
            "",
            "You can find the sources at:",
            "opensource.amazingcow.com",
            "",
            "Dev / Graphics / Sound by N2OMatt",
            "",
            "THANKS FOR PLAYING...",
            "",
            "The CCV helps people not commit suicide.",
            "Their work is very, very important.",
            "Why don't you help them?",
            "www.cvv.org.br"
        ];

        self.texts   = [];
        start_offset = self.logo_pos[1] + logo_size[1] + 5;
        line_offset  =  16;

        for i in xrange(0, len(msg)):
            text = Text("SourceCodePro-Regular.ttf", line_offset,
                        -1, -1,
                        msg[i], COLOR_BLACK);
            text_size = text.get_size();

            text.set_position(
                (GAME_WIN_WIDTH * 0.5) - (text_size[0] * 0.5),
                start_offset + (i * line_offset)
            );

            self.texts.append(text);
Exemplo n.º 12
0
    def __init__(self):
        director.set_clear_color(COLOR_BLACK)

        ## Housekeeping
        self._game_state = GameScene._STATE_PLAYING

        ## Game Field
        self._game_field = assets.load_image("GameField.png")
        game_field_size = self._game_field.get_size()
        self._game_field_pos = [
            GAME_WIN_CENTER_X - game_field_size[0] * 0.5,
            GAME_WIN_CENTER_Y - game_field_size[1] * 0.5,
        ]

        game_field_size = self._game_field.get_size()

        ## Taz Min
        taz_field_min = copy.deepcopy(self._game_field_pos)
        taz_field_min[0] += GameScene._TAZ_X_OFFSET
        taz_field_min[1] += GameScene._TRACK_OFFSET
        ## Taz Max
        taz_field_max = copy.deepcopy(self._game_field_pos)
        taz_field_max[0] += game_field_size[0] - GameScene._TAZ_X_OFFSET
        taz_field_max[1] += game_field_size[1] - GameScene._TRACK_OFFSET

        ## Enemy Min
        enemy_field_min = copy.deepcopy(self._game_field_pos)
        enemy_field_min[1] += GameScene._TRACK_OFFSET
        ## Enemy Max
        enemy_field_max = copy.deepcopy(self._game_field_pos)
        enemy_field_max[0] += game_field_size[0] - GameScene._TAZ_X_OFFSET
        enemy_field_max[1] += game_field_size[1]

        ## Taz
        self._taz = Taz(
            min_bounds=taz_field_min,
            max_bounds=taz_field_max,
            tracks_count=GameScene._TRACKS_COUNT,
            track_offset=GameScene._TRACK_OFFSET,
            is_playable=True,
            dead_animation_callback=self._on_taz_dead_animation_done,
        )

        ## Enemies
        self._enemies = []
        for i in xrange(0, GameScene._TRACKS_COUNT):
            self._enemies.append(
                Enemy(
                    min_bounds=enemy_field_min,
                    max_bounds=enemy_field_max,
                    tracks_count=GameScene._TRACKS_COUNT,
                    track_offset=GameScene._TRACK_OFFSET,
                    track_index=i,
                )
            )

        ## Hud
        self._hud = Hud(taz_field_min, taz_field_max)
Exemplo n.º 13
0
 def __init__(self):
     #setup
     pygame.init()
     pygame.font.init()
     self.font = pygame.font.Font(None,24)
     self.fontColor = (0,0,0)
     pygame.mixer.init()
     pygame.display.set_mode(SCREEN)
     pygame.display.set_caption('#ElJuegoDeLasJoincic')
     self.screen = pygame.display.get_surface()
     
     self._quit=False
     self.clock = pygame.time.Clock()
     self.controller= Controller()
     self.background = load_image("background.png")
     self.menu_background = load_image("menu_background.png")
     self.menu_iniciar = load_image("menu_iniciar.png")
     self.menu_salir = load_image("menu_salir.png")
     
     self.gameover = load_image("gameover.png")
     self.cursor = load_image("cursor.png")
     self.arrow = load_image("arrow.png")
     self.player = Player()
     self.group = Group()
     self.protocolo = Protocolo()
     self.group.add(self.player)
     
     self.groupOyentes = Group()
     self.groupTakitos = Group()
     self.groupHUD = Group()
     self.state= GAME_INIT
Exemplo n.º 14
0
 def __init__(self, position, size, bar_color):
     Element.__init__(self, position)
     self.color = bar_color
     self.size = size
     self._fill = 1.0
     self._target_fill = 1.0
     self._image = pygame.Surface((size[0], size[1]), pygame.SRCALPHA, 32)
     self._render()
     self._bar_image = assets.load_image(BAR_IMAGE_SOURCE[self.color])
Exemplo n.º 15
0
    def __init__(self):
        ##
        director.set_clear_color(COLOR_WHITE);

        ## Logo
        self.logo     = assets.load_image("AmazingCow_Logo_Small.png");
        self.logo_pos = ((GAME_WIN_WIDTH * 0.5) - (self.logo.get_width() * 0.5),
                         20);

        color_surface(
            self.logo,
            random.randint(0, 255),
            random.randint(0, 255),
            random.randint(0, 255)
        );


        ## Message
        msg = [
            "This remake was made with <3 by Amazing Cow Labs.",
            "We hope that you enjoy this little game (!)"
            "",
            "We have other projects at:",
            "www.amazingcow.com",
            "Take a look :)",
            "",
            "This game is entirely FREE SOFTWARE",
            "This means that you're welcome to",
            "SHARE and HACK IT (!!!)",
            "",
            "You can find the sources at:",
            "opensource.amazingcow.com",
            "",
            "Dev / Graphics / Sound by N2OMatt",
            "","",
            "THANKS FOR PLAYING..."
            "", "", "",
            "APAE do a wonderful job helping exceptional people",
            "Why you don't look and help their work? <3",
            "www.apaebrasil.org.br"
        ];

        self.texts   = [];
        start_offset = 140;
        line_offset  =  20;

        for i in xrange(0, len(msg)):
            text      = Text("SourceCodePro-Regular.ttf", 20, -1, -1, msg[i], COLOR_BLACK);
            text_size = text.get_size();

            text.set_position(
                (GAME_WIN_WIDTH * 0.5) - (text_size[0] * 0.5),
                start_offset + (i * line_offset)
            );

            self.texts.append(text);
Exemplo n.º 16
0
 def __init__(self,x,y,force,angle):
     pygame.sprite.Sprite.__init__(self)
     
     self.speed= MAX_SPEED  * (1+force)
     self.velocity=(self.speed* math.cos(float(angle)/180*math.pi) ,
                    -self.speed* math.sin(float(angle)/180*math.pi) )  
     
     self.image= load_image("takito.png"  )
     
     self.rect=Rect(x,y,self.image.get_width(),self.image.get_height())
Exemplo n.º 17
0
    def __init__(self):
        director.set_clear_color(COLOR_WHITE);

        wcenter = (GAME_WIN_WIDTH * 0.5);

        ## Logo
        self._logo     = assets.load_image("Taz_Logo.png");
        logo_size      = self._logo.get_size();
        self._logo_pos = (wcenter - (logo_size[0] * 0.5), 20);

        ########################################################################
        ## COWTODO: WE REALLY NEED TO IMPROVE THE INTERFACE                   ##
        ## FOR CREATE AND SETUP TEXTS... IT SUCKS A LOT TODAY...              ##
        ########################################################################
        ## Play
        self._play_text = Text(FONT_NAME, FONT_MENU_SIZE,
                               -1, -1,
                               "Play", COLOR_BROWN);
        play_size = self._play_text.get_size();
        self._play_text.set_position(wcenter - (play_size[0] * 0.5), 300);

        ## Credits
        self._credits_text = Text(FONT_NAME, FONT_MENU_SIZE,
                                  -1, -1,
                                  "Credits", COLOR_BROWN);
        credits_size = self._credits_text.get_size();
        self._credits_text.set_position(wcenter - (credits_size[0] * 0.5), 360);

        ## AmazingCow
        self._amazingcow_text = Text(FONT_NAME, FONT_MENU_LOGO_SIZE,
                                     -1, -1, "amazingcow - 2016",
                                     COLOR_BROWN);
        amazing_size = self._amazingcow_text.get_size();
        self._amazingcow_text.set_position(wcenter - (amazing_size[0] * 0.5),
                                           GAME_WIN_HEIGHT - (amazing_size[1] + 10));

        ## Selection
        self._curr_selection = -1;
        self._update_selection(1, play_sound = False); ## Force the blinking on play...
Exemplo n.º 18
0
    def __init__(self):
        pipe_size = (8, PLAYFIELD_BOTTOM - PLAYFIELD_TOP + ENEMY_SPACING);

        ## Surface
        self.top_surface    = assets.load_image("playfield_top.png");
        self.bottom_surface = pygame.transform.flip(self.top_surface, False, True);
        self.pipe_surface   = pygame.Surface(pipe_size);
        self.side_surface   = pygame.Surface((
                                    self.top_surface.get_height(),
                                    (PLAYFIELD_BOTTOM - PLAYFIELD_TOP) + ENEMY_SPACING
                              ));

        ## Position
        wcenter            = GAME_WIN_WIDTH * 0.5;
        top_surface_width  = self.top_surface.get_width();
        top_surface_center = top_surface_width * 0.5;
        top_surface_height = self.top_surface.get_height();

        self.top_pos = (wcenter - top_surface_center,
                        PLAYFIELD_TOP - top_surface_height - ENEMY_SPACING);

        self.bottom_pos = (wcenter - top_surface_center,
                           PLAYFIELD_BOTTOM);

        self.pipe_pos = (wcenter - self.pipe_surface.get_width() / 2 + 3,
                         PLAYFIELD_TOP - ENEMY_SPACING);

        self.lside_pos = (self.top_pos[0],
                          self.top_pos[1] + top_surface_height);
        self.rside_pos = (self.top_pos[0] + top_surface_width - top_surface_height,
                          self.top_pos[1] + top_surface_height);


        ## Colorize the surfaces.
        self.pipe_surface.fill(COLOR_PIPE);
        self.side_surface.fill(COLOR_PLAYFIELD);
Exemplo n.º 19
0
 def renderState(self):
     self.image = self.original.copy()
     if self.state != OYENTE_NORMAL:
         self.image.blit(load_image("state_%s.png" %  ESTADOS_NOMBRE[self.state]  ), (0,0))
Exemplo n.º 20
0
Arquivo: main.py Projeto: Sk00g/arena
import assets
from suie import SuieContext
from scenes import GameScene, SetupScene
from pygame.locals import *

SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600

# Initialize pygame display
pygame.init()
pygame.display.set_caption('Arena')
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
clock = pygame.time.Clock()

# Initialize global suie context (singleton)
suie_context = SuieContext(assets.load_image('ui.suiSource', 'png'),
                           SCREEN_WIDTH, SCREEN_HEIGHT, 'emulogic', 12)

# Initialize game by creating our first game scene (automatic load to GameScene static_stack)
first_scene = SetupScene(suie_context)

while True:
    # Gather keyboard and mouse events since the previous loop
    event_list = pygame.event.get()

    # Universal quit functions for convenience -- DEBUG ONLY!
    for event in event_list:
        if event.type == QUIT or (event.type == KEYDOWN
                                  and event.key == K_ESCAPE):
            sys.exit()
Exemplo n.º 21
0
 def __init__(self):
     pygame.sprite.Sprite.__init__(self)
     self.rect=Rect(88,0,96,96)
     self.original= load_image("protocolo.png")
     self.image = self.original
     self.direction = 1
Exemplo n.º 22
0
 def __init__(self):
     pygame.sprite.Sprite.__init__(self)
     self.image= load_image("player.png")
     self.rect=Rect(RECT_ESTRADO.w/2-self.image.get_width()/2,RECT_ESTRADO.h-self.image.get_width(),self.image.get_width(),self.image.get_height())
     self.arrow_angle=0
     self.force=0