Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I now have nearly completed a Cut The Rope type game. I need only a swipe mechanic to cut the rope, both the logic and the visual effect. Suggestions would be most welcome.

I only need a concept for what to do in this situation. I tried doing it in two ways already, but I don't satisfied with it.

  1. I used a particle system, but I get random points on the screen. So the effect does not convey its meaning. I have following link in which I have implemented a line drawing algorithm with particle system. http://stackoverflow.com/questions/10702328/drawing-line-effect-on-touch-like-fruit-ninja-or-veggie-samurai-in-and-engine

  2. I used a simple and single sprite, and perform scale, transformation, and rotation but I don't get desire effect that looks perfect for rope cutting.

I have knowledge about CCBlade class in cocos2d but I found it difficult to convert it into Java.

Any help is greatly appreciated.

share|improve this question
    
what exactly is the question about ? to drawing the cutting-line or the cutting particle effect ? –  Ace Apr 22 '13 at 16:43
    
Any one for which you can provide help. I want to create basic animation that look like user cut the rope. –  Siddharth Apr 22 '13 at 16:45
    
You might want to look up a simple tutorial for a paint program. It's the same basic functionality (arbitrary curved line derived from finger movement) so it should give you what you need if Ace's answer isn't quite what serves your specific game. –  Attackfarm Apr 22 '13 at 18:22
add comment

3 Answers

up vote 3 down vote accepted

Here in the following link I post my code that I used to create ninja swipe effect.

http://www.andengine.org/forums/gles1/draw-gl10-gl-triangle-strip-fruit-ninja-swipe-effect-t7257.html

This link contains whole discussion about this topic but at last I post my code and image so any user can immediately create this effect.

share|improve this answer
add comment

For the cutting-line drawing, I could think of a simple logic that tracks user input with a short interval and draws lines from the tracked points like this ->

If the user is cutting ( touching the screen / mouse down + move ) you could check the cursor position point in a desired interval, and draw a line from the last point to the current point until user stops cutting ( mouse up ).

While cutting ( mouse move ), vou could apply a simple particle system where the emitter is following the input position. play with some values in the particle system to make sure that the spawning point is just in place, by applying a force ( gravity ) you can make the particles fall down. Play with the lifetime value.

To animate the "rope" that is been cut, you could define a "force" value to the rope. By detecting if the rope and the cutting-line are overlapping, you can define the cutting point, where the animation starts, the upper end of the rope is just pushed up a little bit ( defined by the force of the rope ) and the lower end is just falling down.

I think you'll find some good techniques on "chain animation" or something. This would be a little bit of work to the physics engine.

Well, this is just my theory. I have never done this kind of game before.

I hope this idea helps you find your solution.

share|improve this answer
    
Only you try respond is great thing for me. On android device when I implement line drawing algorithm again I got doted particle line. I can't able to get perfect line.So what to do for this? –  Siddharth Apr 22 '13 at 17:04
1  
I up vote your answer because you give me some guidance what to do in this situation because other people only doing down voting not event try to answer. –  Siddharth Apr 22 '13 at 17:23
    
jou can just use a simple drawLine function but it you want to use a particle system for the line drawing, try to change the emitter values so you dont have any force or gravity to yout LINE-particles, to they will stay in place, also pump up the spawning interval, to make sure that you dont have any gaps in your line. –  Ace Apr 22 '13 at 17:24
    
also make sure that you dont have too much particles, so you system won't be overload. to do this you could check if the moved distance is far or not, and devide it into a good nomber of spawning particles. –  Ace Apr 22 '13 at 17:26
    
Yes I got your point and try to implement same thing. I reply you tomorrow because this thing I have to implement it at office. –  Siddharth Apr 22 '13 at 17:30
show 4 more comments

I might do it this way... I wrote a game that had a throwing mechanic using the mouse, and its similar. I'm also assuming you are using touch primarily.

Get the time when your finger touches the screen. On the touch move callback, see how much time has passed and how far you have gone from the original point. You can get the distance using Pythagoreaus' theorem (sqrt(x^2 + y^2)). Set a threshold for the swipe to trigger. If the distance traveled / time taken >= threshold, trigger the swipe functionality. It's a basic software accelerometer, but should be effective.

I might also have a stop time condition because you don't want your slash to go on forever.

share|improve this answer
1  
I up voted your answer because you at least spare some time to answer my question. Again I do this thing in some different way that link I provide as answer so that other user can take benefit from it. –  Siddharth Apr 23 '13 at 17:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.