Jump to content

Dragging Group Problem


SeyfoX
 Share

Recommended Posts

Hallo,

 

how can i drag a group?

 

Anyone has any ideas?

 

Thanks!

 

http://demedideme.net/drag/3/

  <script type="text/javascript" src="js/phaser.min.js"></script>  <script type="text/javascript"> var game = new Phaser.Game(900, 450, Phaser.AUTO, 'phaser-example', { preload: preload, create: create,update:update });function preload() {	game.load.spritesheet('kupler', 'assets/number-buttons-90x90.png', 90, 90);  }var kup =  new Array();kup[0] = new Array();kup[1] = new Array();kup[2] = new Array();kup[3] = new Array();kup[4] = new Array();kup[5] = new Array();kup[6] = new Array();kup[7] = new Array();kup[8] = new Array();kup[9] = new Array();kup[10] = new Array();var rows = {};var xs;var excl ;var scoreText;function create() {    	for(var r = 1; r <= 10; r++){				rows[r] = game.add.group();		game.physics.arcade.enable(rows[r]);		rows[r].setAll('body.collideWorldBounds', true);		rows[r].enableBody = true;			}		excl = game.add.group();	scoreText = game.add.text(0, 0, 'aaa', { fontSize: '32px', fill: '#fff' });			for(x = 1; x <= 3; x++){			//Satırda kaç küp var		var satir_kup = Math.floor((Math.random() * 7) + 3); 				for(var i = 1 ; i <= satir_kup; i++){			var cntrw = Math.floor((Math.random() * 6) + 1); 					kup[x][i] = game.add.sprite((i*90), x*90, 'kupler',cntrw);			kup[x][i].name = x+'_'+i;			kup[x][i].group = x;			kup[x][i].id = i;			kup[x][i].inputEnabled = true;			kup[x][i].input.start();			kup[x][i].input.enableDrag();			kup[x][i].input.enableSnap(90,89.9);			//kup.input.allowVerticalDrag = false;						rows[x].add(kup[x][i]);			//kup[x][i].events.onDragStart.add(blockDragStop, this);					}		}	}function update(){			kup[1][1].events.onDragStop.add(moveBall, this);			}function moveBall(pointer){	rows[1].x = pointer.x;	}  </script>
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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