The engine behind Splitter Flash game : working code

I think we finally have a working slicing engine. It started with The engine behind Splitter Flash game, then come The engine behind Splitter Flash game – first AS3 prototype and The engine behind Splitter Flash game – new AS3 prototypes.

Now Guillaume Pommey aka pompom sent us a working version.

I revised my prototype of slicing engine two days ago and I corrected a lot of errors. After an afternoon on my code, I resolved almost all my problems.

I am proud ^^, now the slicing engine works.

I joint the Main.as and the .fla cause I use radio button to change the cutter style, I let you discover it :) .

Ps : Don’t forget that I use the Raycast function so speak about this on your blog.

For more information about Raycast function check Box2D Raycasts post.

The engine works perfectly, and has two ways of cutting objects: the laser mode cuts objects when you press C while the cutter one lets you cut by drawing a line.

Here it is the source code:

And this is the result:

Download the full source code with all needed libraries.

  • Niall Lavigne

    Wow, great job pompom! Looks like it must’ve been pretty difficult to figure out. One thing though, I can’t seem to cut the longest rectangle with the Cutter tool.

  • Works nice, but code is awful ;)

  • Niall Lavigne

    Oh, just noticed that the uncuttable rectangle is for using the laser, never mind :P

  • miyijura

    Beautiful work…this application have a lot of uses. I will be expecting more tuts from you.

    Thanks!

  • This is really incredible.

    Nice work Pompom.

  • Gawd

    The laser was very interesting.

  • pyrite

    It works but if you try to cut the box through a corner it wont work. It would be good if you could find a fix.

  • getting an error

    i speculate that it occurred because i threw the laser box out to the left, which eventually fell out of the world.

    great work pompom
    could use a reset button, so i can have more slicing fun :)

  • Pingback: Triqui’s Picks #10 : Emanuele Feronato - italian geek and PROgrammer()

  • Bruno

    Someone can make this version with the last box2D? 2.1.2?

    Seems everything has changed =/