And Half A Fish Games.

And Half A Fish

Snake Island April 21, 2017 - Editor v2.

I've added some new functionality to my fledgling editor so that I can now zoom in on a view and add / modify clickable regions for in game navigation.
As usual, it took me longer than it should have. I think anyone that knows what he's doing could have done this in an afternoon. It took me about a week. And I'm still not a 100% happy with the usability ...

Anyway. Here are some screenshots ...

Click a room to zoom in :

A list of in game clickable areas for navigation is shown. The top row is for editing :

Add new areas :

Delete or modify existing areas. There's also some (very) basic input checking :

One thing that I should perhaps mention, is the way I deal with the location and size of the rectangles.
Since I'm pretty sure that the size of the rooms in the game will not be the same size as the rooms in the editor, I can't just use pixels to store rectangle information. A rectangle drawn at (10,10) on a 250x250 background image, should be drawn at location (20,20) on a 500x500 image. And the same thing for width and height. In other words : xy and wh need to be normalized relative to the size of the background image.

To keep things as simple as possible, I've decided to use these normalized values in the editor (xy and wh are always in the 0-100 range).
It definitely feels a bit weird to have a value of 10 mean different things in the horizontal and vertical directions, but I think I can live with it (for now). At a later time, I might decide to use pixels in the editor, and normalize just before writing the information to the Json file.

I've also changed the Json file a bit ; room location (xyz) is now part of the room name.

I'm not sure if this is a good decision ...
On the one hand, it makes the file quite a bit shorter, but on the other hand, when the rooms are constructed from the Json file, the code has to perform a String.split() and 3 parseInt()'s to calculate xyz (now stored in memory only) ...
Time will tell, I guess ...

[ {
    "name": "room.0.0.0",
    "nav": {
        "area.": "goto.0.0.-1" 
    "bgImgPath": "img/bg/room1.png"
}, {
    "name": "room.1.0.0",
    "nav": {
        "area.": "goto.0.0.-1",
        "area.": "goto.0.0.0"
    "bgImgPath" : "img/bg/room2.png",
}, ...

Next step : build some basic functionality to add objects to the room.
I'll start with just plain image files. After that, I will need to find a way to define functionality (Is it clickable in game ? And what does it do ?).

Another challenge. :-)