Skip to content
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

Closed
Hakkeduster opened this issue May 12, 2011 · 17 comments
Closed

Add support for rotating objects #11

Hakkeduster opened this issue May 12, 2011 · 17 comments
Labels
feature It's a feature, not a bug.

Comments

@Hakkeduster
Copy link

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.

@bjorn
Copy link
Member

bjorn commented May 12, 2011

This feature was previously requested here: http://sourceforge.net/apps/mantisbt/tiled/view.php?id=23
(closing the issue in the old bug tracker as a duplicate now)

It would indeed be a nice feature!

Example use-case from the old issue: http://www.cocos2d-iphone.org/forum/topic/2338

@slycrel
Copy link

slycrel commented Aug 31, 2011

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?

@bjorn
Copy link
Member

bjorn commented Aug 31, 2011

@slycrel I'd expect the rotation to be a floating point attribute similar to QGraphicsItem::rotation. When saving it would be stored like:

<object gid="123" rotation="60" />

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.

@slycrel
Copy link

slycrel commented Aug 31, 2011

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. =)

@bjorn
Copy link
Member

bjorn commented Aug 31, 2011

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).

@Chicknstu
Copy link

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!

@bjorn
Copy link
Member

bjorn commented Oct 12, 2011

@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 :-)

@Aranda
Copy link

Aranda commented Oct 15, 2011

@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.

@Aranda
Copy link

Aranda commented Oct 15, 2011

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.

@bjorn
Copy link
Member

bjorn commented Oct 15, 2011

@Aranda Nice suggestion! Pushed as commit 058c752. :-)

@mrmalee
Copy link

mrmalee commented May 9, 2012

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.

@bjorn
Copy link
Member

bjorn commented May 9, 2012

@mrmalee This issue is about free rotation support for objects. However, it seems you are talking about issue #58 (with the addition of the diagonal flip bit)?

@mrmalee
Copy link

mrmalee commented May 10, 2012

both would be nice. But flipping would benefit my project more than rotation.

@gamedevsam
Copy link

Isn't this solved by pull 168?

@bjorn
Copy link
Member

bjorn commented Jan 30, 2013

@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.

@gamedevsam
Copy link

Ohh, that's odd, would it be difficult to rotate the object in the level based in the angle specified in the properties window?

@bjorn
Copy link
Member

bjorn commented Feb 10, 2013

@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 QGraphicsItem representing the object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature It's a feature, not a bug.
Projects
None yet
Development

No branches or pull requests

7 participants