Added debuglevel-based console-output
This commit is contained in:
18
Game.py
18
Game.py
@@ -20,7 +20,8 @@ from panda3d.core import loadPrcFile #Ermöglicht das Laden eigener Konfiguratio
|
||||
import random
|
||||
|
||||
class game(ShowBase):
|
||||
|
||||
__debug_mode = [0,1,2,3,4]
|
||||
__debuglevel = 0
|
||||
__us = User.User
|
||||
__statics = Statics.statics
|
||||
#__ctrl = Controls.controls
|
||||
@@ -68,6 +69,11 @@ class game(ShowBase):
|
||||
def update_keystate(self, controlName, controlState):
|
||||
self.__keymap[controlName] = controlState
|
||||
|
||||
def setDebugMode(self, debugmode:int):
|
||||
"""DEBUGLEVEL"""
|
||||
self.__debuglevel = debugmode
|
||||
|
||||
|
||||
#Taskfunctions and definitions
|
||||
def task1(self, task):
|
||||
_x = -2.8 + (task.time*0.3)
|
||||
@@ -82,19 +88,19 @@ class game(ShowBase):
|
||||
|
||||
def keyboard_event(self, task):
|
||||
|
||||
print(self.__keymap)
|
||||
if(self.__debuglevel == 4): print(self.__keymap)
|
||||
|
||||
if (self.__keymap['up']):
|
||||
self.__actor1.setPos(self.__actor1.getPos() + Vec3(0,0.2,0))
|
||||
print("Nach oben!")
|
||||
if(self.__debuglevel >= 3): print("Nach oben!")
|
||||
if (self.__keymap['down']):
|
||||
self.__actor1.setPos(self.__actor1.getPos() - Vec3(0,0.2,0))
|
||||
print("Nach unten!")
|
||||
if(self.__debuglevel >= 3): print("Nach unten!")
|
||||
if (self.__keymap['left']):
|
||||
self.__actor1.setPos(self.__actor1.getPos() - Vec3(0.2,0,0))
|
||||
print("Nach links!")
|
||||
if(self.__debuglevel >= 3): print("Nach links!")
|
||||
if (self.__keymap['right']):
|
||||
self.__actor1.setPos(self.__actor1.getPos() + Vec3(0.2,0,0))
|
||||
print("Nach rechts!")
|
||||
if(self.__debuglevel >= 3): print("Nach rechts!")
|
||||
|
||||
return Task.cont
|
||||
@@ -12,6 +12,7 @@ def __main__():
|
||||
return subprocess.check_output(['git', 'rev-parse', 'HEAD'])
|
||||
|
||||
game = Game.game()
|
||||
game.setDebugMode(3)
|
||||
game.run()
|
||||
return 0
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@ class statics:
|
||||
|
||||
|
||||
|
||||
def __init__(self) -> None:
|
||||
for x in self._menupoints:
|
||||
print(x)
|
||||
#def __init__(self) -> None:
|
||||
# for x in self._menupoints:
|
||||
# print(x)
|
||||
|
||||
pass
|
||||
# pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user