Array loading problem!

For questions about using Classic.

Post » Thu Sep 04, 2008 12:33 am

I'm not good at array loading.
http://upload.namelezz.net/downloader.p ... LawnB1.rar

^ This is the game

Basically to see the problem extract "LawnMowerB1" and start it. Then press the "Start" button.
The loading misses some tiles


I've included also the editor...

Please help!
B
2
S
2
G
5
Posts: 512
Reputation: 2,674

Post » Thu Sep 04, 2008 1:44 am

The problem is the way you have it looping through the array to load the level. Instead of using nested loops, simply use the "For Each Cell" loop in the array object. For checking the current cell value, simply use compare under the System object and use "Array.CurrentValue." Finally, to position the objects, use "Array.CurrentX * 21" and "Array.CurrentY * 21." I could upload the modified CAP if you want.

Hope that helps. :)

EDIT: By the way, I couldn't get the editor to load anything. I think you should think about using the common dialog object to get a proper save/load box.
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Thu Sep 04, 2008 12:26 pm

O-oh. Thank you. I will now try as you said
B
2
S
2
G
5
Posts: 512
Reputation: 2,674

Post » Thu Sep 04, 2008 12:29 pm

I can't do that, because I use 13x13 as the Author field and 14x14 and 15x15 as the player X,Y starting location. The array loop loops through them, and creates additional squares.
B
2
S
2
G
5
Posts: 512
Reputation: 2,674

Post » Thu Sep 04, 2008 3:32 pm

In that case, you can make the default cell value -1. This will make it to where all cells where you don't specify a value will be left blank.
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Thu Sep 04, 2008 3:34 pm

[quote="linkman2004":1xa4f8tc]In that case, you can make the default cell value -1. This will make it to where all cells where you don't specify a value will be left blank.[/quote:1xa4f8tc]

Can you show me an example?

Is there any way I can do a "controlled" for each between x;y and x;y?
B
2
S
2
G
5
Posts: 512
Reputation: 2,674

Post » Thu Sep 04, 2008 5:28 pm

I can't really make an example since I don't have access to your level editor code, and I couldn't seem to modify my own to work with it. But all you really have to do is this:

In the level editor, at the start of the layout, have the array clear all of it's values to -1(or some other number that doesn't interfere with anything). This means that the base value of the the map will be - 1, so anything you don't fill with another tile will be left blank. Then, just fill the 13x13 grid that contains the level, and all should work fine. Hope this helps. :)
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Thu Sep 04, 2008 9:11 pm

[quote="linkman2004":3qwuvxte]I can't really make an example since I don't have access to your level editor code, and I couldn't seem to modify my own to work with it. But all you really have to do is this:

In the level editor, at the start of the layout, have the array clear all of it's values to -1(or some other number that doesn't interfere with anything). This means that the base value of the the map will be - 1, so anything you don't fill with another tile will be left blank. Then, just fill the 13x13 grid that contains the level, and all should work fine. Hope this helps. :)[/quote:3qwuvxte]

But I need 2 other array values for the author of the puzzle and the player starting coordinates... I don't really want to have 2 arrays for each level :(
B
2
S
2
G
5
Posts: 512
Reputation: 2,674

Post » Thu Sep 04, 2008 9:34 pm

What I'm suggesting means you can still have a 16x16 grid to store additionaly information -- such as the author and player starting coordinates -- Basically, the -1 values wouldn't be recognized as a piece, so the spaces with -1 as the value wouldn't have any tiles. There would still be plenty of space for author name and starting coordinates. Example array to illustrate the point:

2222222222222BBB
2111111111112BBB
2111111111112BBB
2111111111112BBB
2111111111112BBB
2111111111112BBB
2111111111112BBB
2111111111112BBB
2111111111112BBB
2111111111112BBB
2111111111112BBB
2111111111112BBB
2222222222222BBB
BBBBBBBBBBBBBBBB
BBBBBBBBBBBBBBBB
BBBBBBBBBBBBBBAP

2 = Wall
1 = Grass
B = Blank space, represented by -1
A = Represents author name
P = Starting player Coordinates

I hope that better illustrates the idea behind it.
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Thu Sep 04, 2008 9:45 pm

[quote="linkman2004":diezcipd]What I'm suggesting means you can still have a 16x16 grid to store additionaly information -- such as the author and player starting coordinates -- Basically, the -1 values wouldn't be recognized as a piece, so the spaces with -1 as the value wouldn't have any tiles. There would still be plenty of space for author name and starting coordinates. Example array to illustrate the point:

2222222222222BBB
2111111111112BBB
2111111111112BBB
2111111111112BBB
2111111111112BBB
2111111111112BBB
2111111111112BBB
2111111111112BBB
2111111111112BBB
2111111111112BBB
2111111111112BBB
2111111111112BBB
2222222222222BBB
BBBBBBBBBBBBBBBB
BBBBBBBBBBBBBBBB
BBBBBBBBBBBBBBAP

2 = Wall
1 = Grass
B = Blank space, represented by -1
A = Represents author name
P = Starting player Coordinates

I hope that better illustrates the idea behind it.[/quote:diezcipd]

So the "B"s won't be recognized in the For each elements...
But the A and P will always be counted, and those aren't part of the gameplay
B
2
S
2
G
5
Posts: 512
Reputation: 2,674

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests