Exemplo n.º 1
0
        self.pos[1] += self.jump_speed
        self.jump_speed += 0.4
        
        # If we're at ground level, stop.
        if self.pos[1] > 192:
            self.pos[1] = 192
            self.jump_speed = 0
        
        # Keep the player in-bounds
        if self.pos[0] < 0:
            self.pos[0] = 0
        if self.pos[0] > 240:
            self.pos[0] = 240

# Initalise the display
display.init(scale=2.0, caption="NES Demo", res=NESRES)
player = Player() # Create the player

# Create a font
nesfont = font.Font(NES_FONT, (255, 255, 255))

dialogbox = dialog.DialogBox((240, 51), (0, 0, 0), 
    (255, 255, 255), nesfont)
dialogbox.set_dialog([
"This is a dialog box! Press the a button to go to the next page.", 
"Press it again and this box will close."])
menu = dialog.Menu(nesfont, ["Close", "Pause", "Exit"])
#dialogbox.close()

while 1:
    
Exemplo n.º 2
0
        self.jump_speed += 0.4

        # If we're at ground level, stop.
        if self.pos[1] > 192:
            self.pos[1] = 192
            self.jump_speed = 0

        # Keep the player in-bounds
        if self.pos[0] < 0:
            self.pos[0] = 0
        if self.pos[0] > 240:
            self.pos[0] = 240


# Initalise the display
display.init(scale=2.0, caption="NES Demo", res=NESRES)
player = Player()  # Create the player

# Create a font
nesfont = font.Font(NES_FONT, (255, 255, 255))

dialogbox = dialog.DialogBox((240, 51), (0, 0, 0), (255, 255, 255), nesfont)
dialogbox.set_dialog([
    "This is a dialog box! Press the a button to go to the next page.",
    "Press it again and this box will close."
])
menu = dialog.Menu(nesfont, ["Close", "Pause", "Exit"])
# dialogbox.close()

while 1:
Exemplo n.º 3
0
def main():
    display.init(3.0, "BubbMan", res=GBRES)
    menu.run_menu()
Exemplo n.º 4
0
def main():
    display.init(3.0, "Kontra")
    play_music("data/nes6.xm")

    objects = retrogamelib.gameobject.Group()
    platforms = retrogamelib.gameobject.Group()
    bullets = retrogamelib.gameobject.Group()

    Bullet.groups = [objects, bullets]
    Player.groups = [objects]
    Player.platforms = platforms
    Player.objects = objects
    Platform.groups = [objects, platforms]
    Tile.groups = [objects]
    Bullet.platforms = platforms

    x = 0
    y = 0
    for row in level.split("\n"):
        for col in row:
            if col == "T":
                Platform((x, y))
            if col == "-":
                Platform((x, y))
                platforms[-1].allow_fall_through = False
            if col == "L":
                Platform((x, y), -45)
            if col == "R":
                Platform((x, y), 45)
            if col == "r":
                Platform((x, y), 30)
            if col == "B":
                Tile((x, y))
            if col == "h":
                Helicopter((x, y))
            x += 16
        x = 0
        y += 16
    player = Player()
    turret = Turret()
    turret.rect.topleft = [0, 100]
    camera = Camera()
    camera.follow(player)

    while 1:
        clock.tick()
        button.handle_input()
        aliencount = 0
        for o in objects:
            if isinstance(o, Alien):
                aliencount += 1
            o.update()

        player.controls()
        camera.update()

        surface = display.surface
        surface.fill((175, 200, 255))
        for object in objects:
            translated = camera.translate(object.rect)
            surface.blit(object.image, translated)
            if translated.x < -16 or translated.x > 300:
                if hasattr(object, "offscreen"):
                    object.offscreen(camera)
            else:
                if hasattr(object, "onscreen"):
                    object.onscreen(camera)
        display.update()

        if aliencount < 2:
            if random.randint(0, 100) > 95:
                if random.randint(0, 1) == 1:
                    alien = Alien()
                    alien.rect.topleft = [
                        258 - camera.offset[0],
                        random.randint(0, 200)
                    ]
                    alien.direction.x = -1
                else:
                    alien = Alien()
                    alien.rect.topleft = [
                        -5 - camera.offset[0],
                        random.randint(0, 200)
                    ]
                    alien.direction.x = 1
Exemplo n.º 5
0
def main():
    display.init(3.0, "BubbMan", res=GBRES)
    menu.run_menu()
Exemplo n.º 6
0
import pygame
import os


import sys
sys.path.insert(0, "engine")



import pygame, sys, time, random
from pygame.locals import *
from retrogamelib import display
from retrogamelib import font
from retrogamelib.constants import *

display.init(scale=2, caption="pyNekketsu", res=NESRES)

pygame.mixer.pre_init(22050,8,1,1024)

from menu2 import Menu
from match import Match
from menu import select_teams#,call_all_menus, show_info
from inputs import Inputs
from settings import configuration



# set up pygame
#pygame.init()
mainClock = pygame.time.Clock()
nesfont = font.Font(NES_FONT, (255, 255, 255))
def main():
    display.init(2.5, "Johnny Ashtray and The Greyscale Tower", res=GBRES)
    menu.run_menu()
Exemplo n.º 8
0
def main():
    display.init(3.0, "Spinner",  GBRES)
    menu.run_menu()
Exemplo n.º 9
0
def main():

    display.init(3.0, "Crashtronaut", res=GBRES, icon="gfx/player-1.png")
    menu.run_menu()