Rotate tiles?
by Phil Shenk · in Torque Game Builder · 02/28/2006 (11:59 pm) · 8 replies
I don't know why this hasn't come up before (maybe it has?), but wouldn't it be a good thing to be able to specify a rotation to a tile imageMap on a tileLayer?
Of course, I mean in 90 degree increments. Basically I'm saying that if you had an imagemap of an arrow facing up, you could do something like ...
...to get it to face right.
It seems like this would be easy to do in the engine (just altering the UV's), and would be useful... like for walls, you would only have to make one corner and one straight wall. It would be an easy way to randomize variety for grass tiles, ground tiles, etc (provided they seam up on all edges). You can do some of this with flipping, but not all.
Mostly though, I just have a specific want for it right now, so I noticed it was "missing" :)
Of course, I mean in 90 degree increments. Basically I'm saying that if you had an imagemap of an arrow facing up, you could do something like ...
$myLayer.setTileRotation( "4 4", 1 ); // 0 = 0, 1 = 90, 2 = 180, 3 = 270
...to get it to face right.
It seems like this would be easy to do in the engine (just altering the UV's), and would be useful... like for walls, you would only have to make one corner and one straight wall. It would be an easy way to randomize variety for grass tiles, ground tiles, etc (provided they seam up on all edges). You can do some of this with flipping, but not all.
Mostly though, I just have a specific want for it right now, so I noticed it was "missing" :)
About the author
#2
And plus, I need it in script. My specific application is that I have sets of "rooms" made in the editor as tileLayers, and at run-time I'm constructing a random level out of these rooms by copying tiles from these "room templates" into a larger "level" tileLayer.
In order to make rotated rooms with the current tech, I'd have to layout rotated versions of each of my rooms in the editor. In other words, re-paint the whole room to be facing north or facing south, etc. If I had a "setTileRotation" function, I could do this in script as I'm copying the tiles from layer to layer.
There's another work-around also, involving making rotated versions of the tiles, and storing refs to them so I can pick pre-rotated tiles based on whether I want to rotate the room or not. This is probably what I'll do if a "setTileRotation()" function isn't going to happen :)
03/01/2006 (10:29 am)
No, sorry... I'm talking about rotating, not flipping. Like if I have an arrow imagemap ">", flipping will get me "<". But I want to get "^".And plus, I need it in script. My specific application is that I have sets of "rooms" made in the editor as tileLayers, and at run-time I'm constructing a random level out of these rooms by copying tiles from these "room templates" into a larger "level" tileLayer.
In order to make rotated rooms with the current tech, I'd have to layout rotated versions of each of my rooms in the editor. In other words, re-paint the whole room to be facing north or facing south, etc. If I had a "setTileRotation" function, I could do this in script as I'm copying the tiles from layer to layer.
There's another work-around also, involving making rotated versions of the tiles, and storing refs to them so I can pick pre-rotated tiles based on whether I want to rotate the room or not. This is probably what I'll do if a "setTileRotation()" function isn't going to happen :)
#3
I've added a feature request into our database (#1282) but I would go with your own solution for now as I obviously can't promise when I'll get around to doing this.
- Melv.
03/03/2006 (12:09 am)
Phil,I've added a feature request into our database (#1282) but I would go with your own solution for now as I obviously can't promise when I'll get around to doing this.
- Melv.
#4
03/03/2006 (1:19 am)
Yup! Thanks for adding the request though!
#5
10/11/2006 (1:18 pm)
I second this request. Thanks.
#6
12/03/2006 (7:42 pm)
I vote for this too -- needed this today. There's a resource that describes a way to do this, but until I see how custom code will integrate with new releases, I'm wary of editing source.
#7
12/03/2006 (10:40 pm)
I have seen rotated tiles somewhere... I think they were active tiles so it should be possible that way! :)
#8
- Melv.
12/04/2006 (1:26 pm)
It's been a long time since the active-tile code has changed so you should be pretty safe inheriting its functionality into your own custom tile classes.- Melv.
Torque 3D Owner Stephen Zepp
Select an undefined brush (from the Brushes dropdown list)
--Click on the image in your image map window
--click on the screen (paint one tile with the image)
CTRL-left click the painted tile
Toggle "Flip X" or "Flip Y" as appropriate
--NOTE: This will not flip the default collision poly list, you need to do that manually
Close the window with the "Save" button
Alt-Left Click the same tile
--name and save the brush (note: this hasn't saved the brushes to disk, just saved the brush's changes)
Select Brush...Save Brushes, name the file with a .bru extension and save to disk.
IMO it's better to do this when constructing the tilemap via the editor than script.