Hi, I have the grid map.
- The whole screen res. is 800x600.
- The grid I'm making it 10x10.
- So that's 100 levels each 80x60 pixels big.
My aim is to have a black screen with white grid-lines and when you beat a level that grid gets coloured in with that part of the map.
I don't exactly know how to go about doing it and I don't want 100 different levels just for 1 map with each grid box coloured in seperately. Also some levels are scrolling so they take up 2 grib blocks or even 8 so as soon as you enter that level and press [Enter] you can see all the levels coloured in that you've completed.
I don't really care whether or not the map shows where you are because that will already be obvious.
I think there are a probably many ways of doing it, but here's the first idea that springs to my mind (hopefully you're using MMF)...
1.) Create a background object 800x600, with the complete map (like if every level had been completed).
2.) Create an overlay object 800x600, with just the white lines and a *nearly* black background (absolute black is transparent). Set debug mode on.
3.) For each level, store an x and y coordinate for the corresponding grid cell (in an .ini or array - preferably the one that you store the levels in). For example, the highest 2x2 cell in your example picture would have coordinates 3,2.
4.) When you want to make a cell visible, you use the fill function in the overlay. For the x and y, you lookup the coordinates from the .ini or array, and multiply the x by 80 and the y by 60 (the cell dimensions). You might have to add 2 because of the white lines. Set the color to 0,0,0 (black) which will make the cell transparent, revealing that part of the background image beneath.
If you don't use MMF, then I'd again use a background object containing the full map. I'd then store the topleft, topright, bottomleft, and bottomright coordinates of each cell (again in an .ini or array). I'd then have 100 black active objects (slowdown isn't an issue because nothing much will be happening on a simple map screen), and one large active object with just the white lines. When you complete a level, it would look up the 4 coordinates and destroy all the active objects inside.
That was all reasonably clear?
Like I said, I'm sure there are other ways, but this is one way you don't have to bother making 100 individual 80x60 images at least.
btw; is this going to be for "Strike-Down 4" per chance?
I'm still confused. I've never used inis or arrays before so as you can imagine I have no idea.
"2.) Create an overlay object 800x600, with just the white lines and a *nearly* black background (absolute black is transparent). Set debug mode on."
- How do you set debug mode on and what does it do?
"3.) For each level, store an x and y coordinate for the corresponding grid cell (in an .ini or array - preferably the one that you store the levels in). For example, the highest 2x2 cell in your example picture would have coordinates 3,2."
- How do you store an x and y in an ini or array? -I need to read an article about these two objects. Where are these articles? How does another level read an ini, do you have to put the same one in every level?
"4.) When you want to make a cell visible, you use the fill function in the overlay. For the x and y, you lookup the coordinates from the .ini or array, and multiply the x by 80 and the y by 60 (the cell dimensions). You might have to add 2 because of the white lines. Set the color to 0,0,0 (black) which will make the cell transparent, revealing that part of the background image beneath. "
- Where's the fill function in what overlay, what is an overlay, is it a backdrop??? How do you look up the x and y coordinates in an ini or array?
I know how to make a color change to another color but I don't know how to tell it where in the picture to change.
Best of luck explaining it to me, how did everyone else figure this stuff out for themselves???
First of all, the overlay object (overlay/overlay redux/active overlay) is an extension which you will need to download if you don't already have it. It's somewhat like a background object with the exception that you can draw on it.
Initially, overlay objects are hidden. Setting debug mode on just makes it visible.
Ini files and arrays are data storage objets. An ini is just a simple text file really, with a kind of tree structure (can't really explain without a demonstration). Arrays are grids of data - kind of like an invisible excel datasheet.
Also, the .pdf manual in your MMF folder is a lot more thorough than the normal help.
For keping all the baddies where they were when you show the map screen, you either have to save and reload the positions, speeds, etc of every active object, or just show the map screen as a sub app (easier).
Anyways, I'll see if I can't knock something together example-wise.
If you don't like the overlay object, then just use a grid of black active objects, and store the visibility state of each square in a two-dimensional array.
Arrays are not hard to understand. They simply provide a grid of variables, which can easily be accessed per index number. Think of an array as a table, used to store numbers (or strings). Just insert an array object to the game and check out its actions and conditions.
Okay I've got the Overlay Redux Object and the Array working now.
I did encounter a few problems:
- It can only read one coordinate at a time. For example if you are on level 3. Which is grid 2,5. Only that cell will be coloured in and not the two levels before it- cells 1,5 and 2,5. How do we get all levels from when you started to where you are on the map coloured in?
- Also, this is more of a suggestion. I supposed the problem above wont happen if the map is an extra app. becasue the cells will get coloured in as you go along. But does this mean the map app. has to be open at all times? Which I don't really want.
You can use the array to store all the info about the levels. For example;
You use the X coordinate to specify the level #.
You use the Y coordinate to specify the item of that levels data (x_coord, y_coord, completed?)
so,
when you complete level 6 for example, you use the function "write value to XY". You would use x=6 (the level#), y=3 (1=x, 2=y, 3=completed?). The value you would write would be 1 (0=has NOT been completed, 1=has been completed).
Now, when you want to show the map screen, you can open up a subapp with it in, and go through every level, checking the array to see if it has been completed (a sub application is another extension in case you weren't aware, not literally a whole other MMF application). Are you going to be allowing the player to save their game mid-level? If so, you needn't bother with the subapp - try to figure out how to save/load the level now (then you can save -> goto map -> load again).
Out of interest, did you get the overlay to go transparent at all? I'm certain it should, but when I came to trying to make an example for you it didn't seem to work in either MMF1 or MMF2, and I can't find a property or function anywhere to set the transparent colour. I'll see if I can find another overlay version...
anyways, hope it helps because it took me quite a bit longer than i'd anticipated. hope it's not too patronizing either - i commented pretty much every line, however obvious.
if you use a subapp, you can more or less ignore the first frame for now.
Thanks Sketchy. I've been looking through to see how it all works and it's great, taught me a thing or to about inis, and the rest. However it is not showing me the levels when I go to the map screen, I think I might be having troubles with the overlay redux extention as well. What do I do? Or am I just simply not using the program the right way?
I mean I beat a level, type in 5, and go Map and it goes to the map but it's all just black.