Jump to content

Recommended Posts

		<script src="phaser.js"></script>
		<h1>Card Game</h1>
	    var config = {
	        type: Phaser.AUTO,
	        width: 1200,
	        height: 1000,
	        scene: {
	            preload: preload,
	            create: create,
	            update: update

	    game = new Phaser.Game(config);

	    var counter = 0;

	    function preload ()
	        this.load.image('background', 'assets/background.jpg');
	        this.load.image('wolf', 'assets/wolf.png')

	    function create ()
	        this.add.image(600, 500, 'background');

	        creature = this.add.group();
	        creature.inputEnableChildren = true;

	        wolf = creature.create(600, 500, 'wolf');	
	        wolf.onInputDown.add(listener, this);

	    function listener(sprite){

	    function update () {


The code above is supposed to log "click" on the console whenever the wolf image is clicked but instead I get an error


 Uncaught TypeError: Cannot read property 'add' of undefined

after multiple hours of trying to fix it, I conceded and came to ask for help. 


Many thanks in advanced.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...