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

0 favourites
  • 12 posts
From the Asset Store
80 pieces of loopable game music, 10 game overs and 10 level complete pieces.
  • 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.

  • 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.

  • 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

  • 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.

  • 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

  • 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.

  • hi,

    this is my idea, you can seek another idea.

  • >

    > 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

  • 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

  • >

    > >

    > > 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.

  • you could try using blendmodes https://dl.dropboxusercontent.com/u/139 ... dmode.capx

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • you could try using blendmodes https://dl.dropboxusercontent.com/u/139 ... dmode.capx

    Thanks for the input. I think I see what you're getting at, but I don't see how it eliminates the need for me to create tons of sprites...

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)