Sign in to follow this  
turtleAddict

hide/show sprites when overlapping or colliding

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.