Jump to content

Search the Community

Showing results for tags 'pretty urgent'.

  • 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. Hi guys, working on a project for school I just came accross a problem I can't seem to find a solution about. Here it is : So I have this enemy group rotating. The sprites are moving correcty but the bodies are staying in place because I set them to static = true. I have a gravity going on and I don't want them to be affected by it that's why they're set to static. Here's my code for these : EnemyGroup = function(positionX, positionY, radius, angle, rotateSpeed, clockwise) { Phaser.Group.call(this, game); this.position = {x:positionX, y:positionY}; this.radius = radius; this.pivot.x = positionX; this.pivot.y = positionY; this.angle = angle; this.rotateSpeed = rotateSpeed; this.clockwise = clockwise; this.addChild(new Enemy(this.position.x - this.radius, this.position.y, 0.4)); this.addChild(new Enemy(this.position.x + this.radius, this.position.y, 0.4)); this.addChild(new Enemy(this.position.x, this.position.y - this.radius, 0.4)); this.addChild(new Enemy(this.position.x, this.position.y + this.radius, 0.4)); this.update = function(){ if (this.clockwise) { this.angle += rotateSpeed; } else if (!this.clockwise) { this.angle -= rotateSpeed; } } } EnemyGroup.prototype = Object.create(Phaser.Group.prototype); EnemyGroup.prototype.constructor = EnemyGroup; Enemy = function(positionX, positionY, scale) { Phaser.Sprite.call(this, game, positionX, positionY, 'enemy'); game.physics.p2.enable(this, true); this.body.setCircle(7); this.scale.setTo(scale); this.anchor.setTo(0.5); this.body.setCollisionGroup(enemyCG); this.body.static = true; this.body.collides(playerCG); game.add.existing(this); this.update = function(){ } } Enemy.prototype = Object.create(Phaser.Sprite.prototype); Enemy.prototype.constructor = Enemy; The solution must be quite simple - I just don't see it at the moment. any clue ? Maybe have the rotation happening on single enemies with a pivot based on their parents - instead of rotating the whole group ? Thanks for reading !
×
×
  • Create New...