Fill the Screen with Pixels?

  • Hi,

    how can I fill the Complete Layout with 1x1 Pixel Objects dynamically most efficient?

    Thank you!

  • What will these said 1x1 pixel objects be doing or what effect are you after?

    If they don't move your best bet for performance would be with the canvas/paster objects or the tilemap object.

    If they move then other than sprites to best you can do is with the particle object. For other motions you're forced to use sprites or you can make your own plugin to draw the pixels in the same manner as particles.

  • Hey Rojo,

    all these Objects are only ment to check for overlaps on other polygons, and be deleted in the next frame. The problem is the event for filling all X and Y pixels of the Layout.

    At least I try to create destroyable forms in this way - without canvas or paster.

  • If they're only used for overlap checks and aren't drawn you could use this condition:

    System->pick overlapping point

    To check every pixel you'd use two for loops, but checking every pixel of the layout or even the screen is going to be slow no matter what you do. The best optimization is to check less pixels if you can.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks. Checking for overlapping points is bit complicated, since these polygons to check against are random shapes.

    Could you provide an example just for flooding the whole layout with 1px objects? I think this is the better solution.

    I am trying to draw new pixels at the collision points, and see how it works.

  • xeed, what you're attempting will most likely not have good performance. I think you're trying to make something similar to worms where the terrain is destructible, and really you shouldn't be using collision checks at all. You need to use some kind of fast bitmasking on a fast array, and you'll likely have to do some magic in javascript to get something like this to actually work properly at real time speeds since javascript isn't very friendly with low level array operations. representing each pixel by a sprites is a really terrible way to go about it and the n^2 complexity will make it unusably slow. It's a lot harder than it seems!

  • Thank you, I know that problem.

    But I dont want to check every frame. Just once at the beginning of each Level.

  • you just need two for loops to create all the objects, however you should really use paster instead of separate objects for each pixel.

  • Could you provide an example?

  • for "x" 0, width

    for "y" 0, height ------------ create object pixel at (loopindex("x"),loopindex("y"))

  • takes 11 seconds for a 320x240 layout on my computer

  • Yes, it really needs one of these painting addons.

    https://dl.dropboxusercontent.com/u/542 ... st0_1.capx

    But I will try with a Tilemap before.

  • use paster...

  • I will try it, thank you!

    Hope there will be an integrated solution soon in c2.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)