Jump to content

Converting from 1.1.3 to 1.1.5 using states issues


ZRT
 Share

Recommended Posts

Hey guys,

 

I'm trying to recreate something I did in 1.1.3 to 1.1.5 but with states. Amongst few other issues, I encountered this one and hit a wall.

 

I'm getting this error. I checked this thread but I don't think it's the same issue.

 

Uncaught TypeError: Cannot read property 'baseTexture' of undefined

Game.Play.prototype = {  create: function() {      // create player      this.player = game.add.sprite(50, 100, 'player');      this.player.body.gravity.y = 7;      this.player.outOfBoundsKill = false;          // create obstacles      this.ob = game.add.group();      this.ob.createMultiple(10, 100,'enemy');      this.ob.anchor.setTo(1,1);      this.ob.body.velocity.x = -400;    },

Basically, I'm trying to recreate this, which works fine in 1.1.3 (without using states), although it might be little ugly chuck of code. :)

function createObstacles() {  // create bottom obstacles  ob = obstaclesBottom.create(game.world.width, game.world.height, 'obstacle');  ob.anchor.setTo(1,1);  ob.events.onOutOfBounds.add(obstaclesResetBottom);  ob.events.onOutOfBounds.add(gameScore);  ob.body.velocity.x = -400;  // create top obstacles  obt = obstaclesTop.create(game.world.width, 0, 'obstacle');  obt.events.onOutOfBounds.add(obstaclesResetTop)  ob.events.onOutOfBounds.add(gameScore);  obt.body.velocity.x = -400;}

Thanks.

Link to comment
Share on other sites

Seems I had the createMultiple wrong. :) Problem is solved with this code, after I reverted back to 1.1.3.

    this.obstacles = game.add.group();    this.ob = this.obstacles.create(this.game.world.width + Math.random() * 2000, 0, 'obstacle');    this.ob.body.velocity.x = -200;
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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