Skip to main content
Known Participant
August 21, 2013
Answered

XoniX Game wall coloring problem

  • August 21, 2013
  • 1 reply
  • 2255 views

Hello,

I'm working at the XoniX game at the moment

the idea of the game is simple multiple enemies are moving in the room , you have to build the walls to make their room smaller

the actual problem is that I want to fill the color when the wall is built

I have made this so far

https://appswithssl.com/xonix/

here you can move the player with w,a,s,d and if you go from one wall to another the shape is drawn

This topic has been closed for replies.
Correct answer kglad

but there is still left something I must find a shortest way, which is a little bit difficult to figure out.

if i choose the wrong polygon I will fill allready filled one too


you don't need to find the shortest way.  you just need to find one interior point of the quad and then use the bitmapdata's floodfill method.  actually, you don't even need to find which sprites constitute the quad.  you can create a bitmap of them all and use floodfill and the point(s) that are interior.

1 reply

kglad
Community Expert
Community Expert
August 21, 2013

in general, what you want to do is difficult. 

first, you have to determine whether you have a closed polygon.  then you have to determine which points are inside and which points are outside the polygon.

Known Participant
August 21, 2013

thank you for the answer,

i have already an algorithm about a closed polygon, the problem is deteoning points, which are inside the polygon and another which are the edges of a polygon.

kglad
Community Expert
Community Expert
August 22, 2013

what's the algorithm?  do you have a link?