-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for rotating objects #11
Comments
This feature was previously requested here: http://sourceforge.net/apps/mantisbt/tiled/view.php?id=23 It would indeed be a nice feature! Example use-case from the old issue: http://www.cocos2d-iphone.org/forum/topic/2338 |
Jumping in over here... I did this for my own project in cocos2d and my rotation format was the same as the binary GID format, then compressed, so it looked the same, inside a layer level. It would be fairly straightforward to implement (0..359 degree integer rotation), but I'm not sure how the UI would work. Would the rotation act as a property maybe, or something else? |
@slycrel I'd expect the rotation to be a floating point attribute similar to QGraphicsItem::rotation. When saving it would be stored like:
This is strictly about object rotation (though of course also tile objects), and not about rotation for the tiles on a tile layer. I'm not sure how useful that would be since you can't freely position those tiles either. For the GUI I'd probably add some handle for rotating the object, similar to the way it works in Inkscape. |
Thanks bjorn. For what I did previously, flipping will cover what I was using rotation for. http://www.cocos2d-iphone.org/forum/topic/16552 Essentially I was rotating tiles in place for terrain edges. Flipping is the same difference really. I'll have to poke around at the source some and try to get a better grip on how Tiled sees things. I don't think of tiles as objects, more as painted items based on GIDs, probably because of how cocos2d deals with them. And I won't get this done overnight, but it would be a fun project and I'm already partially there, so we'll see what happens. Thanks for the input. =) |
I don't think of tiles as objects either, hence you hear me say "tile objects" when I'm talking about an object that uses a tile to represent itself. :-) Support for such objects was added to Tiled Qt with version 0.6.0, which isn't very long ago compared to the time that cocos2d-iphone has supported Tiled, hence I wouldn't be surprised if it doesn't support them yet (I haven't checked). |
Better still, of objects didn't need to be boxes. They could be polygons, made up of a number of points. Then you'd have a full Box2D level editor in Tiled too, as well as a tilemap editor! |
@Chicknstu Support for polygon objects is already done for the next release, check out the master branch or try a Windows daily build from http://files.mapeditor.org/daily :-) |
@bjorn awesome. Exactly what I was hoping for! As far as I can see this is pretty much removes the need for rotated rectangle objects. Maps perfectly (excuse the unintended pun) to 2D physics systems. |
Not sure if this is worthy of it's own issue thread so I'll just mention it here. When placing new polygons, it's easy to place multiple points at the same location, particularly the first point as it's hard to see that the polygon has been started. Perhaps it could ignore any points that match the previous point. |
any updates on this? I'm going to be starting a new game soon and having tile objects that can rotate and flip will be very valuable to me. Right now I need to either create multiple versions of the tile graphic, or set scale and rotation properties. It's not ideal as sometimes I'm not the only person creating levels and people tend to forget these properties exist. |
both would be nice. But flipping would benefit my project more than rotation. |
Isn't this solved by pull 168? |
@crazysam Not really. That pull request does not actually rotate the object at all, it only adds an 'angle' properly that is visualized with an arrow. That's the functionality its author needed, not for the objects to rotate. Personally I think that angle arrow is a rather rare and specialized use-case hence I have not merged it yet. |
Ohh, that's odd, would it be difficult to rotate the object in the level based in the angle specified in the properties window? |
@crazysam It should be easy for orthogonal maps. For isometric maps the question is how the rotation should be interpreted. If it would work the same way, the rotation could be done on the |
When placing objects it could be usefull to have a function to set a rotation value. At the moment this can just be archived using the properties at the object. It would be good to have the rotation of objects visually representet as else it mostly is needed to test the map in the game.
The text was updated successfully, but these errors were encountered: