Well I knocked off tasks 1-4 from my previous entry, which is the least I wanted to get done today. I figured getting the brushes to work properly would take some time, and it did. Task #1 took me less than 20 minutes, and tasks #3 & 4 took me about an hour, I'm still not that good at Photoshop and a bad GUI file save made me go back and reposition the controls again. The rest of the day while I was working was spent getting the brushes to cooperate. I had thought up the design last night and I'm glad it worked out as well as I had hoped.
The brushes are dynamic, and I can change their shape without having to recompile anything, thanks to the TorqueDB. Here's one of my brush DB entries:
-data=0 1 0 0 1 0 1 -1
The data field holds the brush shape, which in this case would be
It works by defining tiles around the mouse cursor's location using offsets. There are 8 numbers for this brush, which join up to form 4 pairs, and each pair is a tile location offset. Therefore my code is simply thus:
// get the data
%tempData = TorqueDB.searchByInstanceWithClass("brush", "value", $gameData.brushSelection);
%brushData = %tempData.contents[$DATA_FIELD];
%homeTile = %tilePosition;
// clear away previous brush image
// loop through the data pairs and set the tiles
for (%pair = 0; %pair < getWordCount(%brushData) / 2; %pair++)
// get the pair
%brushPair = getWord(%brushData, %pair * 2) SPC getWord(%brushData, (%pair * 2) + 1);
// update the location
%tilePosition = getWord(%homeTile, 0) + getWord(%brushPair, 0) SPC getWord(%homeTile, 1) + getWord(%brushPair, 1);
// set the tile(s)
$gameMap.setMapTile($TILE_OVERLAY_LAYER, %tilePosition, highlightImageMap, 5, 0, $NO_DATA);
} // end showBrush
This function is called everytime the mouse moves into a new tile on the map and highlights the tiles to show the user what tiles will be affected by the brush.
So the brushes now all work, although there is one catch... there's no way to get back to the single one-tile brush! For now I've just linked that function to a hotkey ("x"), but in the future I'd like to include a button somewhere that will deselect the brush buttons and let you place tiles one at a time again.
Okay okay, time for pretty screens, cause I know that's all you're really here for [smile]
Here's just a look at the new bottom panel. Much better.
Oooh highlighted tile
That brush was boring. Ooh! Let's make Tetris-shaped maps!!
One click, and presto!
Adding some planets with a new brush
So yey! This is fun, creating maps and all. Too bad I can't save em yet. DOH! But I'll be remedying that problem tomorrow. My remaining tasks:
- Implement map saves
- Implement map loads
- Implement help text
Yup. I've decided that after I complete the map editor, I'm going to take the rest of the year off from GC development, heck game dev in general. For one thing my girl will be back home for winter break in a few days, plus GDNet's ramping up the GDC prep, and GI is finally moving again on my new project. So plenty to keep me busy. After New Years I'll begin to work on the actual gameplay. call it Phase 2 if you will [smile]
So okay that's all for me tonight! I'm gonna keep rockin out to the Trans-siberian Orchestra - gets me in that holiday spirit hardcore know what I mean? Yea... right.... sooooo