Example #1
0
    def __init__(self):
        C.logandprint("Started initialization!")

        #defines what characters define comments
        commentchars = [";", "$", "#", "/", "!", "@"]

        #opens the config file about the maps
        firstmap = open("..\\config\\firstmap.txt", "r")

        #Filters comments from the first line and gets the map's name
        firstlvl = firstmap.readline()
        if commentchars.__contains__(firstlvl[1]):
            firstlvl = firstmap.readline()
        if firstlvl[len(firstlvl)-2:] == "\n":
            firstlvl = firstlvl[:-2]

        #Starts renderer
        self.renderer = R.GameRender()

        #Starts the new game
        Thegame = C.Game(firstlvl, self)

        #starts tickloop of renderer
        self.renderer.render()

        C.logandprint("Finished initialization!")
        C.logandprint("=========================\n")
        #Starts tickloop of new game
        Thegame.Tick()
Example #2
0
#-------------------------------------------------------------------------------
# Name:        PyBotLauncher
# Purpose:     Zero-player game where bots fights monsters
#
# Author:      Gustavo Ramos "Gustavo6046" Rehermann
#
# Created:     09/03/2016
# Copyright:   (c) Gustavo Ramos "Gustavo6046" Rehermann, 2016
# Licence:     CC-BY-SA
#-------------------------------------------------------------------------------

import Classes as C
C.logandprint("Finished importing Classes!")
from time import sleep
C.logandprint("Finished importing sleep from time!")
import Renderer as R
C.logandprint("Finished importing the VPython renderer!")

def main():
    GameStarter = StartGame()

class StartGame():

    def __init__(self):
        C.logandprint("Started initialization!")

        #defines what characters define comments
        commentchars = [";", "$", "#", "/", "!", "@"]

        #opens the config file about the maps
        firstmap = open("..\\config\\firstmap.txt", "r")
Example #3
0
from time import sleep
import Classes as C
from visual import *
C.logandprint("Finished importing VPython!")
import wx
C.logandprint("Finished importing wx!")

app = wx.App(False)
scsize = wx.GetDisplaySize()

class baseRendererClass(object):
    pass

class RendererBrush(baseRendererClass):
    def __init__(self, corrbrush, corrbox):
        self.brush = corrbrush
        self.box = corrbox

    def Tick(self):
        renderx, rendery, renderz = self.brush.x, self.brush.y, self.brush.z
        self.box.pos = (renderx, renderz, rendery)
        self.box.width, self.box.lenght, self.box.height = self.brush.breadth, self.brush.width, self.brush.height

class RendererActor(baseRendererClass):
    def __init__(self, corractor, corrsphere):
        self.actor = corractor
        self.sphere = corrsphere

    def Tick(self):
        renderx, rendery, renderz = self.actor.x, self.actor.y, self.actor.z
        self.sphere.pos = (renderx, renderz, rendery)