BatBut

Members
  • Content Count

    6
  • Joined

  • Last visited

About BatBut

  • Rank
    Newbie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. That seems like an interesting approach! I have been working on this too and growing increasingly frustrated with bitmapdata so I had another look at cropping and came up with this solution: //phaser.io/sandbox/cByFYpzH/play It does pretty much everything I need it to in this state, is there a reason you would choose bitmapdata or crop from a functionality standpoint for a use like this?
  2. Hey all! I'm trying to make UI elements that are essentially sprites that act like progress bars in that they fill up or empty out as different things happen. I would like the empty and fill to be smooth and have a bit of animation to it and tweens would be perfect, but the shapes are varied instead of just a rectangle that I can change the height of. Something like the attached image is what I'm talking about but that isn't the sprite that I'm using: I did find this solution here using bitmapdata but it only seems to look right when you're increasing or decreasing it by 1 and any other increments make it jump around. It's also not tweenable so I have concerns about making the animation look smooth and nice. While it doesn't seem to be the right solution in this case, the images in that first post in the link are pretty close to what I'm going for, I think I may just have different requirements I've also looked into stacking two of the same sprite on top of each other and cropping one down to give the illusion of an actual health bar-type thing, but I couldn't get it to work as I'm imagining it. There's every chance that that is the right solution and I just don't know how to write it though. The final game will have several of these in a row to make a visual status bar type thing, so being able to control how full each one is individually is important, which hopefully doesn't make things even more complicated. Thanks for any help at all!
  3. Hey everyone, I am having an issue with accelerationFromRotation sending my player in the wrong direction. I'm setting it up so that the player will be spinning using angularVelocity and when you press space it moves in the direction that it's currently facing. To do that I'm using accelerationFromRotation to get a point then using moveToXY to push them in that direction. This definitely works some of the time, but most of the time it send the player in a seemingly random direction, so I think I'm missing something about how this is meant to work. Could someone enlighten me? Edit: I should add that I know moveToXY will try to move the whole way to the end of the point object which is beyond the screen, so I'm using drag to slow it down so that it is just a shove rather than a fling to the distance This is the function I'm using to move the player: function shunt() { playerRotate = false;//so we know the player isn't spinning while they move player.body.angularVelocity = 0; //actually stopping the spinning var goTo = game.physics.arcade.accelerationFromRotation(player.previousRotation, 300, player.body.acceleration);//to make the point to move towards game.time.events.add(Phaser.Timer.SECOND / 2, slooooow, this); //wait half a second then start rotation again game.physics.arcade.moveToXY(player, goTo.x, goTo.y, 600); //move the player towards the point function slooooow() { playerRotate = true; } }
  4. And of course as soon as I post this I figure out the problem... sigh So it turns out if you set the angular velocity to 0 in the update function, you lose all floppiness...
  5. Hello! I had a look at the forum and couldn't find any advice on this previously (/I don't know the terminology to look up) so I thought I would post and see if anyone could give advice. I am using revolute constraints in my project because I wanted, as you can image, a joint that allows rotation and allows the player to rotate it with keys. The issue is that they are just flopping around the revolution instead of being rigid until the player turns them. I went through the documentation and found other types of constrains, like lock constraints, but they don't seem to work, and I have even tried turning off gravity for the arms to see if that was the issue to no luck. The code for the constraints is below, and I am sure I am missing something obvious so any advice would be great! backConstraint = game.physics.p2.createRevoluteConstraint(player, [-5,-20], backArm, [-20,0.5]); frontConstraint = game.physics.p2.createRevoluteConstraint(player, [-5,-20], frontArm, [-20,0.5]);
  6. Hello! I had a look at the forum and couldn't find any advice on this previously (/I don't know the terminology to look up) so I thought I would post and see if anyone could give advice. I am using revolute constraints in my project because I wanted, as you can image, a joint that allows rotation and allows the player to rotate it with keys. The issue is that they are just flopping around the revolution instead of being rigid until the player turns them. I went through the documentation and found other types of constrains, like lock constraints, but they don't seem to work, and I have even tried turning off gravity for the arms to see if that was the issue to no luck. The code for the constraints is below, and I am sure I am missing something obvious so any advice would be great! backConstraint = game.physics.p2.createRevoluteConstraint(player, [-5,-20], backArm, [-20,0.5]); frontConstraint = game.physics.p2.createRevoluteConstraint(player, [-5,-20], frontArm, [-20,0.5]);