How do I break a sprite into 2 pieces wherever I click/drag?

Get help using Construct 2

Post » Tue May 27, 2014 4:19 pm

The fruit-cutting example shown at http://www.scirra.com/arcade/addicting-example-games/2456/orange-ninja requires a separate pre-made sprite of half an orange to be spawned when the orange sprite is click/dragged across. That means that every single cut will result in exactly half an orange, sliced right across the middle, & the remaining pieces can't be cut again.

The game shown here http://www.flasharcadegamessite.com/25012-Viking-Ice-Breaker.html (Viking Ice Breaker) clearly uses a different mechanic. In this game, the image breaks into 2 pieces WHEREVER the mouse drags across. I have serious doubts that they made a separate sprite for each possible length, angle, & location of the slice.

So, how do I break a sprite into 2 pieces wherever I click/drag?

Thanks in advance for any advice.
Phase 1: Collect Underpants.
Phase 2: ????
Phase 3: Profit!
B
16
S
5
G
4
Posts: 106
Reputation: 2,450

Post » Wed May 28, 2014 12:20 pm

Maybe you can cheat by using the first technique on objects with symmetry ?
If you have a black disc with one or two "slices" in it (by slice I mean "ways of cutting the disc). Since the dics is symmetrical, you could just rotate the disc so that the entry point of the slicing animation is set to the contact point between the disc and the mouse.

Mouse enters the disc, the disc rotates so that the beginning of the slicing is set to "mouse.X, mouse.Y" and voilà!

I admit it's a very "low tech" answer.
B
3
Posts: 13
Reputation: 303

Post » Wed May 28, 2014 1:45 pm

This is a really complicated effect, I would not encourage you to go this far if you are a beginner but, Rojohound made an example on this with the canvas plugin

ah, here it is
B
42
S
17
G
17
Posts: 2,247
Reputation: 17,461

Post » Wed May 28, 2014 1:48 pm

Hello,
nothing is special, there is only one technic.
they spawned the breaked sprite at the same position(X, Y) of the collision.
you can draw a breaked spirit at Photoshop, Inkscape and spawn it.
2D Game GUI Designer
B
12
S
4
G
3
Posts: 130
Reputation: 3,778

Post » Thu May 29, 2014 5:09 pm

Whiteclaws wrote:This is a really complicated effect, I would not encourage you to go this far if you are a beginner but, Rojohound made an example on this with the canvas plugin


Thanks for the link, I'll start there. I guess I'm moving past the beginner level & into the experimental stage. I'm totally expecting this to be complicated, because if it was easy there wouldn't be so many people claiming it's impossible. The Canvas plugin is pretty amazing (even if i don't fully understand it yet). It's all about learning.
Thanks again for the tip
Phase 1: Collect Underpants.
Phase 2: ????
Phase 3: Profit!
B
16
S
5
G
4
Posts: 106
Reputation: 2,450

Post » Thu May 29, 2014 5:13 pm

Manarsoft wrote:they spawned the breaked sprite at the same position(X, Y) of the collision.
you can draw a breaked spirit at Photoshop, Inkscape and spawn it.


That would require literally hundreds (if not thousands) of pre-drawn sprites for each image that could be cut.
Phase 1: Collect Underpants.
Phase 2: ????
Phase 3: Profit!
B
16
S
5
G
4
Posts: 106
Reputation: 2,450

Post » Thu May 29, 2014 9:13 pm

hi,
this is my idea, you can seek another idea.
2D Game GUI Designer
B
12
S
4
G
3
Posts: 130
Reputation: 3,778

Post » Sat May 31, 2014 9:08 am

miketv wrote:
Manarsoft wrote:they spawned the breaked sprite at the same position(X, Y) of the collision.
you can draw a breaked spirit at Photoshop, Inkscape and spawn it.


That would require literally hundreds (if not thousands) of pre-drawn sprites for each image that could be cut.



I think what hes trying to say is use 2 sprites. One for a full fruit, and one for a halved fruit, then just have it set that halved sprite depending on the angle you swiped, using x,y coords. like x250,y250 to x172,y120 would create a straight angled line from A to B. I hope you find what youre looking for anyway
B
2
Posts: 6
Reputation: 187

Post » Sun Jun 01, 2014 2:10 pm

@pr0ph3t
Well, no every swipe will be a perfect cut (dividing the fruit in the middle) you may cut the fruit at the 3/4, then you'd have 2 non-equal pieces
B
42
S
17
G
17
Posts: 2,247
Reputation: 17,461

Post » Tue Jun 03, 2014 1:57 am

pr0ph3t wrote:
miketv wrote:
Manarsoft wrote:they spawned the breaked sprite at the same position(X, Y) of the collision.
you can draw a breaked spirit at Photoshop, Inkscape and spawn it.


That would require literally hundreds (if not thousands) of pre-drawn sprites for each image that could be cut.


I think what hes trying to say is use 2 sprites. One for a full fruit, and one for a halved fruit, then just have it set that halved sprite depending on the angle you swiped, using x,y coords. like x250,y250 to x172,y120 would create a straight angled line from A to B. I hope you find what youre looking for anyway


I appreciate the input...but like I said in the post (& in the title), I'm looking to cut a sprite into 2 pieces WHEREVER I click/drag. The best I could do with the suggested method is to appear to cut it into previously-drawn sprites. If I click a section of the sprite that's way off to the left or something, the cut would only happen there if I had previously created 2 different sprites that would spawn & meet at that particular point. If i wanted to cut the resulting sprites, I would have had to load 2 more pre-drawn sprites that spawn & meet in the middle. The amount of artwork required grows exponentially using this method. I'm looking for something where I create ONE sprite & program it to be cut ANYWHERE.

I'm working on some experiments using Canvas....it's a challenge, but I think I'm getting there.
Phase 1: Collect Underpants.
Phase 2: ????
Phase 3: Profit!
B
16
S
5
G
4
Posts: 106
Reputation: 2,450

Next

Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests