Search the Community

Showing results for tags 'rotate'.



More search options

  • 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 Platform
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

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 71 results

  1. Hi, Is there a way to tween a rotation between two angles (say -5 to 5 degrees)? I can tween to a single angle and then yoyo; but I'm not sure how to get it to tween between two angles so it rocks back and forth. If possible, I'd prefer to have a single tween rather than two; however if that's the only way, then I'd still be interested to know how to get that to work so that it loops.
  2. I'm making a mode 7 game in java script but I ran into a problem, to turn the perspective I must rotate the image before I draw it. I have tried using the ctx.rotate() function but I don't know how to do this before I draw the image so I can save it as an image object rotated and re-draw it.
  3. Hi guys, See my demo about this issue: http://phaser.azurewebsites.net/runner2/ Set the pivot to rotate the sprite doesn't work Regards, Nicholls
  4. Hello, I try to make a shooter game with Phaser 2 but i encounter problems to rotate the player sprite and the player hitbox in the same time ... I simplidied my code to keep only the rotation of player : function create() { game.physics.startSystem(Phaser.Physics.ARCADE); player = game.add.sprite(200, 200, 'player'); game.physics.arcade.enable(player); player.anchor.set(0.5, 0.5);}function update() { // player rotation player.rotation = game.physics.arcade.angleToPointer(player); // hitbox rotation player.body.rotate = game.physics.arcade.angleToPointer(player); // player.body.rotation = game.physics.arcade.angleToPointer(player);}function render() { game.debug.body(player, "#9090ff", false);}Result : Init : player_rotate1.jpg And when i move the mouse : player_rotate2.jpg And What i try to make : player_rotate3.jpg Second question : Can i change hitbox type into a circle with Arcade library ? I made it with Box2D library : game.physics.box2d.enable(player);player.body.setCircle(14);but i don't want import two librarys ( and i can't rotate the player with this library ) Regards, Spalac
  5. Is it possible to change the default 0 point of a sprite's rotation? So when a sprite rotates to say 135*, 135* becomes the new 0 point? Help is greatly appreciated!
  6. I'd like to get the visual x/y/width/height of a sprite after scaling/skewing/rotating/anchoring it. Can I do that with Phaser? The case: If you flip horizontally a sprite that has {x: 100, y: 100, width: 64, height: 64}, what will your eyes see on the screen? {x: 36, y: 100, width: 64, height: 64}. That's what I'm looking for. However, Phaser tells you:{x: 100, y: 100, width: -64, height: 64}. No big deal, you just do a little math to fix it, kinda like you showed there. That is, if you only scale it. It gets more mathematical when you also change the anchor, and turns into a geometric nightmare if you rotate it too. Phaser is heavily based on Flixel, right? Then my hopes are that you could do it like in Flash, where you can solve all of this by wrapping your sprite into a movieclip and getting the container's x/y/width/height.
  7. mtburdon

    Rotate emitter

    Hi, I'm trying to do something that I thought would be relatively easy, unfortunately I've been unable to find the answer. I have an emitter and I'd like to rotate this around 360 degrees in it's current position. I've tried setting it's angle and rotation but they seem to place it at different locations around the canvas rather than rotating it at it's current spot. Am I missing something? Thanks
  8. 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.
  9. Hi, currently, i've problems to move the ArcRotateCamera correctly around. I came up with this code: translation = BABYLON.Vector3.TransformNormal(translation, this._camera.getWorldMatrix());translation.y = 0;this._camera.target.addInPlace(translation);but the translation in z direction is slower, since the camera is tilted (i need to set translation.y to zero after transformation). Is there a good way to just rotate my desired translation around the y-axis in dependent to the alpha of the ArcRotateCamera? Kind Regards, Chris
  10. Hello guys! I'm trying to create a game with phaser. I have group of sprites hammers. I want loop rotation this sprites, if angle < 45, I want it to rotate to the left. When angle >45, I want it to rotate to the right. Imagine swinging a hammer. Please help me with my problem.
  11. Salvatore

    Rotate Camera

    How to rotate the camera?? Is there a angle method?
  12. I'm working on a game where the player controls a rotating vehicle which can collide with enemies and coins. I'm aware that the sprite body (aka "hit area") can only be a rectangle and it cannot be rotated. So instead, I've created 3 separate invisible sprites that only serve as hit detection areas. These hit areas rotate around the player's axis as the player rotates and this all works fine. See image and github code below, it's just test code where the plane follows the mouse cursor and you can rotate it with the cursor keys:https://github.com/BdR76/phasercollision My question is this:I'm wondering if there is a more efficient way to do this. Is there a way to access the sprites in a group like playerHitGroup.sprites[0] and playerHitGroup.sprites[1] etc.? That way I could just create the sprites in a for-loop and I wouldn't have to keep 3 separate vars for the sprites like the code is now:var dum1;var dum2;var dum3;// setup the player hit spritesdum1 = game.add.sprite(0, 0, null, 0, playerHitGroup);dum1.body.setSize(32, 32);dum1.anchor.setTo(0.5, 0.5);dum2 = game.add.sprite(0, 0, null, 0, playerHitGroup);dum2.body.setSize(32, 32);dum2.anchor.setTo(0.5, 0.5);dum3 = game.add.sprite(0, 0, null, 0, playerHitGroup);dum3.body.setSize(32, 32);dum3.anchor.setTo(0.5, 0.5);
  13. Hi there!! How to rotate Physics.Arcade.body? I've tried set the Physics.Arcade.Body.rotation(after set the allowRotation to true) to be equal to te sprite angle, but, nothing happends...
  14. d13

    Rotate around centre

    Hello! Could someone suggest the best way of making a Pixi sprite rotate around its centre without changing its anchor.x and anchor.y? I want to position sprites based on their top right corners, but make them rotate around their centres.
  15. Hello, I started a small sandbox game with Phaser and I have this problem. I can rotate the car, but collision box does not rotate. I don't understand how to rotate both of them :/ I attached the screenshot and code is here: http://pastebin.com/pUh1jd7L How to rotate the collision box together with the sprite?
  16. Hi people! I want to make the "yellow sprite" rotate around the "red sprite", which would make this code work? Seeing the example of rotation points here I see that it is possible, but how to make it work with sprites instead of points? You can see a picture to better illustrate what I want to do. Thank you!
  17. I'm having an insane amount of difficulty rotating a sprite body with a sprite, and I don't know if I'm doing it right. Since I want rotations to be "in tile", I first do the rotation and then I move the sprite around based on where it should be (ie, rotation of 90 degrees means it has to be moved vertically, -90 means it has to be pushed along the x axis). Then, after setting up some debug, I notice the sprite body is not in the same spot as the sprite, and any attempt to manually set x / y / width / height on the body was in vain. So I ended up trying this: obj.body.polygon.rotate (-angle)*(Math.PI/180)Well, this almost works. First off, I noticed that SAT and Phaser operate in different measures (Phaser - degrees, SAT - radians). Then I noticed that they rotated in different directions, so I had to make it negative to make it rotate the right direction. Now, the one part I can't get past, is that they rotate around different points (Phaser - bottom left, SAT - top left). Is there an easy way to rotate the sprite body too? edit: I should add that I also have tried to manually position the bounding box to no avail.
  18. What I expect from forceOrientation(false, true, 'orientation') is nice orientation image in landscape. What I got is slightly different. Vertically distorted in chrome and scaled down image everywhere else. Is there any way to get around this?
  19. Hi, all, I have learned Phaser for a couple of days. I have encountered a weird problem. In the create() section, this.sets = this.game.add.group(); // sets is a group this.sets.x = this.game.world.centerX; this.sets.y = this.game.world.centerY+40; this.player = this.sets.create(0, 0, 'player'); // add player to sets this.arrow = this.sets.create(0, -220, 'arrow'); // add arrow to sets this.arrow.body.immovable = true; this.sets.setAll('anchor.x', 0.5); this.sets.setAll('anchor.y', 0.5); In the update() section, this.game.physics.collide(this.player, this.arrow); When the player move to the arrow, the collision works well.But when I rotate the sets, the collision does not work, the player and the arrow can be overlapped. Any ideas? Thanks a lot.
  20. rea

    Group rotation

    Hi, I started to create a simple game - tetris. Unfortunately I have 2 problems: - how to move group rotation point from top left corner to the center? - is there a possibility to check collision when moving group by change x property (I override tween, but it still moves down)?