Advertisement
Guest User

impactjs

a guest
Sep 27th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.                 var player = ig.game.getEntityByName('player');
  2.  
  3.                 this.screen.x = player.pos.x - ig.system.width / 2 + player.size.x / 2;
  4.                 this.screen.y = player.pos.y - ig.system.height / 2 + player.size.y / 2;
  5.  
  6.  
  7.                 if (this.screen.x < 0) {
  8.                     this.screen.x = 0;
  9.                 }
  10.                 if (this.screen.x > 1280 - 480) {
  11.                     this.screen.x = 1280 - 480;
  12.                 }
  13.                 if (this.screen.y < 0) {
  14.                     this.screen.y = 0;
  15.                 }
  16.                 if (this.screen.y > 800 - 320) {
  17.                     this.screen.y = 800- 320;
  18.                 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement