Sabre Posted August 19, 2015 Share Posted August 19, 2015 I am having some problems with being able to have the "cone" sprite overlapping "S1" and not recongizing that they are overlapping, and I am also wondering if with the ay I am doing this it would be easy to have it switch levels when it is done and have like a start screen. Thanks for the help in advance./** To change this license header, choose License Headers in Project Properties.* To change this template file, choose Tools | Templates* and open the template in the editor.*/var game = new Phaser.Game(800,600,Phaser.AUTO,'',{preload: preload, create: create, update: update});function preload(){game.load.image('Cone','pics/ICE-Cream-cone_1.png');game.load.image('back','pics/BakerIceBackground_1.png');game.load.image('Shoot','pics/CreamShoot.png');game.load.image('star','pics/star.png');}var cone;var text;function create(){back = game.add.sprite(0,0,'back');s1 = game.add.sprite(500,250,'Shoot');s2 = game.add.sprite(280,250,'Shoot');s3 = game.add.sprite(60,250,'Shoot');cone = game.add.sprite(300,400,'Cone');cone.inputEnabled = true;cone.input.enableDrag();game.physics.enable(cone,Phaser.Physics.ARCADE);var style = {font: "32px comic sans", fill :"#ff0044", wordwrap: true, wordWrapWidth: cone.width,align:"center"};text = game.add.text(0,0,"test",style);text.anchor.set(0.5);}function update(){text.x = Math.floor(cone.x + cone.width / 2);text.y = Math.floor(cone.y + cone.height / 2);game.physics.arcade.overlap(cone,s1,collisionHandler,null,this);//CX = s2.x;// CY = s2.y;// console.log(CY);// console.log(CX);function collisionHandler(){console.log("game Over");}} Link to comment Share on other sites More sharing options...
Recommended Posts