aroberge / reeborg

Enhanced Karel-the-robot clone
http://reeborg.ca/reeborg.html
Other
47 stars 36 forks source link

Allow images as background tiles #99

Closed aroberge closed 9 years ago

aroberge commented 9 years ago

Images should be allowed as background tiles.

Goldsong commented 9 years ago

Changing the width of the Editor and removing the margin immediately to the right of the grid enables 48x48 tiles while only slightly reducing the grid from 12x13 to 11x13. Then we could scale down the 48x48 tiles to fit the larger grid (whose size, of course, would also change).

An issue is that the edition of the world takes place in the area of the screen occupied by the editor. If this area is reduced, the edition menus would need to be repositioned. Another possibility is that calling the editor would pop a floating window with the commands instead of removing the editor.

aroberge commented 9 years ago

A floating resizable window for the world editor, like the code editor has become in the new version, is probably the way to do.

aroberge commented 9 years ago

I'm thinking of adding a second layer of tiles on top of the first. There are a couple of reasons for this. First, have a look at http://norvig.com/carcassonne.html. Notice the meandering river: this (the water) could be drawn on top of existing tiles. This would be a simple way to create more complex looking worlds with fewer tiles.

The second, more important reason, is to be able to add some additional properties, again without having to build a huge number of tiles. For example, we might want to add a "teleport" tile (I already have a tentative image for that); it would be nice if it could blend in with whatever world is used. By having a "teleport device" drawn on a transparent background, we can achieve this.

Another reason is that I am seriously considering allowing multiple objects to be put on a single grid position (like we allow multiple tokens). Yet, it might be nice to be able to set things so that a given position can accommodate only one type of object, like it is currently the case - or no object whatsoever (like on a tile where teleportation is occurring). Of course, with pre-code available, it would be possible to program such behaviour ... but I think it would be simpler to do with a (small) collection of secondary tiles with specifically pre-defined properties.

Finally, and somewhat unrelated, it might be possible to redraw the background "constantly" using Javascript requestAnimationFrame. @Goldsong mentioned to me the idea of having multiple images looking slighltly for a given tile type (e.g. grass) so that it would give a more pleasing effect. Combining this idea with a "constantly" redrawn background, we could have simmering effect in water. Motion of robots are always going to be done "step-wise" and not smoothly - due to the nature of the environment and its primary purpose: to teach beginners that a program is nothing more than a sequence of discrete instructions. However, sometimes, some subtle motion effects can be quite surprising in bringing to life an otherwise static image. http://photoryoku.com/main/wp-content/uploads/2013/11/d702ea000e38733c7046b92787e7790b.gif

aroberge commented 9 years ago

Closing as this is now addressed elsewhere.