Jump to content

hide/show sprites when overlapping or colliding


turtleAddict
 Share

Recommended Posts

hi im new to  programming and phaser  im making a game where i need to drag a "chip" onto a "chipreader" and when they overlap hide both and replace with a 3rd sprite which is a "chipped reader"  

and first i tried
funtcion preload(){

game.load.images("chipreader"', images/chipreader)

game.load.images("chip"', images/chip)

game.load.images("chippedreader', images/chippedreader)

}

function create() {

game.input.mouse.capture = true;
game.physics.startSystem(Phaser.Physics.ARCADE);
 
var chipreader=game.add.sprite(260, 535, "chipreader");
chipreader.anchor.setTo(0.5, 0.5);
 
chip.inputEnabled = true;
chip.input.enableDrag(true);
 
game.physics.arcade.enable([chip,chipreader]);
if (game.physics.arcade.overlap(chip,chipreader )) {
chipreader.visible= false
chip.visible= false
game.add.sprite(260, 535, "chippedreader")
 
};
 
but nothing happened and i tried so many other ways but it just isn't working :S
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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