Now it is possible to build levels using the mouse. This option is intended to be used only by me for now to build new levels but maybe later with a nicer user interface I could make a real level editor. But the feature is not disabled so anyone can try it in the demo. Right click selects a tile. Left click places a tile of the same type that was selected. Middle button can cycle through tile types and then you can paste those tiles with left clicks. The current selection is written to the Java console. Right clicking an empty area or cycling to OPEN type switches to erase mode.
For push plates it is possible to select them with right click and then see the door connections by pushing 'x' key and switching on graphical debug display info. You can even toggle connections by left clicking doors.
Level saving
Pressing the CTRL key saves the current level as it is. But this works only on my pc in Eclipse because of applet security measures. All visible game objects have a common type (like PLAYER, SNAKE, WALL, etc...) that is an enum and this is saved for all tile positions. For empty tiles an OPEN value is saved. That saves all map objects. Then I have the push plates that are connected to the doors. These connections are saved as well. The program checks all push plates and for those that have doors (I use Observer design pattern for this) it places a 'p' char in the file. For those that have no doors connected, an 'n' char is placed. Then an int value is written that holds the number of doors connected. And then for all doors the x y tile coordinates are written.
Level loading
This was a bit difficult because this has to work in browser mode and normally the above mentioned applet security rules do not allow the applet to read a file. But fortunately it is possible to use getClass().getResourceAsStream("filename.txt").
ObjectInputStream ois = null;
ois = new ObjectInputStream(getClass().getResourceAsStream(filename));
New level
Using the new build feature I made a new level for single player mode. Now it is possible to use the '1' and '2' keys to change game mode when the game starts.
You can try the demo here:
belanet.ujmappa.hu/ruins/play.html
If you find bugs or have some ideas (like what new tile type to make) then comments are welcome!