Fill the Screen with Pixels?

Get help using Construct 2

Post » Mon Nov 17, 2014 9:41 pm

Hi,

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

Thank you!
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Post » Mon Nov 17, 2014 11:44 pm

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.
B
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

Post » Tue Nov 18, 2014 12:27 am

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.
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Post » Tue Nov 18, 2014 12:55 am

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.
B
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

Post » Tue Nov 18, 2014 1:03 am

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.
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Post » Tue Nov 18, 2014 1:25 am

@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!
B
77
S
13
G
8
Posts: 1,973
Reputation: 9,891

Post » Tue Nov 18, 2014 1:55 am

Thank you, I know that problem.

But I dont want to check every frame. Just once at the beginning of each Level.
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Post » Tue Nov 18, 2014 1:56 am

you just need two for loops to create all the objects, however you should really use paster instead of separate objects for each pixel.
B
77
S
13
G
8
Posts: 1,973
Reputation: 9,891

Post » Tue Nov 18, 2014 2:06 am

Could you provide an example?
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Post » Tue Nov 18, 2014 2:29 am

for "x" 0, width
for "y" 0, height ------------ create object pixel at (loopindex("x"),loopindex("y"))
B
77
S
13
G
8
Posts: 1,973
Reputation: 9,891

Next

Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 5 guests