Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from bge import logic
- def Camera():
- cont = logic.getCurrentController()
- obj = cont.owner
- sce = logic.getCurrentScene()
- def Init():
- if not 'init' in obj:
- obj['init'] = 1
- obj['target'] = sce.objects['Player']
- obj['depth'] = obj.position.y - obj['target'].position.y
- def Update():
- tarpos = obj['target'].worldPosition
- pos = obj.worldPosition
- soft = 1
- obj.position.x += (tarpos.x - pos.x) * soft
- obj.position.y += (tarpos.y + obj['depth'] - pos.y) * soft
- Init()
- Update()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement