Well i was trying to learn how to work with arrays and used this concept on tile mapping.
Things i have done
Added array with 11X11 size
on Layout width 352 and height 352
for each xy element system will spawn sprite2 with default frame as green
if and array xy element has value 1 then sprite2 will turn frame to violet
and when "E" is pressed sprite2 which has frames as violet will spawn sprite 3 (orange)
but as i run the layout after each second the fps drops off and on debug mode the object count goes to 40 thousand and more.
for more reference see the image
https://www.dropbox.com/s/uqk64jamrgukh ... eCount.PNG
https://www.dropbox.com/s/bse8az9uyi55b ... 0value.PNG
https://www.dropbox.com/s/iyvsbmae49z61 ... 0Tiles.PNG
What actually i am trying to do!
Some array have value as 1 and i want system to spawn sprite3 on those array XY positions.
It should suppose to spawn one object! I am not sure what did i do wrong as i am not a programmer and this is my first encounter with fps fall and high cpu consumption!
You're spawning all those Sprite2's every tick. You need to add another condition to event 10 there so that it only runs once - like 'on start of layout'.
Develop games in your browser. Powerful, performant & highly capable.
didn't work bro!
I tried 'trigger once' but it didn't work, and if i put it under sub event of 'On start of layout' it creates all the 121 sprites on XY 16,16.
if you permit me i'll send my capx file in PM.
Though thanks for your effort and help!
If you have no Sprite2 on the layout when that loop runs then Sprite2.Width and Sprite2.Height will return 0, which will spawn all the sprites at 16,16.
Thanks a lot ramones that solved the issue. I have created two variables as height and width and set my default value. Volla Works like a charm but not without your help.
Thanks once again!