And remove em outside the view?
Used for fog of war...
God Bless!!!
Edited by 8feet, 13 May 2011 - 05:17 PM.
Posted 13 May 2011 - 08:56 AM
Edited by 8feet, 13 May 2011 - 05:17 PM.
Posted 13 May 2011 - 09:31 AM
var xx,yy;
xx=0
while(xx<room_width){
yy=0
while(yy<room_height){
instance_create(xx,yy,obj_fog)
yy+=(height of the fog object)
}
xx+=(width of fog object)
}
Posted 13 May 2011 - 05:03 PM
Yeah, use two loops inside eachother. This will be horrifically slow though, just to warn you, and there are much better ways of doing fog of war. Surfaces, ds_grids, anything is better than objects. Even an array that draws the sprites to fill the room would be much faster. This is because evey object in gm has many many variables assigned to it, has to undergo collision checks, draw, etc every single step. It's a waste of speed and memory and your game will lag horribly.
There are many examples of fog of war engines in tutorial section, some that work wonderfully well. I'd personally use surfaces as they allow you a lot of control and nice smooth effects, but it's up to you.
Here's how you'd do what you want though:var xx,yy; xx=0 while(xx<room_width){ yy=0 while(yy<room_height){ instance_create(xx,yy,obj_fog) yy+=(height of the fog object) } xx+=(width of fog object) }
I really don't suggest doing this though. Tell me a little bit more about how you want your fog of war to work (does it just show a part around the units, or once they discover somewhere is it visible for ever, etc) and I'll explain how to use surfaces to do what you need
Posted 13 May 2011 - 05:22 PM
0 members, 0 guests, 0 anonymous users