Hello everyone,
I was looking for slash effect when the user swipe his finger on screen that will look like Fruit Ninja (arrow shape getting thinner).
CCMoitionStreak wasn’t very satisfying - it was too sharp in the corners, it didn’t has an arrow shape and didn’t get thinner.
So I found CCBlade here:
I ported it to C++ and test it in Marmalade platform, the results are great!
here you can see it in action in my game, Rolly Poly:
[[http://www.youtube.com/watch?v=5jHBgKSzij0]]
The code, of course, is attached. the usage is very simple - just add TouchTrailLayer::node() to your scene as a child.
Big thanks to Ngo Duc Hiep who wrote this wonderful class in the first place.
P.S - there might be a small memory leak, I didn’t find it yet, if anyone will find something, please post it here.
(ignore .h and .cpp attached files, the updated version is attached - ccblade.zip)
I guess so, I started working on it when cocos2d-airplay extension wasn’t official and was only a post of a forum discussions.
Btw - my game is already available for download: http://www.roymam.com/rollypoly/getfullversion.php
The slash effect on the version you installed is the older one and uses CCMoitionStreak, the new one (with CCBlade) hasn’t been published yet.
I’m planning to release it on Android too later, My Marmalade license currently doesn’t allow it.
I also tried to import it. However, it looks there are some defects on the code.
From original CCBlade example, it continues to be added to layer every time we want to draw a blade. It will not be destroyed or remove from parent.
Therefore, after you run the game with 900+ blades, the system crashes.
Note: You cannot delete the blade manually after it finish rendering. If you do it, the system crash instantly.
you right, the blade is never deleted unless you delete the parent.
I added “getParent()->removeChild(this,true)” after the blade is faded, I used schedule to run it because when running inside the draw() function the system crash.
try it now. flie (ccblade.zip) is attached.
you right, the blade is never deleted unless you delete the parent.
I added “getParent()->removeChild(this,true)” after the blade is faded, I used schedule to run it because when running inside the draw() function the system crash.
try it now. file (ccblade.zip) is attached.
I can compile example successfully. However, it can show Cocos2d startup image but no further action. There is no error message.
2012-02-15 19:16:59.736 Example[2668:207] cocos2d: compiled with Affine Matrix transformation in CCNode : YES
2012-02-15 19:16:59.736 Example[2668:207] cocos2d: compiled with Profiling Support: NO
2012-02-15 19:16:59.744 Example[2668:207] Retina Display Not supported
2012-02-15 19:16:59.797 Example[2668:207] cocos2d: Frame interval: 1
2012-02-15 19:16:59.800 Example[2668:207] cocos2d: surface size: 320x480
I am using Base SDK iphone device 4.0 and iPhone OS Deployment Target iPhone OS 3.2.
Would you please give me some advice to fix it?
Thanks.