Jump to content

TypeError: game[extend].extend is not a function


Recommended Posts

Hi all.


I've just started playing around with PandaJS and am very impressed so far.


However, the demo I've throw together in 1.10.1 doesn't work in 1.13.1: -


TypeError: game[extend].extend is not a function
return game[name] = game[extend].extend(content);


I've tracked it down to this code: -


game.createClass('Player', 'Sprite', {





Can anyone shed some light on what I'm doing wrong?


Thanks in advance.

Link to comment
Share on other sites

  • 8 months later...

whats mean "should not extend Pixi classes" 

Code is dev.html which downloaded from panda.js 

if need to do extend pixi classes why they didnt do it for us ?


Im just beginner.

<!DOCTYPE html><html><head>    <meta charset="utf-8">    <title>Online -</title>    <script type="text/javascript" src="src/game/config.js"></script>    <script type="text/javascript" src="src/engine/core.js"></script>		<script type="text/javascript">game.module(    'game.main').body(function() {game.addAsset('panda.png');game.createClass('Panda', 'Sprite', {		interactive: true,	mouse: {x:100, y: 100},		init: function(x, y){		this._super('panda.png', x, y, {anchor: { x: 0.5, y: 0.5 }});		this.position = {x: x, y: y};		//body        this.body = new game.Body({            position: { x: x, y: y },            velocityLimit: { x: 150, y: 150 },            velocity: {x:-100,y:-50},            collisionGroup: 1,            collideAgainst: 0,            mass: 0        });        this.body.addShape(new game.Rectangle(60, 60));		//add sprite to scene        game.scene.addObject(this);        //add body of this sprite to the world object        game.scene.world.addBody(this.body);        //add sprite to display container        game.scene.stage.addChild(this);	},	    update: function(){		this.position.x = this.body.position.x;		this.position.y = this.body.position.y;        this.body.velocity.x = (this.mouse.x - this.body.position.x);        this.body.velocity.y = (this.mouse.y - this.body.position.y);    },    remove: function() {        game.scene.removeObject(this);        game.scene.world.removeBody(this.body);        game.scene.stage.removeChild(this);    },        mousemove: function(e) {		this.mouse.x = e.global.x;		this.mouse.y = e.global.y;    }    });game.createScene('Main', {    backgroundColor: 0xb9bec7,    init: function() {		this.world = new game.World(0, 0);				var panda = new game.Panda(300,200);    }});});		</script></head><body></body></html>
Link to comment
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...