Dynamically Edit Terrain

Get help using Construct 2

Post » Sat Apr 27, 2013 10:06 pm

So I have a terrain script from ROjOhound and sqiddster, that I am using for my game. I am having some difficulties though. I made a event when the user clicks on a tile of a certain animation frame, it changes the frame. It works well, until the user leaves the area, then the bock re-appears like it was never altered. So my question would be how would I successfully remove the block? I have tried just destroying it, but it randomly teleports the player around the map. Recently I tried changing the opacity to 0, and if it was 0, make it not a solid, but that also didn't work. So I am out of ideas. Any help or suggestions would be greatly appreciated. The .capx is attached. Thank you, and if you need any more information I would be glad to help.

Capx: https://docs.google.com/file/d/0B6WnVNPRul4sVVdXcExacE1NdjQ/edit?usp=sharing

I use Google Drive, I hope that is okay.
B
11
S
2
G
3
Posts: 50
Reputation: 2,765

Post » Sun Apr 28, 2013 1:14 am

Can you re-export without the clay.io being required? Can't open the file. Or is it necessary to test this?
B
8
S
2
Posts: 63
Reputation: 1,223

Post » Sun Apr 28, 2013 2:40 am

It isn't. I am sorry, I re-uploaded. Here it is: https://docs.google.com/file/d/0B6WnVNPRul4sS2p6WUozUUJaNWM/edit?usp=sharing.

You move with WASD or arrows, and break blocks with your left mouse button.
B
11
S
2
G
3
Posts: 50
Reputation: 2,765

Post » Sun Apr 28, 2013 3:02 pm

If anyone needs anything else from me, I will be glad to give it.
B
11
S
2
G
3
Posts: 50
Reputation: 2,765

Post » Sun Apr 28, 2013 3:11 pm

Do you know how arrays work? Because that will be necessary to do something like this.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Sun Apr 28, 2013 3:12 pm

I am familiar with them when using java. But I have not used them much in Construct 2. Is it the same thing?
B
11
S
2
G
3
Posts: 50
Reputation: 2,765

Post » Sun Apr 28, 2013 4:04 pm

yogert96

It looks like the script is set up to "recalc" the tiles after they go offscreen by a certain amount. I suspect this is because it's a looping infinite tile system. If this wasn't done the world would slowly get emptier and emptier as you move along breaking blocks, since those empty blocks would be repeated when the terrain loops.

So, if you try to fix this by modifying the recalc section you'll just have a different issue to deal with.

Venivididormi2013-04-28 16:07:27
B
8
S
2
Posts: 63
Reputation: 1,223

Post » Sun Apr 28, 2013 4:09 pm

OK

@Venivididormi yes, you are correct. The game array is not infinite, just very large. So eventually, the world will loop back on itself.

@yogert96 to be honest, going about dynamically editing terrain will depend on @R0j0hound 's implementation of my algorithm. i forget exactly how it worked, but I think you may need to add another, larger array to store all the game tiles.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400


Return to How do I....?

Who is online

Users browsing this forum: Artpunk, Axiomaltd, nicklowkcmagic, OddConfection and 19 guests