def static_rotate(own, mouse): if own['cur_pos'] != 0: render.setMousePosition(*own['cur_pos']) own['cur_pos'] = 0.0 render.showMouse(True) own['init'] = False player_rot(0, 0, 0)
def init_world(): G.scene = G.getCurrentScene() objects = G.scene.objects R.showMouse(True) G.red = objects["red"] G.green = objects["green"] G.blue = objects["blue"] G.white = objects["white"] G.white1 = objects["white.001"] G.black = objects["black"] G.white.visible = False G.vsyncCount = 0 G.things = [] for j in range(150): o = G.scene.addObject("Cube", "Cube", 0) o.color = [random(), random(), random(), 1] o.localScale = [0.25, 0.25, 0.25] o.worldPosition = [random() * 10, random() * 10, random() * 10] G.things.append(o) G.prerollFrames = 180 * G.prerollPostroll G.frames = G.duration * 180 G.state = "preroll" print("init_world")
def ackArena(): #_ arenaloader.setx(1) ctrl.cursorentry.setx('esc.Arena') mouseclick.rtclick.setx(1) render.showMouse(0) text.plate.set_Arena()
def mainPanel( ): #____________________________________________________ Main Loader Section . ___________________________:( mainloader.setx(1) ctrl.cursorentry.setx('esc.Main') text.plate.callServer() render.showMouse(1)
def init_world(): cont = G.getCurrentController() owner = cont.owner scene = G.getCurrentScene() objects = scene.objects buttons = {} buttons["play"] = objects["UI_PLAY"] buttons["pause"] = objects["UI_PAUSE"] buttons["stop"] = objects["UI_STOP"] buttons["sound"] = objects["UI_SOUND"] buttons["mute"] = objects["UI_MUTE"] G.buttons = buttons G.buttons["pause"].visible = 0 G.buttons["mute"].visible = 0 G.sound_mute = 1 G.play_pause = 0 G.sound = owner.actuators["a_sound"] G.sound_volume = G.sound.volume R.showMouse(True) init_video(objects["VIDEO_SCREEN"], objects["VIDEO_BLANK"])
def ackProject(): #_ projectloader.setx(1) ctrl.cursorentry.setx('esc.Projects') mouseclick.rtclick.setx(1) render.showMouse(0) text.plate.set_Project()
def ackEnd(): #_ endloader.setx(1) ctrl.cursorentry.setx('esc.Close') runserver.start(0) render.showMouse(0) mouseclick.rtclick.setx(0) registername.closeClient() clientFinalclose()
def robot_action(self): panel.restore = lambda : self.restore() render.showMouse(True) input.service.lock_mouse = None self.move_forward = 0 self.move_back = 0 self.move_left = 0 self.move_right = 0 panel.enable()
def restore(self): scene = logic.getCurrentScene() scene.active_camera = scene.objects['CharacterCamera'] input.service.lock_mouse = self.owner render.showMouse(False) self.move_forward = 0 self.move_back = 0 self.move_left = 0 self.move_right = 0
def main(): render.showMouse(0) cont = bge.logic.getCurrentController() own = cont.owner resume = cont.actuators['resume'] resume.scene = 'Scene' cont.activate(resume)
def main(): render.showMouse(0) cont = bge.logic.getCurrentController() own = cont.owner resume = cont.actuators["resume"] resume.scene = "Scene" cont.activate(resume)
def main(cont): """called once by the "Always" sensor named InitGame, will remove sensors if we have time its kinda complicated""" bge.c = Controller(0) # hard codded, will be the players list index (i++) bge.c.game = Game(2) bge.c.game.game_init() bge.c.display = bgui.bge_utils.System('../../themes/default') bge.c.display.load_layout(MainDisplay, None) render.showMouse(True) render.setMousePosition(400, 400)
def rotate(contr): """ Read the movements of the mouse and apply them as a rotation to the camera. """ # get the object this script is attached to camera = contr.owner scene = logic.getCurrentScene() if not scene: # not ready, main reload(blenderapi) return # Do not move the camera if the current view is using another camera if camera != scene.active_camera: return camera = scene.cameras["BodyCam"] # Get sensor named Mouse mouse = contr.sensors['Mouse'] # Get Blender keyboard sensor # Show the cursor mouse_visible = True # Hide the cursor while we control the camera mouse_visible = False if mouse.positive: # get width and height of game window width = render.getWindowWidth() height = render.getWindowHeight() # get mouse movement from function move = mouse_move(camera, mouse, width, height) # set mouse sensitivity sensitivity = 0.003 # camera['Sensitivity'] print(camera.localOrientation) # Amount, direction and sensitivity leftRight = move[0] * sensitivity upDown = move[1] * sensitivity print(upDown, leftRight) # set the values camera.localOrientation = Euler((upDown, 0.0, leftRight), 'XYZ') print(Euler((upDown, 0.0, leftRight), 'XYZ')) # Center mouse in game window # Using the '//' operator (floor division) to produce an integer result render.setMousePosition(width // 2, height // 2) # Show the cursor mouse_visible = True # Set the cursor visibility render.showMouse(mouse_visible)
def mouse_move(own, mouse): if own['cur_pos'] == 0: own['cur_pos'] = mouse.position render.showMouse(False) render.setMousePosition(*own['win_size']) x_pos = (own['win_size'][0] - mouse.position[0]) * SENSITIVITY y_pos = (own['win_size'][1] - mouse.position[1]) * SENSITIVITY if own['init'] == False: x_pos = y_pos = 0 own['init'] = True return x_pos, y_pos
def main(cont): global scene scene = logic.getCurrentScene() scenes = logic.getSceneList() camera = cont.owner overlay = camera.actuators["Scene"] # camera state 2 is in the menu if camera.state == 2: if "play" not in gdict: # show menu cont.activate(overlay) render.showMouse(True) logic.setGravity([0,0,-9.8]) else: # start game camera.state = 1 render.showMouse(False) scene.objects["Floor"].endObject() scene.objects["Spawn"].endObject() logic.setGravity([0,0,0]) scene.objects["Cube"].visible = True scene.objects["BondCraft"].visible = True return print("###############GAME START##################") gdict.clear() gdict["free"] = { "Hydrogen": set(), "Carbon": set(), "Oxygen": set(), "Nitrogen": set(), "Bromine": set() } gdict["cations"] = set() gdict["atoms"] = set() gdict["textures"] = [] gdict["molecules"] = set() gdict["primary"] = "Hydrogen" gdict["camera"] = scene.objects["Camera"] gdict["prim_text"] = scene.objects["prim_text"] gdict["prim_text"].resolution = 16 gdict["text"] = scene.objects["Text"] gdict["text"].resolution = 16 #bind line drawing function scene.pre_draw = [draw] #slow down #fps =1000 #logic.setLogicTicRate(fps) #logic.setPhysicsTicRate(fps)
def __init__(self, cont): #get Dependencies self.cont = cont self.camera = cont.owner self.mouse = logic.mouse x = render.getWindowWidth() // 2 y = render.getWindowHeight() // 2 self.screen_center = (x, y) render.setMousePosition(x + 1, y + 1) #show Mouse render.showMouse(1)
def ackMeshesRigs(): #_ meshesrigsloader.setx(1) ctrl.cursorentry.setx('esc.Spawn') text.plate.camera360() text.rigplates.setSpawn() text.rigplates.setRig1() text.rigplates.setRig2() text.rigplates.setRig3() mouseclick.rtclick.setx(1) render.showMouse(0) text.plate.set_MeshesRigs()
def main(self): # Refresh properties self.props = self.getProperties('mmc') self.controls.main() cursor = self.props['cursor'] if cursor in [True, False]: render.showMouse(cursor) for i in self.features: if self.props[i] == True: self.features[i].main() elif self.features[i].ready == True: self.features[i].deactivate()
def __init__(self): self.mouse_click_s = None self.mouse_move_s = None self.keyboard_s = None self.joystick_s = None self.lock_mouse = None self.mouse_sensitivity = 0.001 self.raycast_distance = 1000.0 render.showMouse(True) self.keyboard_hooks = [] self.mouse_hooks = [] self.joystick_hooks = []
def mainMenu( self ): #__________________________main Menu .___________________________:( self.camera90() scene = logic.getCurrentScene() arena = scene.objects["Camera.001"] spawner = scene.objects["SpawnerMainMenu"] arena.position = spawner.worldPosition mouseclick.rtclick.setx(1) ackpanel.setMouse.setx(1) mouseclick.ltclick.setx(1) ackpanel.setMouse.setx(1) render.showMouse(1)
def clientFinalclose(): if idclient.getLogOff(idclient) == 1: # idclient.setLogOff(0) ctrl.clientconnected.setx(0) config.closeClient(1) ctrl.userconnected.setx(0) config.closeRemote(1) ''' >>> Client Final Close ! <<< ''' def serverExit(): # text.plate.exitClient() service = threading.Timer(3.7, serverExit) service.start() closeDown.set_n(1) def sleepExit(): # ''' >>> * Comeback Soon ! <<< ''' service = threading.Timer(2.7, sleepExit) service.start() def selfQuit(): # ''' User/Client Ended Arena ''' if endOnce.get_n() == 1: # endOnce.set_n(0) ''' >>> Goodbye Client User .<<< ''' def sleepExit(): # ''' >>> Client Shutdown Finished ! <<< ''' service = threading.Timer(6.4, sleepExit) service.start() if closeDown.get_n() == 1: # ''' Break the Satillites Server Communications Port Bind ! ''' endOnce.set_n(1) close1Quit = threading.Timer(3.0, selfQuit) close1Quit.start() def sleepExit(): # ''' >>> Comeback Soon ! <<< ''' logic.endGame() service = threading.Timer(7.0, sleepExit) service.start() render.showMouse(0) text.plate.beforeYouGo()
def init_world(): G.scenes = {"main":G.getCurrentScene()} objects = G.scenes["main"].objects R.showMouse(True) G.red = objects["red"] G.green = objects["green"] G.blue = objects["blue"] G.green.visible = True G.red.visible = True G.blue.visible = True G.vsyncCount = 0 print ('init_world')
def set_active(item): item['active'] = True if item['ID'] == 1: logic.globalDict['game_load'] = False set_defualt_vars.main(False) #logic.saveGlobalDict() #render.showMouse(0) if item['ID'] == 0: menu_music.volume = 0 menu_music.stopSound() cont.deactivate(menu_music) logic.globalDict['game_load'] = True logic.globalDict['Load_Next'] = logic.globalDict['level_name'] print('setting loading file to:', logic.globalDict['Load_Next']) logic.saveGlobalDict() render.showMouse(0)
def set_active(item): item['active'] = True if item['ID'] == 1: logic.globalDict['game_load'] = False set_defualt_vars.main(False) #logic.saveGlobalDict() #render.showMouse(0) if item['ID'] == 0: menu_music.volume = 0 menu_music.stopSound() cont.deactivate(menu_music) logic.globalDict['game_load'] = True logic.globalDict['Load_Next'] = logic.globalDict['level_name'] print ('setting loading file to:',logic.globalDict['Load_Next']) logic.saveGlobalDict() render.showMouse(0)
def showCursor(o, cursor): notset = False if 'Cursor' in o: if o['Cursor'] == True: cursor = True else: cursor = False else: # This is in case the player doesn't want the mouselook script # overriding their own cursor visibility settings notset = True if notset == False: if cursor == True: r.showMouse(1) else: r.showMouse(0)
def ackEnter(): #_ enterloader.setx(1) def yesServer(): # text.plate.callServer() filesys.startserver.getx() yesCall = threading.Timer(0.7, yesServer) yesCall.start() mouseclick.rtclick.setx(1) render.showMouse(0) text.plate.yesCallServer() def mainService(): # text.plate.mainMenu() render.showMouse(1) render.showMouse(1) noServer = threading.Timer(0.9, mainService) noServer.start()
def ackExit(): #_ exitloader.setx(1) def noServer(): # text.plate.noCallServer() noCall = threading.Timer(0.7, noServer) noCall.start() mouseclick.rtclick.setx(1) render.showMouse(0) def autoffService(): # text.plate.introOffline() noServer = threading.Timer(0.8, autoffService) noServer.start() def mainService(): # text.plate.mainMenu() render.showMouse(1) noServer = threading.Timer(0.9, mainService) noServer.start()
def main(cont): own = cont.owner render.showMouse(0) ''' try: ID = logic.globalDict['ID'] = logic.globalDict['ID'] + 1 except: ID = logic.globalDict['ID'] = 0 ''' own['ID'] = 0 if own['DREAM'] == True: own['ANIM_SPEED'] = .5 own['MAX_SPEED'] = 10 own['ENABLE_ATK'] = False own['RUNNING'] = True own['RUN'] = True else: own['ANIM_SPEED'] = 1 own['MAX_SPEED'] = 25 own['ENABLE_ATK'] = True own['ENABLE_RUN'] = True init_load()
def init_world(): G.scenes = {"main": G.getCurrentScene()} objects = G.scenes["main"].objects R.showMouse(True) print("[A]spect [S]cale [R]otate [C]olor [F]requency [A]spect [M]askRotate") G.mode = "Rotate" G.hole = objects["Hole"] G.stim = objects["Stim"] G.sun = objects["Sun"] # G.hole = objects["Suzanne"] G.stimRot = 0.0 G.stimScaleFactor = 1.0 G.stimLocation = [0.0, 0.0, G.stim.worldPosition[2]] G.holeScaleFactor = 1.0 G.holeLocation = [0.0, 0.0, G.hole.worldPosition[2]] print(G.hole) print(G.stim) G.plane = Plane(Vector((0, 0, 0)), Vector((0, 0, 1))) print("init_world")
def show(self): render.showMouse(1)
def mouse(self, v): self._mouse = v render.showMouse(v)
def getCursor(self): cursor = self.getProp('cursor') if cursor != None: if cursor in [True, False]: render.showMouse(cursor)
from bge import logic from bge import render from bge import events import random render.showMouse(True) def Click(): cont = logic.getCurrentController() owner = cont.owner scene = logic.getCurrentScene() Cleared = 0 mines = 0 def setNeighborMine(x, y, z): #define area around mine lowX = max(x - 1, 1) highX = min(x + 2, 10) lowY = max(y - 1, 1) highY = min(y + 2, 10) lowZ = max(z - 1, 1) highZ = min(z + 2, 10) #loop through area around mine for i in range(lowX, highX): for j in range(lowY, highY): for k in range(lowZ, highZ): #the mine is not a neighbor to itself. if not (i == x and j == y and k == z): #count neighborMine 1 up for each neighbor Coord = str(i) + str(j) + str(k)
def mainService(): # text.plate.mainMenu() render.showMouse(1)
def main(): render.showMouse(1)
for i in resume_game.children: i.visible = 0 menu_items.pop() #print (menu_items) mouse_move = own.sensors['mouse_move'] mouse_over = own.sensors['mouse_over'] mouse_click = own.sensors['mouse_click'] enter_key = own.sensors['enter_key'] up_key = own.sensors['up_key'] down_key = own.sensors['down_key'] logic.MENU_CURRENT_SUB_ID = 0 logic.MENU_CURRENT_ID = 1 render.showMouse(1) def main(): if enter_key.positive: set_active(get_ID(logic.MENU_CURRENT_ID)) if mouse_move.positive: own['mouse_timer'] +=1 if own['mouse_timer'] >=15: own['mouse_movement'] = True if own['mouse_movement'] == True: if mouse_over.hitObject != None: OVER = mouse_over.hitObject.parent try: if 'selected' in OVER:
def init(): render.showMouse(1)
def setup(): #logic.OPTIONS_CURRENT_SUB_ID = 0 logic.OPTIONS_CURRENT_ID = 1 render.showMouse(1)
def hide(self): render.showMouse(0)
def init_world(): G.scenes = {"main": G.getCurrentScene()} objects = G.scenes["main"].objects # ############################################################################ # Initializing the Camera elements # ############################################################################ # Setting the cursor R.showMouse(False) set_mouse_position() G.cameras = {} # orbit camera camera = objects["CAM_Orbit"] pivot = objects["ORB_PIVOT"] G.cameras["ORB"] = [camera, {"orientation": pivot.worldOrientation}, pivot] # fly/walk camera camera = objects["CAM_Move"] pivot = objects["MOVE_PIVOT"] G.cameras["MOVE"] = [ camera, { "orientation": pivot.worldOrientation, "position": pivot.worldPosition }, pivot ] # ############################################################################ # Camera Orbit # ############################################################################ # angle restriction in degrees left = -220.0 right = 220.0 top = 70.0 bottom = 10.0 # convert all of them to radians left = m.radians(left) right = m.radians(right) top = m.radians(top) bottom = m.radians(bottom) # store them globally G.orb_limits = {"left": left, "right": right, "top": top, "bottom": bottom} # ############################################################################ # Mouse Look # ############################################################################ # angle restriction top = 45.0 bottom = -15.0 # convert them to radians top = m.radians(top) bottom = m.radians(bottom) G.look_limits = {"top": top, "bottom": bottom} G.look_SENS = 1.5 # ############################################################################ # Different Cameras # ############################################################################ # list the cameras with their name in the 3DWorld CAM_name e.g. CAM_front will be front in the list available_cameras = ["front", "back", "side", "top"] G.views = {} for i in available_cameras: G.views[i] = objects["CAM_%s" % (i)] # ############################################################################ # Variables that change during the game # ############################################################################ G.cameras["CAM"] = "ORB" # the current camera G.cameras["OLD_CAM"] = G.cameras["CAM"] G.walk_fly = "walk" G.nav_mode = "orbit"
def getclientCall(): # render.showMouse(1)