Jump to content

Bruce Wang

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by Bruce Wang

  1. Hello, I finally made it work properly, at least for my animation case. Please replace CCSpriter.x/cpp file on my previous project files. Now we just need to speed up the performance, because currently my code calculates position and angle on the fly. Regards., Bruce. CCSpriterX_20130424.zip
  2. Revised Hello, I did some improvement on the angle calculation. Again you unpack the Zip file attached and overwrite source files in the 'Classes' folder and add resources in the 'Resources' folder to your Xcode project. Angle calucation almost works fine, but still my animation behaves not so fancy. The problematic part is line 1042~1049 of CCSpriterX.cpp, where you can transform the angles as per the time changes, or just use that one of the first keyframe. If you just use the angle value of the first keyframe then you will see the position is just fine only the angular movement is not happening. And if you use my calculated angle transfromation, it moves but slight ugly behaviors you will see. So I belive If I or anyone of you can revise this angluar problem then this will be much better. 20130422.zip
  3. Hi, Did anyone come up with any improvement? This Friday I gave it a shot for simplifying the problems so that you can catch up the problematic part. Download and unpack the attached ZIP file and you will find 'Classes' and 'Resources' folder. Overwrite the CCSpriterX.cpp/h, and HelloWorldScene.cpp of Dr. Watson's original code and add the resources inside the 'Resources' folder into your XCode project. I made very very simple SpriterX animations with bone object to simplify the problems. This test seems to be working, but sadly in my actual project which uses more complex animations the result is not so good. More precisely, I call 'calculate_rotation' function in the 'Animation::Update' to transform the location and angles per time changes but this is the place where problem occurs (test project is working fine). And I removed all the 'pre-calculation' of the positions and angles to test my new logic. This must be done for better performances... 20130420_2.zip
  4. Hi, I think your reply was filtered from my Gmail account. I didn't notice that someone replied to my post. I was waiting for Dr. Watson's response and still my angle calculation is not so good so I thought I better wait rather than disclose. But I decided to open, because I think my plist, sprite change, and bone support will be helpful to you guys. Please check the attachment and please share if you solve my angle calculation problem. Regarding the implementation, I tried use transparent CCNodes for handling bones but I was not able to set positions for each sub nodes to the places I intended, and if I apply the scale factor the final result became very ugly. So I did calculations for each level of bones manually. My test sample (scml) is very simple one os even though it had 3 or more depth of bones, the final scale factor for each sprite became just 1.0f. Actually the designer here didn't want to squeeeze the images he/she made. So maybe mine is not so perfect for handling your very complex animations. The biggest problem is handling 'angle's between the time lines. I am sorry for opening mine in this stage but it is not that ugly than you think. The static function static CCSpriterX* create(const char *filename, const char *plist); creates a CCSpriterX nodes from the plist. You just make your animation with Spriter tool with separate images (because the tool itself don't support plist yet), and you pack those with tools like TexturePacker. Then you just need plist, png, and scml files for creating your own CCSpriter node. And if you need to change the sprite, or the 'parts' of the animation, you get the CCSprite node from the animation by using following member function. cocos2d::CCSprite *getSprite(int folderId, int fileId); If you open the *.scml file, you will see the images are under 'folder' node (of XML file) and the animation happens each 'file' (leaf of the XML file). Each leaf (file)s are represented by CCSprite. So if you know the index number of 'folder' and 'file', you can get the CCSprite node for them and you just change the contents (texture) of the sprite you want to replace. Finally, as you see mine is not so perfect and I was not able to focus on that because of other work priorities BUT I disclose mine at this stage because it will be good that my humble changes are helpful to you, and surely someone will can solve it simply. If you have another good solution, please SHARE. I'd like to be the first one when you share yours here, and let me know via my e-mail address. (brucewang.korea @ gmail . com) Best regards, Bruce. CCSpriter.zip
  5. Hi @dr_watson, I wrote a message on your board but I wonder if you can check this board. I did some update for your CCSpriterX class to support Bones and PLIST (also changing sprites) but stuck with a problem calculating angles. It will be nice if you can check my code and release the new code on public. Either you can give me an e-mail or just write a reply on this post. Best regards., Bruce.
×
×
  • Create New...