December 14, 2015, 10:30:10 am

I'm slapping together a town planner/designer tool for Harvest Moon: Magical Melody. It's basically the entire map of the game, and you'll be able to place rocks and trees and grass and stuff, to plan out how you want to design your town.

Since it's a simple thing, I'm not doing anything fancy -- I'm just using AttachInput to let the user scroll around the map. The default walking speed is stone-slow, however. Is there a way to change it, or do I have to use a custom movement script? I Searched the API, Wiki and forum and couldn't find anything.

Another two quick questions, rather than make a whole 'nother topic -- how do I manage the depth of images? There's no z-coordinate in the arguments. Trying to manage the HUD.

You will usually just render an image last to show it on top over everything. In a way, the Z coordinate is just the order you draw things. If you are using the map engine, be sure you are drawing via SetRenderScript rather than SetUpdateScript.

Notice how each property is very irregularly-shaped. I wanted to just have each property have its own Zone, because as you can see, each property has a name, and I have a little text box in the corner and I wanted to change the text to reflect what property you're hovering over.

Well, I can do that, but the zones can't have complex shapes like that, as far as I can tell.

I mean, it's a small program, I probably COULD just draw a dozen plus Zones per property and have them all run the same script and not suffer any slowdown, but I'd prefer to do something more elegant.

I've also considered making multiple identical-looking tiles, one for each Zone, and have the message display based on that. That's more labor-intensive for only slightly less of a hacked-together mess.

Second question. How the heck do I stop the cursor from going outside the game when playing in windowed mode?

I've also considered making multiple identical-looking tiles, one for each Zone, and have the message display based on that. That's more labor-intensive for only slightly less of a hacked-together mess.

This is what I'd say is the standard solution for Sphere. I'd check the tile names as the player moves around and then do things based on which tile you are on.

I wouldn't recommend any developer do that though, the user will likely just consider it an annoyance. I don't know how many times I've been annoyed by some program or other getting stuck in window-moving mode and therefore not being able to get the cursor onto the taskbar.

I've seen it done in Sphere before, in Beaker's Particle of Infinite Free Will. I had thought it was done by simply warping the cursor to the center of the screen every frame.

I thought of that too but didn't use the example, because he needed to contain the mouse so your Wii-Mote doesn't track the cursor off of the window, or hit the edge of the screen. Looking at that code, it seems the mouse will always be constrained to the middle after every frame rendered.

If you use code to help you code you can use less code to code. Also, I have approximate knowledge of many things.

Both The Particle of Infinite Free Will as well as RTD:E had code to contain the mouse's position inside the window. In the case of RTD:E it was optional but if enabled allowed for mouse sensitivity to be configurable. Since RTD:E used a modified executable, it also had access to check if the sphere window was in focus, so unlike TPIFW, if you managed to click outside the window, then the game would detect that and pause the game while letting go of the mouse, which made the mouse capturing more reasonable.

I've also considered making multiple identical-looking tiles, one for each Zone, and have the message display based on that. That's more labor-intensive for only slightly less of a hacked-together mess.

This is what I'd say is the standard solution for Sphere. I'd check the tile names as the player moves around and then do things based on which tile you are on.

I would do it like this: Create the map as you see fit, then add a new transparant top-layer.Create some coloured tiles, THEN, start drawing on that toplayer each zone a color. One with green, and another zone with red, etc. This way, you can easily see what part of the map is in which zone. Now make the toplayer invisible. Done.

Once in-game, you need to know which zone you are in, take the position X and Y of your player, divide by the tilesize to get the tile number. If your tiles are 16 pixels, the fastest way is GetPersonTileX=GetPersonX()/16 or the faster GetPersonTileX=GetPersonX()>>4, then myzone=GetTile(GetPersonTileX, GetPersonTileY, toplayer). Where toplayer is calculated each time you enter a new map: toplayer=GetNumLayers(). myzone has a the index number of the tile and will change when you walk into another zone.

edit: Added demo for that.

Note2: You can ALSO name tiles, so each colored tile can immediately have the name of the zone with GetTileName().

In fact some games use this, like, all tiles made out of water are named "water", when in water (i.e. in the same layer the person is in), the spriteset of the character is swimming. This is easier than having triggers determining if we are going into or out of the water and having bugs where you can walk over water (because you can always forget it somewhere). If you can get into the water... you are swimming. And if you are walking over a tile that is "high grass", your feet are in grass.

@Mooch: Ok, this is the most simple I can make it.So you have a tileset. I gave some tiles names. These represent terrain. so water, grass, pavement, etc. you can change the spriteset to reflect a new terrain, like high grass on your feet, or swimming, climbing, walking slower when on mud, etc. (the function to do that, however, is empty). Give me some spritesets that have this feature and Ill give you a proper demogame.

Then, you have that non-visible toplayer which has area names. As the area is not the same as terrain, these do not need to change together.

note: The names of the tiles can be changed ONLY if you have a map with embedded tileset (create a new map, embed the tileset, edit the names, save, close the map, open the map, then export the tileset.... to change the names for the current map with external tileset...)

note2: try walking off the map. the game crashes: make sure to make SetRenderScript() empty if you allow such thing.

note 3: make that top layer visible to see the regions/areas

note4: rightclick on the tiles overview to edit their properties, like obstruction, rotation/animation and name/label.