Hello,
I would like to know if it’s possible to slice objects (ie. Fruit Ninja) into two separate objects. If it is, how would you suggest to accomplish this?
Thanks, [import]uid: 32726 topic_id: 8946 reply_id: 308946[/import]
Hello,
I would like to know if it’s possible to slice objects (ie. Fruit Ninja) into two separate objects. If it is, how would you suggest to accomplish this?
Thanks, [import]uid: 32726 topic_id: 8946 reply_id: 308946[/import]
This can’t be done automatically as Corona doesn’t give you control over the texture vertices. You need to create 2 new objects and maybe work with a mask on each object to cover the cut off area. [import]uid: 5712 topic_id: 8946 reply_id: 32711[/import]
To expand on what Mike said (create 2 new objects), I’m pretty sure that’s what Fruit Ninja does.
If you play around with it you’ll see the fruits are always cut in half – it’s especially easy to see on the bananas. Even if you slice them lengthwise it shows up as two pieces cut the short way.
Plus, there’s a little “splash” (explosion) that happens when you slice and that helps camouflage switching from one object to two objects.
So to create that effect, code your slice routine and when you get a hit, use orangeHalf1 = display.newImage() and orangeHalf2 = display.newImage() to create the two halves, set their X/Y coords based on orange.x and orange.y,. and then use orange:removeSelf() to get rid of the the intact fruit.
Assuming you make those objects physics objects, you’ll probably want to apply a random force to each so they don’t just drop straight down. Look at the physics API, things like applyAngularImpulse( ), etc.
Plus, you’ll probably want to use movieclips or sprites so the fruit can “tumble” as it falls.
Lots of cool things to dig into. I wish I had more time!
Jay
[import]uid: 9440 topic_id: 8946 reply_id: 32726[/import]
That sounds easy to do for an expert:-)
[import]uid: 37854 topic_id: 8946 reply_id: 32766[/import]
how about another iphone game “iSlash”
http://www.youtube.com/watch?v=FcwZ_qRWBDg [import]uid: 12088 topic_id: 8946 reply_id: 32785[/import]
yuewah, what MikeHart said would also apply to the game in the video you linked to, so unfortunately not possible at this time.
J.A. your suggestions about mock ups are great; reading it makes me want to go and have a go at remaking Sushi Slice as a real slice game rather than, well, what it is right now
Peach [import]uid: 52491 topic_id: 8946 reply_id: 33379[/import]
Peach, imho it is possible already with a little bit of Math and clever use of masks. [import]uid: 5712 topic_id: 8946 reply_id: 33558[/import]
MikeHart, perhaps something I should explore more - although honestly I can’t imagine a way to create it realistically at this time although I suppose anything is possible if willing to devote enough time to experimenting with code.
Not enough hours in the day! [import]uid: 52491 topic_id: 8946 reply_id: 33592[/import]
Check out the example on this page… might be a good place to start…
https://code.google.com/p/quickb2/
B
I agree with MikeHart: this shouldn’t even be this hard with the use of masks.
Check out the example on this page… might be a good place to start…
https://code.google.com/p/quickb2/
B
I agree with MikeHart: this shouldn’t even be this hard with the use of masks.