Beispiel #1
0
import pygame
import sys
import time

# Python doesn't seem to allow clean imports
# from sibling folders.
sys.path.append('..')
from lib.char import char


pygame.init()
window = pygame.display.set_mode((640, 480))
pygame.display.set_caption('Hero testing')
screen = pygame.display.get_surface()

hero = char(os.path.join('hero', 'main', 'main'), os.path.join('..', '..', ''))
#hero = char(os.path.join('npc', 'test_npc'), os.path.join('..', '..', ''))

up = False
down = False
left = False
right = False
no_key_yet = True
gameW = 640
gameH = 480
keys = []

while True:

	if no_key_yet:
		font = pygame.font.Font(None, 20)
Beispiel #2
0
import sys
import time

# Python doesn't seem to allow clean imports
# from sibling folders.
sys.path.append('..')
from lib.char import char
from lib.map import map


pygame.init()
window = pygame.display.set_mode((640, 480))
pygame.display.set_caption('Hittest testing')
screen = pygame.display.get_surface()

hero = char(False)
map = map(False)

body = pygame.Surface((32, 32))
body.fill((255, 0, 0))

hero.frames[''] = {'n': {'s': ['rect'], 'm': ['rect']}, 'w': {'s': ['rect'], 'm': ['rect']}, 'e': {'s': ['rect'], 'm': ['rect']}, 's': {'s': ['rect'], 'm': ['rect']}}
hero.state = 'm'

#print(hero.frames)
hero.images['rect'] = body

rect = pygame.Surface((32, 32))
rect.fill((255, 255, 255))

map.images['rect'] = rect
Beispiel #3
0
import pygame
import sys
import time

# Python doesn't seem to allow clean imports
# from sibling folders.
sys.path.append("..")
from lib.char import char


pygame.init()
window = pygame.display.set_mode((640, 480))
pygame.display.set_caption("Dialogue testing")
screen = pygame.display.get_surface()

hero = char(os.path.join("hero", "main", "main"), os.path.join("..", "..", ""))

npcs = []
npcs.append(char(os.path.join("npc", "test_npc"), os.path.join("..", "..", "")))
npcs[0].x = 30
npcs[0].y = 0
npcs[0].name = "John Doe"

up = False
down = False
left = False
right = False
no_key_yet = True
gameW = 640
gameH = 480
dialogues = []
Beispiel #4
0
import time

# engine libs import
from lib.char import char
from lib.map import map
from lib.item import item


pygame.init()
window = pygame.display.set_mode((640, 480))
pygame.display.set_caption('Nerds\' main screen')
screen = pygame.display.get_surface()

debug = False  # switch to True for quick debug visuals

hero = char()
if debug:
	hero.debug = True

objects = {'npcs': [], 'map': map(), 'hero': hero}

if debug:
	objects['map'].debug = True

hero.map = objects['map'].file

gameW = 640
gameH = 480
font = pygame.font.Font(None, 20)
dx = 0
dy = 0
Beispiel #5
0
import sys
import time

# Python doesn't seem to allow clean imports
# from sibling folders.
sys.path.append('..')
from lib.char import char
from lib.map import map


pygame.init()
window = pygame.display.set_mode((640, 480))
pygame.display.set_caption('NPC AI moving testing')
screen = pygame.display.get_surface()

npc = char(os.path.join('npc', 'test_npc'), os.path.join('..', '..', ''))
npc.x = 0
npc.y = 0
npc.dir = 'e'
map = map(False)

rect = pygame.Surface((32, 32))
rect.fill((255, 255, 255))

map.images['rect'] = rect

map.tiles.append({'src': 'rect', 'pos_x': -50, 'pos_y': -50, 'width': 32, 'height': 32, 'walkable': False})
map.tiles.append({'src': 'rect', 'pos_x': 50, 'pos_y': 50, 'width': 32, 'height': 32, 'walkable': False})
map.tiles.append({'src': 'rect', 'pos_x': 50, 'pos_y': 82, 'width': 32, 'height': 32, 'walkable': False})
map.tiles.append({'src': 'rect', 'pos_x': 18, 'pos_y': 82, 'width': 32, 'height': 32, 'walkable': False})
map.tiles.append({'src': 'rect', 'pos_x': -14, 'pos_y': 114, 'width': 32, 'height': 32, 'walkable': False})