SentryDEVELOPMENT Posted January 7, 2015 Share Posted January 7, 2015 So I have a code block where Phaser.Game's height and width accommodate the full window size prior to the boot state, upon getting to the Game state I reset the world bounds to accommodate a larger canvas:buildWorld: function() { worldOw = this.world.width; worldOh = this.world.height; this.physics.startSystem(Phaser.Physics.ARCADE); cursors = this.input.keyboard.createCursorKeys(); this.world.setBounds(0, 0, worldW, worldH); /* if (this.camera.bounds) { //The Camera can never be smaller than the game size //game.camera.bounds.setTo(x, y, width, height); //this.camera.bounds.setTo(0,0, worldW, worldH); } */ //this.physics.setBoundsToWorld(); OGpos_PlaneY = this.world.height-250; OGpos_PlaneX = 300; And with modification to the launcher demolauncherUpdate : function(){ plane.anchor.setTo(1, 1); if (catchFlag) { distance = mainST.physics.arcade.distanceBetween(plane, arrow); theta = mainST.physics.arcade.angleToPointer(arrow); analog.rotation = arrow.rotation + Math.PI/2; arrow.rotation = mainST.physics.arcade.angleBetween(plane,arrow); degTheta = Math.round((arrow.rotation * 180)/Math.PI); if(degTheta >= -90 && degTheta <= 90){ if (distance > 75) { distance = 75; var adjacentX = Math.cos(theta) * distance; var oppositeY = Math.sin(theta) * distance; plane.x = OGpos_PlaneX + adjacentX; plane.y = OGpos_PlaneY + oppositeY; } else { plane.x = mX; plane.y = mY; } } else { var adjacentX = Math.cos(theta); var oppositeY = Math.sin(theta); plane.x = OGpos_PlaneX + adjacentX; plane.y = OGpos_PlaneY + oppositeY; } analog.height = distance; arrow.alpha = 1; console.log(degTheta); } if (launched) { plane.anchor.setTo(0.5, 0.5); } }I encounter: Where the plane's transforms interchange between the product of distance = 75;var adjacentX = Math.cos(theta) * distance;var oppositeY = Math.sin(theta) * distance;plane.x = OGpos_PlaneX + adjacentX;plane.y = OGpos_PlaneY + oppositeY;&&plane.x = OGpos_PlaneX + adjacentX;plane.y = OGpos_PlaneY + oppositeY;However with replacing distance = mainST.physics.arcade.distanceBetween(plane, arrow); with distance = mainST.physics.arcade.distanceToPointer(arrow);we get the analog(rubberband) instantly locked with no possible rubber-banding within range of the distance constrain: Has anyone come by a solution or can provide guidance on this? Link to comment Share on other sites More sharing options...
Recommended Posts