var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update });
var player;
var cursors;
var heavy;

var spaceMode = true;

function preload() {
	game.load.image('star', 'assets/star.png');
	game.load.image('diamond', 'assets/diamond.png');
}

function create() {
	game.physics.startSystem(Phaser.Physics.ARCADE);

	player = game.add.sprite(0, 400, 'star');
	heavy = game.add.sprite(200, 200, 'diamond');

	game.physics.arcade.enable(player);
	if (spaceMode) {
		player.body.velocity.x = 60;
	}

	cursors = game.input.keyboard.createCursorKeys();
}

function update() {
	if (spaceMode) {
		var rotSpeed = 0.05;
		var gravPower = 3;

		if (cursors.left.isDown) {
			player.body.velocity.rotate(0, 0, -rotSpeed);
		} else if (cursors.right.isDown) {
			player.body.velocity.rotate(0, 0, rotSpeed);
		}

		var offset = heavy.position.clone().subtract(player.body.position.x, player.body.position.y);
		var gravDir = offset.normalize();

		var distSq = offset.getMagnitudeSq();

		var grav = gravDir.setMagnitude(gravPower / distSq);

		player.body.velocity = player.body.velocity.add(grav.x, grav.y);
	}
}

@@ -159,11 +159,12 @@
 e = 
-tru
+fals
 e;%0A%0A
@@ -533,16 +533,98 @@
 = 60;%0A%09%7D
+ else %7B%0A%09%09player.body.gravity.y = 600;%0A%09%09player.body.collideWorldBounds = true;%0A%09%7D
 %0A%0A%09curso
@@ -1152,16 +1152,16 @@
 stSq);%0A%0A
-
 %09%09player
@@ -1219,13 +1219,388 @@
 rav.y);%0A
+%09%7D else %7B%0A%09%09var lineStrength = 0.1;%0A%09%09var airResistance = 0.01;%0A%09%09if (game.input.activePointer.isDown) %7B%0A%09%09%09var offset = heavy.position.clone().subtract(player.body.position.x, player.body.position.y);%0A%09%09%09offset.multiply(lineStrength, lineStrength);%0A%09%09%09player.body.velocity.add(offset.x, offset.y);%0A%09%09%09player.body.velocity.multiply(1 - airResistance, 1 - airResistance);%0A%09%09%7D%0A
 %09%7D%0A%7D%0A

Add a grappling-style interaction