Jump to content

Search the Community

Showing results for tags 'timed spawn'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • 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

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1 result

  1. Forewarning: semi-newbie Basically, if the user has the left cursor down and a "token" collides with the lftRect, I want to kill the token. For some reason my kill callback function for the collision is not working (below is relevant code): gumballGoGo.Preloader = function(game){ this.player = null; this.ground = null; //this.tokens = null; this.ready = false; }; var cursors, lftInit, rghtInit, ground, testDrp, sprite, tokens, rect, lftRect, ctrRect, rghtRect, lftToken; var total = 0; function lftHit(lftRect, lftToken) { if ( lftInit == true ){ lftToken.kill() } }; gumballGoGo.Preloader.prototype = { preload: function(){ }, create: function() { // LFT BOX lftRect = this.add.sprite(0, this.world.height - 150, null); this.physics.enable(lftRect, Phaser.Physics.ARCADE); lftRect.body.setSize(100, 100, 0, 0); // CNTR BOX ctrRect = this.add.sprite(100, this.world.height - 150, null); this.physics.enable(ctrRect, Phaser.Physics.ARCADE); ctrRect.body.setSize(100, 100, 0, 0); // RGHT BOX rghtRect = this.add.sprite(200, this.world.height - 150, null); this.physics.enable(rghtRect, Phaser.Physics.ARCADE); rghtRect.body.setSize(100, 100, 0, 0); // INIT TOKEN GROUP tokens = this.add.group(); tokens.enableBody = true; this.physics.arcade.enable(tokens); testDrp = tokens.create(125, -50, 'token'); testDrp.body.gravity.y = 300; // CONTROLS this.cursors = this.input.keyboard.createCursorKeys(); }, update: function() { this.ready = true; if (this.cursors.left.isDown) { lftInit = true; } else if (this.cursors.right.isDown) { rghtInit = true; } else { lftInit, rghtInit = false; } if (total < 20) { tokenSpawn(); } this.physics.arcade.collide(lftRect, lftToken, lftHit, null, this); } }; function tokenSpawn() { lftToken = tokens.create(25, -(Math.random() * 800), 'token'); lftToken.body.gravity.y = 300; total++; } PLEASE HELP! The ultimate goal is to recreate this type of gameplay. One additional note: as of now I am dropping "tokens" using a random spawn loop. I'd rather use a timed patter for the token drop. If you have any advice on that please share as well. Thanks :]
×
×
  • Create New...