1

I have to to game for my school project.

I have a little problem with selecting part of game screen where there is no enemy.

Please see this screens, where i tried to explain a little bit. First screen , Second screen.

Ok, so I have player and i can move him around a play ground - from one border to second one. And there is also an "enemy". The thing is, that I have to select area (divided by player line) where there is no enemy.

Does anyone know kow can i do that, with some reasonable speed and memory ( i don't have to declare char array[width_screen][height_screen]; )

Thanks

Dominik
  • 15
  • 3
  • If this is homework, you should tag it as such. You should also post any code that **you** have tried. – Adam Apr 04 '11 at 18:43
  • I don't want code. I would like to get some idea how can I do that ;) – Dominik Apr 04 '11 at 18:45
  • So you are coding Qix. You need to use borders to define regions. The write a routin within_region(region) to tell if the enemy is within that region. – Jiminion Aug 18 '13 at 15:26

2 Answers2

5

Use flood fill algorithm.

Lie Ryan
  • 62,238
  • 13
  • 100
  • 144
2

For a spatial search a nice option is to implement a QuadTree

This question has some very helpful links on the subject.

Community
  • 1
  • 1
mcabral
  • 3,524
  • 1
  • 25
  • 42