Is there a way to mass place ACTORS in a grid?

xmagicx60

  • Posts: 213
I need to fill all the air in my game with a air actor because it needs to switch when clicked to another actor. The only problem is that it takes forever to hand-place everyone even with the grid.
How can I fill them to a grid or something?

Sunflower

  • Posts: 591
Well, you can create them via Scene Behavior. Just place there something like:
Code: [Select]
repeat [WIDTH] times
  set CLC to [current loop count]  //CLC is hidden attribute holding count within first loop
  repeat [HEIGHT] times
    create actor [Air] at [current loop count]x[tile width], [CLC]x[tile height]
And that's all.
Of course, one could wonder if it's really necessary to fill entire level with grid actors. What do you want to do with them, anyway? O.o

xmagicx60

  • Posts: 213
Well, you can create them via Scene Behavior. Just place there something like:
Code: [Select]
repeat [WIDTH] times
  set CLC to [current loop count]  //CLC is hidden attribute holding count within first loop
  repeat [HEIGHT] times
    create actor [Air] at [current loop count]x[tile width], [CLC]x[tile height]
And that's all.
Of course, one could wonder if it's really necessary to fill entire level with grid actors. What do you want to do with them, anyway? O.o
I'll try that.
Also, Uploading my Minecraft 2d game test right now. I need the air tiles to switch to wood tiles when someone clicks them with z or x held

Sunflower

  • Posts: 591
Oh, I see. Well, if there won't be major performance problems, I think it shouldn't be a great problem, but if noticeable drop in FPS happened, you may use text instead of actors. Something like that (for 5x5 map):
Code: [Select]
AAWWA
AWWWA
WWWWA
WWWAA
WWAAA
where A is air and W is wood (newlines added for better illustration; normally this would be single line). I'm almost sure this would provide better performance, and if every single material graphic is assigned to this grid, you may try doing something like that. Again, it may turn out that it's not necessary at all.

---EDIT---
Well, I checked this game and maybe it's actually better to use actors here. I mean, with all those fancy scaling effects it's much easier to do it this way. Anyway, decision is up to you. ^^'

xmagicx60

  • Posts: 213
It actually performs quite well! at least with the 1/3rd map test I have atm. The air tiles are transparent now.
text is an idea though it'd look more like Dwarf Fortress than Minecraft.