hxDaedalus/hxDaedalus-NME-OpenFL-Examples

Implement Fill

Opened this issue · 11 comments

Need to fill the areas you can't click on for clarity or use overlay image.

See #9

well done looks really good like that maybe we could reduce blackness a bit?

For walls or ground?

2015-02-12 20:49 GMT+01:00 Justinfront notifications@github.com:

well done looks really good like that maybe we could reduce blackness a
bit?


Reply to this email directly or view it on GitHub
#7 (comment)
.

well the walls could be a bit less bright and the wall fills a bit lighter, but just working on the hitTest I think I might have solution.

You're talking about the crash issue when referring to hitTest right?

About the colours, it's probably easier to go the other way around (i.e.
have tiled_meshes with the colours you want to display, and modify them
when passed to the mesh builder).

Pick 2 colors and I'll try to go this route and see if it works. ;)

2015-02-12 22:38 GMT+01:00 Justinfront notifications@github.com:

well the walls could be a bit less bright and the wall fills a bit
lighter, but just working on the hitTest I think I might have solution.


Reply to this email directly or view it on GitHub
#7 (comment)
.

Ok I have pushed a hitTest but does not seem to work on js so # !js around it.
Basically it works by checking which possible mesh, and then checking if the entity circle is hitting an edge ( Geom2D.isCircleIntersectingAnyConstraint ) which is no good and if not if it's pixel is not black ( maybe read the code as hard to explain ).
To achieve this I cloned the bitmapData incase someone wants to modify it later with some fun threshold code ;) I think this approach is lighter than finding the mesh path. By the way did you notice you can path find within the walls on previous version if you click twice within! I don't know if you have a solution to js ( not tried android/desktop yet ) or tracked down what it's likely to be. But I have left this problem for another time unless you have a quick fix :).

I updated the text above to be more readable.

Ok I changed mouse up to mouse down to make it feel more responsive.

For the js problem... seems related to getPixel in hitTestConstraint. Not sure if has to do with the bmd not properly cloned or what, but if you comment out the threshold() line in Main it kind of works.

Yep, it seems related to clone().

Try substituting that line with:

    // keep original image incase it's modified for hittest.
    bmpDataOrig = new BitmapData(bmp.bitmapData.width, bmp.bitmapData.height, true, 0);
    bmpDataOrig.copyPixels(bmp.bitmapData, bmp.bitmapData.rect, new Point());

So it seems to be on the openfl side. Going to file an issue there, maybe tomorrow. While playing with threshold() I've also found some inconsistencies with html5 (probably due to alpha bytes being flipped).

thanks pushed that.