How can i make Hills within my world generation array?

Get help using Construct 2

Post » Tue Dec 09, 2014 5:14 pm

Well to check if a certain tile at say x,y has air above it you can do this:
Array at (x,y-1) = 0

So to do it for everything do this:

Array: for each xy
Array current value >0
--- create tile
------- Array at curx,cury-1 = 0
------------ make tile grass covered
B
91
S
31
G
102
Posts: 5,232
Reputation: 67,250

Post » Tue Dec 09, 2014 7:03 pm

@R0j0hound im having an issue with figuring out if the cell is empty because if my cell is equal to 0 and my animation frames adjust to the value of the array.

dirt = 0
grass covered = 7
If an empty cell is equal to 0 that is giving me an issue because if it is empty it will always make the sprite that occupies that cell Frame 0
GMO FOOD = DEATH
B
23
S
9
G
5
Posts: 567
Reputation: 6,368

Post » Tue Dec 09, 2014 7:33 pm

Instead of setting the cells to just animation frames you'll need a value for empty cells, so you know whether or not to create a tile there. 0 is the best value for that since 0 is the default cell value and cells outside the array are always zero. You could store the animationFrame+1 so 0 would be empty and then you could set the animation frame to array.at(x,y)-1 so 0 in the array would be frame 0.
B
91
S
31
G
102
Posts: 5,232
Reputation: 67,250

Post » Fri Jun 12, 2015 10:56 pm

Hi @R0j0hound,

Sorry for bringing up an old post, but I was searching to see if Construct had a certain capability when I came upon this thread, and thought it would be relevant.

Is it possible to generate smooth terrain in construct? Such as in Tiny Wings - https://www.youtube.com/watch?v=DZtaxru80gk.

Dynamic generation aside, my first approach was simply to draw the whole level as a sprite, but I quickly learned that method is not viable due to memory constraints when creating levels of any significant size. Ref: https://www.scirra.com/blog/112/remembe ... our-memory. However for smooth non repeating seamless surfaces, tile maps don't really work.

My next idea was to generate terrain as described in this thread, except with single pixel sprites. However, without anti-aliasing, the result was still far from smooth. It would also create thousands of objects on screen which I would assume cause a huge performance hit.

I've created similar in vector based applications like Flash, but the solution to this in Construct is so far eluding me.

Edit: Found your Canvas plugin plugin-canvas_t64239?&hilit=canvas. Can't believe I hadn't utilized this before... it looks like this is what I needed. I guess I'll see what I can come up with after experimenting and learning how to use it.
Mistakes were made.
B
48
S
23
G
107
Posts: 1,576
Reputation: 60,168

Previous

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 2 guests