Jump to content

Search the Community

Showing results for tags 'random placement overlapping'.

  • 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. Hello game makers, I'm making my first game wherein the target/enemies appear randomly on the screen and go off the screen after a specific time. I've got most of it figured out, but the only problem I'm facing is how do I place them randomly such that they do not overlap each other. Here's my code to create enemies. addTargetToGroup: function() { // Add Target var targetInsideWidth = this.game.stage.bounds.width - this.cache.getImage('target').width; var targetInsideHeight = this.game.stage.bounds.height - this.cache.getImage('target').height; this.newTarget = this.targetGroup.create(this.rnd.integerInRange(0, targetInsideWidth), this.rnd.integerInRange(0, targetInsideHeight), 'target', 0); this.newTarget.anchor.setTo(0.5, 0.5); this.newTarget.enableBody = true; // Add different animations for target hit this.newTarget.animations.add('gunHit', [0,1,0]); this.newTarget.animations.add('balloonHit', [1,0,1,1,0,1,1,0,1,1,0,1]); ; this.newTarget.uniqueId = 'targetId-'+i; i++; this.newTarget.spawnedIndex = spawnArea.indexOf(targetLocation); // console.log(this.newTarget.spawnedIndex) // Enable click on targets this.newTarget.inputEnabled = true; this.newTarget.events.onInputDown.add(this.hitTarget); },Any help would be great. Cheers
×
×
  • Create New...