[color=green]I’m posting this coding of my project for personal refrences. It’s not complete, and you need to download the wav if you want the music. I’m making this into a role playing game, and I want to know the code so that I can transfer it from the computers at my school. To what I have at my house. I’ll post again when I get at least a little bit of the game done. Here’s what I have so far:
import direct.directbase.DirectStart
from direct.showbase import DirectObject
from threading import Timer
from direct.task import Task
from direct.actor import Actor
from direct.interval.IntervalGlobal import *
import math
import direct.directbase.DirectStart
from direct.task import Task
from direct.actor import Actor
from direct.interval.IntervalGlobal import *
import math
import direct.directbase.DirectStart
from direct.gui.OnscreenText import OnscreenText
from direct.gui.DirectGui import *
import direct.showbase.RandomNumGen
import random
from direct.interval.IntervalGlobal import *
bk_text = "Vertu Honagan"
textObject = OnscreenText(text = bk_text, pos = (-0.95,-0.95),
scale = 0.04, fg=(0,5,0,1),align=TextNode.ACenter,mayChange=1)
def incBar(args):
bar['value'] += args
text = "Progress is:"+str(bar['value'])+'%'
textObject.setText(text)
def incBar1():
bar['value'] += 10
text = "Progress is:"+str(bar['value'])+'%'
textObject.setText(text)
bar = DirectWaitBar(text = "Health" , value=100,pos=(-0.90,0,0.94), scale=0.4)
#props = WindowProperties()
#props.setCursorHidden(1)
#base.win.requestProperties(props)
window=base.openWindow()
class World(DirectObject):
def __init__(self):
land = loader.loadModel("models/environment")
land.reparentTo(render)
land.setScale(1,1,1)
land.setPos(-8,42,0)
self.backgroundMusic = loader.loadSfx("mortal")
self.backgroundMusic.setLoop(True)
self.backgroundMusic.setVolume(1)
self.backgroundMusic.play()
def playMusic():
self.backgroundMusic = loader.loadSfx("mortal")
self.backgroundMusic.setLoop(True)
self.backgroundMusic.setVolume(1)
self.backgroundMusic.play()
self.accept("m",playMusic)
def stopMusic():
self.backgroundMusic.stop()
self.accept("n",stopMusic)
def close():
base.closeWindow(window)
self.accept("c", close)
w=World()
textObject = OnscreenText(text = 'Mohanaki', pos = (0.7,0.9725), scale = 0.04)
run()
[color=green]If you see a bug in what I have right now please tell away.