Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Problem with including physics


levshkatov
 Share

Recommended Posts

var socket = io();window.onload = function() {        var game = new Phaser.Game(window.innerWidth, window.innerHeight, Phaser.AUTO, '', { preload: preload, create: create, update: update, render: render });        function preload () {            game.load.image('bg', '/img/bg.png');			game.load.image('ship', '/img/ship.png');        }		var ship;		var bg;		var coords = {x:0, y:0};;		        function create () {			game.world.setBounds(0, 0, 2500, 1600);			bg = game.add.sprite(-(1250 - window.innerWidth/2), -(800 - window.innerHeight/2), 'bg');			ship = game.add.sprite(window.innerWidth/2, window.innerHeight/2, 'ship') 			coords.x = game.input.mousePointer.x;			coords.y = game.input.mousePointer.y;			game.camera.follow(bg);			game.physics.enable(bg, Phaser.Physics.ARCADE);        }				function update() {				//game.camera.x = ((window.innerWidth/2 - coords.x)/window.innerWidth)*1.5;			//game.camera.y = ((window.innerHeight/2 - coords.y)/window.innerHeight)*1.5;			game.physics.arcade.moveToPointer(bg, 100);		}				function render() {		}};

Ok, here is whole code.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...