1 decade ago by manuelac
##if (ig.input.pressed(&
## var mx = (ig.input.mouse.x + ig.game.screen.x);
## var my = (ig.input.mouse.y + ig.game.screen.y);
## this.pos.x = mx - this.size.x/2;
## this.pos.y = my - this.size.y/2;
## this.blinkCooldown = 0;
## }
This script does what I expect it to do. Teleporting the player entity to the position of the mouse in the game screen.
But I have a big problem because my camera is locked with the player in the center, using this:
## ig.game.screen.x = player.pos.x - ig.system.width/2;
## ig.game.screen.y = player.pos.y - ig.system.height/2;
And when the player is near the edge of the map, he can teleport outside of it and end up on the other side of the collision layer, unable to get back inside without until the teleport cooldown is back up.
Any ideas? Thanks for your time!
039;blink') && this.blinkCooldown == 400 && this.hasBlink == true) #
{ ## var mx = (ig.input.mouse.x + ig.game.screen.x);
## var my = (ig.input.mouse.y + ig.game.screen.y);
## this.pos.x = mx - this.size.x/2;
## this.pos.y = my - this.size.y/2;
## this.blinkCooldown = 0;
## }
This script does what I expect it to do. Teleporting the player entity to the position of the mouse in the game screen.
But I have a big problem because my camera is locked with the player in the center, using this:
## ig.game.screen.x = player.pos.x - ig.system.width/2;
## ig.game.screen.y = player.pos.y - ig.system.height/2;
And when the player is near the edge of the map, he can teleport outside of it and end up on the other side of the collision layer, unable to get back inside without until the teleport cooldown is back up.
Any ideas? Thanks for your time!