rubymotion-community / Joybox

Cocos2D & Box2D Wrapper for Ruby Motion - Currently out of date an unmaintained :-(
MIT License
280 stars 37 forks source link

Isometric Map Coordinates #60

Open shipstar opened 10 years ago

shipstar commented 10 years ago

I'm playing around with an isometric map I created with Tiled. As far as I can tell, Joybox (and maybe Cocos2D) doesn't handle the isometric angle when I make calls like contains_point? and coordinate_for_point.

isometric

In the map above, Joybox reports the very top-left corner of the screen (black space) as [0,0] in coordinate_for_point. The left corner of the actual map returns [0,4] or [0,5], depending on where you click. This makes sense, but it seems undesirable.

I would expect the left corner of the map (or some other sensible choice) to be [0,0], the bottom corner to be [0,9], the right corner to be [9,9], and so on. (I could also see the bottom corner being [9,0] -- as long as it's consistent, it seems fine.)

Staggered isometric maps would throw another wrench into these works. I'm not sure how I'd solve that yet, but I'm open to ideas.

Are there any plans to support this sort of coordinate system within Joybox? (Does Cocos2D support it?) I imagine that I'd need a lot of other methods on or coordinating with an IsometricTileMap for strategy-style games -- path-finding, for example -- so maybe it makes more sense as a separate gem if I get that far.

Thoughts?

Edit: To be clear, I have No Idea What I'm Doing™ when it comes to isometric games.

JosephHalter commented 10 years ago

We've recently used Joybox to make an isometric game and simply reverted to the methods provided by cocos2d such as .tileAt instead of which return a sprite from coordinate of the map (such as 0, 0) instead of from a position in pixel like Joybox provides. Sure, Joybox doesn't provide everything out of the box but it's nice to be able to load a tmx so easily. The remaining part you'll probably have to implement on top of it. Or you can also override coordinate_for_point but we found out that it only gets you so far.

shipstar commented 10 years ago

I totally agree! Not hating on Joybox at all, just trying to provide some ideas of places where the API could be improved/supplemented.

Thanks for suggesting dropping down to Cocos2d — that’s probably the right move here.

On Thursday, November 21, 2013 at 1:27 PM, Joseph HALTER wrote:

We've recently used Joybox to make an isometric game and simply reverted to the methods provided by cocos2d such as .tileAt instead of which return a sprite from coordinate of the map (such as 0, 0) instead of from a position in pixel like Joybox provides. Sure, Joybox doesn't provide everything out of the box but it's nice to be able to load a tmx so easily. The remaining part you'll probably have to implement on top of it. Or you can also override coordinate_for_point but we found out that it only gets you so far.

— Reply to this email directly or view it on GitHub (https://github.com/rubymotion/Joybox/issues/60#issuecomment-29009907).