Camera Screen scale (2)


(Oli) #1

I use this code as my camera in my player class

FP.camera.x = (x - (FP.halfWidth)      FP.camera.y = (y - (FP.halfWidth)

but when I try scalling the screen in the “main” class using FP.screen.scale = 2; I lose the focus on the player

I have looked at this very similar post and tried the solution mentioned, but it just didnt seem to work for me :frowning:

anyway if anyone know what im doing wrong i would greatly apreciate help thx:)


(TaylorAnderson) #3

I think (though I’m not entirely certain) that if you just divide halfWidth and halfHeight by FP.screen.scale (in this case 2), that’ll put player back in the center.


(Oli) #4

allright ill try this out


(Oli) #5

it worked:0…thx


(Zachary Lewis) #6

The fact that you reference FP.halfWidth for both the x and y might be a problem.


(TaylorAnderson) #7

Yeah that probably doesn’t help! Not sure how my solution solved the problem in that case…is the game window square?


(Oli) #8

yea it is, do you think it might cause problems in the future?


(TaylorAnderson) #9

I don’t think so, just an uncommon resolution. If its small enough it should be fine