News for hackers. Stuff that matters.

Show HN: An isometric marble run build in CoffeeScript

http://marbleo.us/#GQIAAP8AAAYvAgAA_wAAFDwAAAA_AAAABwICAP8AAAQAAAAAAAAAABgCAgD_AAALAQEAAP8AAAYpAQAAGgcIAf8AAAU_AAAAPwEAAP8AAAU_AAAAPwEAAP8AAAU_AAAAKwAAAB4CBQD_AAAEAAAAAAAAAAAwBwgA_wAABAAAAAAAAAAAAAAAACwHCQD_AAADAQEAAP8AAAYpAQAA_wAAIgAAAAAAAAAAAAAAAAABAAD_AAADKQEAAP8AAAYpAQAA_wAAKQEBAAD_AAAGKQEAAP8AACkBAQAAFAAAARUAAAAVAAAAFQAAABUAAAAFBwkAKQEAABYAAAEVAAAAFQAAABUAAAAFBwkA_wAAARUAAAAVAAAAFQAAABUAAAAVAAAABQIGAP8AAA8AAAAAAAAAAAAAAAAAAAAAFAEAAP8AAAIAAAAAAAAAAAAAAAAAAAAAMAIAAP8AAAIFAgAA_wAABjECAAAA=

( 25 comments | 141 points | on HN )
Re:Show HN: An isometric marble run build in CoffeeScript by natesm on Monday April 18, 2011 @01:19PM (#2459825)
It's a little hard to tell where the marble is in "3d" space. I think it might be a little better if it was even lighter while "underground". A lot of isometric games use shadows to show exactly where objects are - that could help as well.

Edit: now I figured out what the big problem is: you can't see where it's headed when it's underground. In Roller Coaster Tycoon, when your train went into a tunnel, there was a sort of transparent view of the underground track. I think having that here would make a lot of sense.

Re:Show HN: An isometric marble run build in CoffeeScript by robert-boehnke on Monday April 18, 2011 @06:26PM (#2460994)
thanks for pointing that out, that does seem like a good idea and I will look into that
Re:Show HN: An isometric marble run build in CoffeeScript by jashkenas on Monday April 18, 2011 @12:10PM (#2459557)
Re:Show HN: An isometric marble run build in CoffeeScript by duck on Monday April 18, 2011 @11:54AM (#2459495)
Re:Show HN: An isometric marble run build in CoffeeScript by jonty on Monday April 18, 2011 @01:17PM (#2459819)
Building this successfully destroyed all my productivity. http://bit.ly/g11Q6h
Re:Show HN: An isometric marble run build in CoffeeScript by d0m on Monday April 18, 2011 @02:28PM (#2460079)
Playing with it destroyed a bit of my productivity ;) I like the ending of the map.
Re:Show HN: An isometric marble run build in CoffeeScript by ullrich on Tuesday April 19, 2011 @10:58AM (#2462765)
Re:Show HN: An isometric marble run build in CoffeeScript by bni on Tuesday April 19, 2011 @06:44AM (#2462193)
I feel my curly-brace intertia softening a bit lately, so Im considering converting Orbium to CoffeScript.

The game has "classes", like this:

https://github.com/bni/orbium/blob/gh-pages/js/tile.js

https://github.com/bni/orbium/blob/gh-pages/js/inspector.js

So I think it will translate well.

Anyone with CoffeScript experience that can share what its like to convert over a codebase from JS -> CoffeScript?

Re:Show HN: An isometric marble run build in CoffeeScript by jashkenas on Tuesday April 19, 2011 @07:07AM (#2462240)
Hah, mostly: delete, delete, delete.

http://www.screenr.com/xd0

Fair warning, the syntax in that screencast is a bit out of date.

For your codebase, instead of having to "call super" manually:

    orbium.Inspector = function(count, xnr, ynr, vari, col) {
      
      this.setBase = function() {
        orbium.Tile.prototype.setBase.call(this, "modtile");
      };

    }
It'll look more like:

    class orbium.Inspector extends orbium.Tile 
    
      constructor: (count, xnr, ynr, vari, col) ->
        ...

      setBase: ->
        super "modtile"
Re:Show HN: An isometric marble run build in CoffeeScript by bni on Tuesday April 19, 2011 @07:20AM (#2462269)
Thanks, probably some search and replace will do most of the boring stuff. Since it follows the classical pattern already the structure of the code will be mostly the same, but with a lot less dense syntax :-)

Im concerned about adding a compile step, since I like the "just reload" workflow a lot that you get with JS.

text/coffeescript script tags could help out with this. But from the the CoffeScript site: "it's not recommended for serious use". Why not?

Re:Show HN: An isometric marble run build in CoffeeScript by jashkenas on Tuesday April 19, 2011 @09:50AM (#2462585)
Check out the --watch flag, which will give you the same "just reload" workflow you have with JS.

Using `text/coffeescript` script tags works, but isn't recommended because you're effectively programming through an eval(), and debugging becomes more difficult.

Re:Show HN: An isometric marble run build in CoffeeScript by grantbachman on Monday April 18, 2011 @11:53AM (#2459493)
I think it's pretty cool, but might I suggest loading a fully built track as the default?
Re:Show HN: An isometric marble run build in CoffeeScript by DanielRibeiro on Monday April 18, 2011 @11:56AM (#2459499)
I found it is. Just click on a green arrow after test map.
Re:Show HN: An isometric marble run build in CoffeeScript by grantbachman on Monday April 18, 2011 @12:00PM (#2459520)
My mistake, the fact that they have the ability to jump over distances is even cooler. Nice touch.
Re:Show HN: An isometric marble run build in CoffeeScript by peregrine on Monday April 18, 2011 @01:54PM (#2459964)
This basically does not run at all in my browser. (Chrome 11.0.696.44 beta)
Re:Show HN: An isometric marble run build in CoffeeScript by robert-boehnke on Monday April 18, 2011 @06:40PM (#2461036)
I have had some trouble with it on my Windows netbook with 2d canvas acceleration enabled, could that be it?
Re:Show HN: An isometric marble run build in CoffeeScript by ullrich on Monday April 18, 2011 @11:50AM (#2459482)
the sources can be found on github http://github.com/robb/Marbleo.us
Re:Show HN: An isometric marble run build in CoffeeScript by waqf on Monday April 18, 2011 @11:33PM (#2461539)
The very first thing I thought to do when I saw the app was to widen my window (to 2000px or so) so that I wouldn't have to scroll to see all the available blocks.

But the block selector doesn't resize with the window. Please could you fix that?

Re:Show HN: An isometric marble run build in CoffeeScript by a1k0n on Monday April 18, 2011 @08:12PM (#2461229)
I wish I could just buy blocks like these for my son. Bandai Spacewarp-type-things are a little too much yet, and the marble toys we have are pretty lame in comparison to this.
Re:Show HN: An isometric marble run build in CoffeeScript by robert-boehnke on Tuesday April 19, 2011 @03:53AM (#2461958)
You can: They were based off marble blocks built by a Swiss company called Cuboro: http://cuboro.ch/en/Info/Products They are not very cheap though.
Re:Show HN: An isometric marble run build in CoffeeScript by corin_ on Tuesday April 19, 2011 @04:03AM (#2461973)
I grew up with a set of those (not sure if from that company or just a really similar product), and to me it represents a nicer time when toys for children were... can't quite find the right way to put it, but overall nicer. Loading the marbleo.us page instantly took be back in my mind, so thankyou :)
Re:Show HN: An isometric marble run build in CoffeeScript by syntsalt on Monday April 18, 2011 @02:15PM (#2460040)
Very cool. What does isometric mean? Is it like Eschere drawing, i.e. marble goes bak up the hill?
Re:Show HN: An isometric marble run build in CoffeeScript by ejames on Monday April 18, 2011 @02:47PM (#2460141)
"Isometric" refers to the style of the 3D viewpoint. The x and y axis are presented at a 45° angle, and the camera looks 'down' on the surface diagonally.

Escher's work is an example of how an isometric perspective can be manipulated to present an impossible object, such as a staircase that appears to go upwards even though the 'top' stair is connected to the 'bottom'.

Re:Show HN: An isometric marble run build in CoffeeScript by hrasm on Tuesday April 19, 2011 @03:45AM (#2461942)
Isometric view refers to the way in which 3D objects are represented on a 2D plane. This is the most preferred view in drawing building plans and the like. The other method is called Perspective view in which parallel lines on a 3D object converge to a point on the 2D representation. For e.g., a long-shot picture of a straight railroad track. This is what we usually see in pictures, paintings and the like.
Re:Show HN: An isometric marble run build in CoffeeScript by indrora on Monday April 18, 2011 @08:05PM (#2461221)
my little thing: http://j.mp/etrO8H