P4nch0 Posted August 4, 2015 Share Posted August 4, 2015 Hi! I have a problem with add my elements to gruop. I want to add it because i must cinfigure what will be do after collide element with player. This is my function where after click on screen can add elements from equipment to the game screen: createeq: function(){ this.eqgroup = this.game.add.group(); if (typ1==0){ this.cup=this.add.sprite(this.input.activePointer.x + this.camera.x,this.input.activePointer.y + this.camera.y, przedmiotwybrany); this.cup; this.eqgroup.add(this.cup); this.eqgroup.enableBody = true; } else{} },I want to create group to make collide with player like that: update: function() { //collision this.game.physics.arcade.overlap(this.player, this.eqgroup, this.eqitemadd, null, this); ...And function after collide: eqitemadd: function(){ console.log('add'); },And there is a problem, when my player collide with element dont do anything.Anyone can help? You can see my project on: http://lifetime.cba.pl Login : testPw: test And them click "graj". Thanks in advance! Link to comment Share on other sites More sharing options...
P4nch0 Posted August 6, 2015 Author Share Posted August 6, 2015 Ok i have a solution, problem was bacause only the second added element was colliding. So i must add "this.game.physics.arcade.enable(this.stol);"createeq: function(){this.eqgroup = this.game.add.group();if (typ1==0){this.cup=this.add.sprite(this.input.activePointer.x + this.camera.x,this.input.activePointer.y + this.camera.y, przedmiotwybrany);this.cup;this.game.physics.arcade.enable(this.stol);this.eqgroup.add(this.cup);this.eqgroup.enableBody = true;}else{}}, Link to comment Share on other sites More sharing options...
Recommended Posts