Some other changes in game.py

This commit is contained in:
2023-12-22 16:01:50 +01:00
parent abfc1a2adf
commit d52d601408
4 changed files with 45 additions and 10 deletions

3
Controls.py Normal file
View File

@@ -0,0 +1,3 @@
class controls():
def __init__() -> None:
pass

25
Game.py
View File

@@ -1,5 +1,6 @@
import User import User
import Statics import Statics
import Controls
from math import pi, sin, cos from math import pi, sin, cos
from direct.showbase.ShowBase import ShowBase from direct.showbase.ShowBase import ShowBase
@@ -16,20 +17,34 @@ from panda3d.core import TextNode #Texte
from direct.task import Task from direct.task import Task
from panda3d.core import Vec4, Vec3 from panda3d.core import Vec4, Vec3
from panda3d.core import loadPrcFile #Ermöglicht das Laden eigener Konfigurationsdatein zur Panda3D API from panda3d.core import loadPrcFile #Ermöglicht das Laden eigener Konfigurationsdatein zur Panda3D API
import random
class game(ShowBase):
class Game(ShowBase):
__us = User.User __us = User.User
__statics = Statics.statics
#__ctrl = Controls.controls
# __game_mechanics = Game_Mechanics.Game_Mechanics() # __game_mechanics = Game_Mechanics.Game_Mechanics()
__onscreentext1 = OnscreenText
loadPrcFile("conf/conf.prc") #Pfadangabe zum .prc File __p3d_conf = loadPrcFile("conf/conf.prc") #Pfadangabe zum .prc File
def __init__(self) -> None: def __init__(self) -> None:
ShowBase.__init__(self) ShowBase.__init__(self)
__us = User.User() self.__us = User.User()
self.__statics = Statics.statics()
#self.__ctrl = Controls.controls(self)
font1 = self.loader.load_font("/usr/share/fonts/TTF/Inconsolata-UltraExpandedExtraBold.ttf")
self.__onscreentext1 = OnscreenText(self.__statics._menupoints[0], font=font1, pos= (0.1,0))
self.taskMgr.add(self.task1, "task1")
def task1(self, task):
print("Task läuft seit: " + str(task.time))
self.__onscreentext1.setText("Ich bewege mich fortlaufen!")
return Task.cont

View File

@@ -1,12 +1,14 @@
import Game import Game
import User import User
import Controls
def __main__(): def __main__():
game = Game.Game() game = Game.game()
game.run() game.run()
return 0
if __name__ == "__main__": if __name__ == "__main__":
__main__() __main__()
pass

View File

@@ -0,0 +1,15 @@
class statics:
_menutitle = "Hauptmenü"
_menupoints = ("Einstellungen",
"Highscore")
_version = "1.0"
def __init__(self) -> None:
for x in self._menupoints:
print(x)
pass