Case and point:
var/list/games = new/list()
mob/client
var/gameHandler/game = null
verb/newGame()
var/gameHandler/GH = new()
src.game = GH
GH.playerOne = src
GH.playerTwo = input(src,"Who?")as null|mob in world
GH.playerTwo.game = GH
if(GH.playerTwo)GH.gameStart()
else del GH
gameHandler
New()
..()
var
gameLoc = 0 //z level for stage
mob/client
playerOne = null
playerTwo = null
proc
otherPlayer(var/mob/client/M)
if(!M)return null
if(M == playerOne)return playerTwo
else if(M == playerTwo)return playerOne
else return null
gameStart()
playerOne.inGame = 1
playerTwo.inGame = 1
playerOne.client.eye = playerOne.viewer
playerTwo.client.eye = playerTwo.viewer
mob/client
var/tmp
otherDir = "left"
state_icon = ""
mob/viewer = null
New()
..()
spawn()loop()
var/mob/M = new()
M.density = 0
M.loc = locate(1,1,1)
src.viewer = M
proc
loop()
while(src)
if(src.inGame)
viewLoop()
sleep(0.1)
viewLoop()
var/mob/M = src.game.otherPlayer(src)
step_towards(src.viewer,locate((src.x+M.x)/2,(src.y+M.y)/2,1),20)
(Sorry if this doesn't compile by itself, it's taklen straight from my source, might have a few undeclaired vars in it but it shouldn't be much of a problem.)
The idea is to get the camera to center between the two players in a fighting game, this effectively does it but make the camera move very jerky like it's back on tile movement. Can anyone help? (Originally I used an obj instead of a mob for the viewer but I thought using a Mob might remove the jerky-ness, I was wrong)