Jump to content

Search the Community

Showing results for tags 'sprite rotation'.

  • 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 4 results

  1. Hi, I have been generating planet systems. All planets are set to pivot around the same point. There is no physics involved, just static display. this.planetSprite = game.add.sprite(x, y, skin); this.planetSprite.scale.setTo(size); this.planetSprite.anchor.setTo(0.5); this.planetSprite.pivot.x = orbite/size; this.planetSprite.rotation = getRandomInt(0,360); The rotation and display is working fine but the coordinates are not updated after rotation. Is there a specific property to call to get new coordinates or should I manually calculate it? thanks
  2. So im trying to do a space shooter based on p2 physics thrust exemple. in the create method : game.physics.startSystem(Phaser.Physics.P2JS); game.physics.p2.defaultRestitution = 0.5; this.bullets = game.add.group(); this.bullets.enableBody = true; //this.bullets.physicsBodyType = Phaser.Physics.P2JS; this.bullets.createMultiple(8, 'laser'); this.bullets.setAll('anchor.x', 0.5); this.bullets.setAll('anchor.y', 0.5); Then in the update method i call this function fire: function () { if (this.time.now > this.bulletTime) { var bullet = this.bullets.getFirstExists(false); var p1 = new Phaser.Point(this.ship.x, this.ship.y); var p2 = new Phaser.Point(this.ship.x, this.ship.y - 80); p2.rotate(p1.x, p1.y, this.ship.rotation, false); if (bullet) { bullet.reset(p2.x, p2.y); bullet.lifespan = this.bulletLifespan; bullet.rotation = this.ship.rotation; this.bulletTime = this.time.now + 250; } } } As you noticed I commented the line about settings groups physics to P2JS. The rotation of the laser sprite and its relative positioning to the ship is perfect but right after I uncomment the line; the laser sprite no longer rotate. Its positionning is still relative to the ship rotation but the laser sprite stays straight (point to the top of the screen as the inital image is). Is it suggested to choose ARCADE physics for games using rotations? Also, which property of bullet should i call to make it move on the current angle and direction? Thx
  3. Hello developers, I want to ask you a question ( it could be silly but I can't find anything that works in the forum or other articles ). I want to rotate one line around a circle and I will attach an image to understand me perfectly what i mean. So i searched a lot about rotation of sprites with Phaser but I can't find a working example or a working function that will do what I want. I'm pretty sure my thing is not a big deal so it should be available to be done. I hope you can help me, Nick.
  4. Hi, Im developing a turnbased football game with a ball and players. I developed a ball object extending a sprite and a player object extending a sprite. If you click a player you get an endpoint that you can drag around. When you press play the player will either run or shoot the ball in the direction of endpoint. My problem is that when I move around the endpoint Id like the player to rotate in the direction of the endpoint. This works, but if the player has the ball Id like that to rotate to (but the ball should more like orbite the player). Now the ball just rotates. I use this code to rotate the player (please dont ask me why I use +1.6 but otherwise the player doesnt follow my endpoint): this.rotation = game.physics.arcade.angleBetween(this, this.endpoint)+1.6; What I tried so far I've tried pivot but cant get that to work (dont ask me about the numbers ) this.ball.pivot.x = -1.8;this.ball.pivot.y = -0.1;this.ball.angle += 10;this.ball.angle = parseFloat(game.physics.arcade.angleBetween(this, this.endpoint)+1.57).toFixed(2)*100; I've tried to put the player and ball in a group. This works, but I run in to other problems when the ball should be shoot towards the endpoint and the player should stand still. game.physics.arcade.moveToXY(this,this.player.endpoint.x,this.player.endpoint.y,this.player.pass,0) The above code is part of my Ball object. It works if the player and ball is not in a group. If possible Id like to keep the ball and player as separate objects and not in a group. Anyone knows how I can get my ball to orbite around my player as the player rotates? Thanks
×
×
  • Create New...