• Content Count

  • Joined

  • Last visited

About m4uro

  • Rank

Contact Methods

  • Twitter

Recent Profile Visitors

709 profile views
  1. m4uro

    Sorting groups

    Can someone please post the workaround for this problem? I'm really stuck with it :/ . Thanks!
  2. To flip the sprites, reverse the sign of the scale property: sprite.scale.x *= -1; //flip horizontally sprite.scale.y *= -1; //flip vertically Remember to set the anchor properly, generally: sprite.anchor.setTo(0.5, 0.5); //so the texture of the sprite is centered
  3. I have two groups of sprites, one containing trees, and another one containing characters. I want to sort them with the group.sort() function, but in order to do that I would need to put them in other, bigger group. However, I can't do that with the approach taken in the example of "sub groups", because when I do it that way, the _container has other containers as its children, instead of the actual sprites. What is the best/easiest way to accomplish this, without losing the flexibility of having separate groups for trees and characters?
  4. Yes, I didn't want to do that because it would export all the frames as a single animation, with the same name, but fixing that should be easier than the alternatives. Thanks rich!
  5. I still think that there is some kind of confusion with the issue I'm having, but I really appreciate the effort you are doing in trying to understand me rich!! (Thanks! ) I'll quote something the flash user said in a later post of the link i posted before, with the hope of making myself clear:
  6. Yeah, the problem could definitely be solved if I were able to export all the frames with an identical size. I am by no means a flash expert, and I learned to make and export animations that way, however I guess that is the correct way, because the other option would imply wasted space in the spritesheet, just to fill the empty space of a "transparent" background that matches the biggest height and width of all of the animation frames. Anyway, If this kind of problem is not familiar to you, maybe I should try to solve it in the context of flash, as you say, instead of in the context of phaser. I attach the spritesheet for reference. And this is a sample of the json atlas (I am not able to attach it as a file): {"frames": [{ "filename": "Wizard_Attack0000", "frame": {"x":1,"y":1,"w":33,"h":85}, "rotated": false, "trimmed": true, "spriteSourceSize": {"x":3,"y":0,"w":33,"h":85}, "sourceSize": {"w":80,"h":85}, "regPoint": {"x":17.6,"y":84.15}},{ "filename": "Wizard_Attack0001", "frame": {"x":35,"y":1,"w":33,"h":83}, "rotated": false, "trimmed": true, "spriteSourceSize": {"x":3,"y":2,"w":33,"h":83}, "sourceSize": {"w":80,"h":85}, "regPoint": {"x":17.6,"y":84.15}},As I said before, I added the registration Point information.
  7. The atlas currently has 3 animations, and each have between 15 and 30 frames. But I don't think the problem is related to the sprite sheet size. Maybe my problem can be best understood in this link posted by another person, he seemed to be having the exact same issue: http://forums.adobe.com/thread/1230558 The workaround I'm trying would be basically something like: //when changing animations: sprite.y = //reset offset sprite.x = //reset offset sprite.animations.play('idle', null, true);sprite.y += offsetY('idle'); //where offsetY returns the y offset for a given animation sprite.x += offsetX('idle'); //where offsetX returns the x offset for a given animation But I would have to do this each time I change the played animation, for each animation. I just want to know if this is the only/best thing I can do. Also, when I tried this in the way I described, the position of the sprite is updated on the screen one frame before the animation is changed, and it plays a single frame of the old animation, creating a 'visual glitch', because of that single frame that is displayed out of place. That is odd to me, because when I debug it, the sprite shows the new animation in 'currentAnimation' and 'currentFrame', but the rendered image is of the previous one. As I said, this just happens during only one frame when I change animations, but it is visually disturbing anyway.
  8. Hi, I've run into some trouble while trying to align some animations of a character. I made the character in Adobe flash CS6 and used its new tool to generate a spritesheet + atlas json file of several animations of the same character (walk, attack, idle, etc). Each animation is correctly animated and displayed individually, however, when I switch in-between them, I find they are not aligned, that is, there is no common reference point between the animations, so when I switch from, let's say, idle to attack, the character seems to "move" to another position. I managed to modify the plugin used by adobe flash to generate the spritesheet, so that it includes the registration Point of each individual animation (of each movie clip), so I currently have that information in my json file. I guess that is a good actual reference point between the animations (correct me if I'm wrong), I located it at the 'feet' of my character in each movie clip. So now, having that data, what is the most efficient way to use it with Phaser to solve this problem. Do I have to offset the position manually every time I switch the animation? is there no better way? is this a common problem, or am I doing something wrong from the beginning? Any help would be greatly appreciated