Example #1
0
    def __init__(self,
                 x=0, y=0, map=None,
                 blend_src=pyglet.gl.GL_SRC_ALPHA,
                 blend_dest=pyglet.gl.GL_ONE_MINUS_SRC_ALPHA,
                 pos=None,
                 batch=None,
                 group=None,
                 usage='dynamic',
                 ):
        self.dead = False
        self.charName = 'Player'
        self.charClass = 'Fighter'
        self.map = map
        self.mbox = msgBox()
        img = sheet['class'][79]
        self.stats = Stats(self, Con=18, hpRoll=20)
        self.statuswindow = statusWindow(self, batch, group)

        if pos is None:
            self.pos = Position()
        else:
            self.pos = pos
        Sprite.__init__(self, img,
                        x, y, blend_src,
                        blend_dest, batch,
                        group, usage)
Example #2
0
    def __init__(self, parent, hpRoll=10,
                 Str=12, Dex=12,
                 Con=12, Int=12,
                 Wis=12, Cha=12):

        self.parent = parent
        self.mbox = msgBox()
        self.dice = Dice()

        self.Str = Str
        self.Dex = Dex
        self.Con = Con
        self.Int = Int
        self.Wis = Wis
        self.Cha = Cha
        
        self.baseAttack = 2
        self.baseDefense = 2
        
        self.attackRoll
        
        self.hp = hpRoll + bonus[str(Con)]
        self.maxHP = self.hp
        self.mp = baseMP + bonus[str(Int)]
        self.maxMP = self.mp
        
        self.xp = 0
        self.xpForNextLevel = 1000
Example #3
0
import pyglet
from pyglet.window.key import *

from spritesheet import *
from gamemap import *
from constants import *
from msgbox import msgBox
from minimap import miniMap

mbox = msgBox()
map = Map(width=60, height=70)
map.updateViewport(VIEWPORT_W,VIEWPORT_H)
    
minimap = miniMap(map=map, pos=MINIMAP_POS)
window = pyglet.window.Window(width=WINDOW_W, height=WINDOW_H)

outline = pyglet.resource.image('outline.png')
outline = pyglet.sprite.Sprite(outline)
outline.set_position(OUTLINE_X, OUTLINE_Y)

@window.event
def on_text_motion(motion):
    if map.player.dead:
        return
    if motion == MOTION_UP:
        map.player.moveOrAttack(map, UP)
    elif motion == MOTION_RIGHT:
        map.player.moveOrAttack(map, RIGHT)
    elif motion == MOTION_DOWN:
        map.player.moveOrAttack(map, DOWN)
    elif motion == MOTION_LEFT: