Jump to content

Search the Community

Showing results for tags 'prefabs'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 3 results

  1. I'm building a scene in Unity3D to export to Babylon which is a typical countryside. It has trees and rocks but to optimise I was going to use the same tree and rock and drop them around the scene in different sizes and directions. Unfortunately this has no effect when I export to Babylon.js. Does anyone know the best way I can have one base tree mesh and one base rock mesh in my .babylon file and refer to those for all the duplicates?
  2. So i'm relatively new to JS and Phaser. I'm using yeoman to scaffold phaser and it is all working fine...except for global variables. I'm too new to coding in general to bend everything to my will. the issue i'm having is trying to get a prefab to talk to the 'play' state. I have a function inside my prefab: var destroyBacon = function() { this.destroy(); this.game.score += 1;}; the 'this.destroy();' works perfectly. but I want for every time I use that function (which is every time I click a sprite from that prefab) to add a point to the 'score'. I get this every time: Uncaught TypeError: Cannot read property 'score' of null I'm not sure if I should even be using the 'this.game.' or where I should put the actual score variable. Ideally, I'd like each of my prefabs (of sprites) to add to the score. any advice would definitely help.
  3. Cross posted from here. I've got a prefab class that inherits from Group. var PipeGroup = function(game, x, y, collisionGroup, collidesWith) {Phaser.Group.call(this, game);var topPipe = this.create(0,0,'pipes');topPipe.physicsEnabled = true;topPipe.body.kinematic = true;topPipe.body.setRectangle();topPipe.body.setCollisionGroup(collisionGroup);topPipe.body.collides(collidesWith);this.x = x;this.y = y,}; PipeGroup.prototype = Object.create(Phaser.Group.prototype);PipeGroup.prototype.constructor = PipeGroup;And in my main game's create function: create = function() { .. this.playerCG = game.physics.createCollisionGroup(); this.pipeCG = game.physics.createCollisionGroup(); // add our player to the stage this.player = this.add.sprite(game.world.width/3,220,'bird'); // enable physics on our player this.player.physicsEnabled = true; // add our player to the player collision group this.player.body.setCollisionGroup(this.playerCG); this.player.body.collides([this.pipeCG], this.death, this); .. game.time.events.loop(Phaser.Timer.SECOND,this.generatePipes, this);}and generatePipes looks like: generatePipes: function() { var pipeY = game.rnd.integerInRange(-120,120); var pipes = new PipeGroup(game,game.world.width + 32, pipeY, this.pipeCG, this.playerCG); this.player.body.collides([this.pipeCG], this.death, this);}However, the player is never colliding with the pipes. Can you modify a collision group after the create phase of a state? I'm a bit at a loss to figure out why this doesn't work.
  • Create New...