Camera Movement Skript (VogelPerspektive)

Camera Movement Skript Geeigent für das Betrachten von Karten
################2015
####################
## Marius Ratzka ###
## Camera-Movement #
## All Resolutions##
## Alpha ###########

#Needs:

from bge import logic
import bge


###Problems with Borderless Execution!
###Parameters("Change Performance")

factorW=25 ###Int
factorH=10 ###Int


###----------Script:


render = bge.render

def main():
    
    scene=logic.getCurrentScene()
    cont=logic.getCurrentController()
    mouse=cont.sensors["Mouse"]
    obj = cont.owner

    width = render.getWindowWidth()
    height = render.getWindowHeight()
    
    
    if obj["start"]==True:
        
        obj["start"]=False
        h=int(render.getWindowWidth()/2)
        w=int(render.getWindowHeight()/2)
        render.setMousePosition(h, w)
        
    if mouse.position[0]<(width/factorW):
        obj.worldPosition.x-=0.2
    if mouse.position[0]>width-(width/factorW):
        obj.worldPosition.x+=0.2
    if mouse.position[1]>height-(height/factorH):
        obj.worldPosition.y-=0.2
    if mouse.position[1]<(height/factorH):
        obj.worldPosition.y+=0.2

    ###Display Mouse Coords:
    obj["mouseX"]=mouse.position[0]
    obj["mouseY"]=mouse.position[1]
    ###
    render.enableMotionBlur([1.0])
     
          
main()