(Solved)How do I get rid of a black screen?

Get help using Construct 2

Post » Mon Apr 20, 2015 11:35 pm

Currently, I am working on a game that is similar to terraria, I use an array and a tilemap to generate random terrain. But as soon as I preview the project It just shows a black screen for roughly a minute. I am inclined to believe that this is do to high amounts of data usage and performance, Yet as soon as The layout begins after the black screen, it runs just fine. I've also tried making the terrain that it is generating really small, but that didn't help at all. It might have to do with the code, and I honestly don't know what is wrong. Here is the .capx: https://www.dropbox.com/s/uyssrq91hds1m ... .capx?dl=0

Constrols: WASD, Left click to destroy blocks, Right click to place them, 1 & 2 to switch between dirt and stone.
Last edited by Cam112549 on Wed Apr 22, 2015 3:35 am, edited 1 time in total.
B
8
S
2
Posts: 39
Reputation: 604

Post » Tue Apr 21, 2015 5:15 pm

You created the array fine, but you had the creating the tiles part inside the x loop of the array part in START OF LAYOUT..

ie.
for x = 0 to array.width
.... blah blah
..... blah blah..
for tilex = 0 to array.width
for tiley = 0 to array height
tilemap set tile etc

^ notice the tilex and tiley loops are inside that X loop.

Fixed
B
15
S
5
G
7
Posts: 876
Reputation: 5,650

Post » Tue Apr 21, 2015 11:37 pm

Thank you so much for the feedback, @procrastinator. I see now that I created a sub-event on the "For 'X' " condition, instead of it being on the "On Start of layout " condition. I cannot tell you how grateful I am. Thank you :)
B
8
S
2
Posts: 39
Reputation: 604

Post » Wed Apr 22, 2015 2:42 am

No problem. Sometimes a fresh pair of eyes is all something needs ;)
B
15
S
5
G
7
Posts: 876
Reputation: 5,650

Post » Wed Apr 22, 2015 3:52 am

Yeah, I can't even recall all the times I get lost just staring at a wall of events :)
B
8
S
2
Posts: 39
Reputation: 604

Post » Wed Apr 22, 2015 4:03 am

@procrastinator, I'm sorry to bother you again, but I'm having another problem.I don't want to ask for more than I already have, but this would help me tons in the future. Basically I was wondering if there was a way to change tiles based on what tiles are around them. For example If a grass tile is generated with two erased blocks on either side, I would want the grass block to become erased.
B
8
S
2
Posts: 39
Reputation: 604

Post » Wed Apr 22, 2015 5:44 am

I'm assuming you just mean checking the left and right side of a block?

The straightforward way.. needs optimizing, but it shows you what you need to do.

+ For y = 0 to array.height - 1
+ For x = 1 to array.width-2
+ if array.at( x-1, y ) = 0
+ if array.at( x, y ) = 1
+ if array.at( x+1, y ) = 0
- set array.at( x, y ) to 0

The 3 IFs are as one event block.
B
15
S
5
G
7
Posts: 876
Reputation: 5,650


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 14 guests