Rotating an Object

Discussion about Mods for Prison Architect

Moderator: NBJeff

User avatar
Phraxas
level2
level2
Posts: 107
Joined: Sun Aug 31, 2014 12:10 am
Location: USA - PA

Rotating an Object

Postby Phraxas » Sat Sep 06, 2014 6:44 pm

Could someone show some code for a rotated object? I have 3 sprites and I've tried to do RotateType 0, 1, 2, etc, but I think I'm missing some specific syntax and can't find a good example for it.
Suthek
level1
level1
Posts: 29
Joined: Mon Sep 01, 2014 5:23 pm

Re: Rotating an Object

Postby Suthek » Sat Sep 06, 2014 8:30 pm

Code: Select all

BEGIN Object
        Name         RotatableObject
   Height          2
   ConstructionTime   3.00000
   MoveSpeedFactor   0.700000
   Toughness         100.0000
   Price            -100
   Group         StaticObject
   BlockedBy         StaticObject
   BlockedBy         UtilityStation
   MadeOf         Composite
   Property         RoomSpecific
   BEGIN   Sprite
      x 2
      y 0 
      w 2 
      h 4 
      RotateType 1
   END
END


Really important is only the RotateType in the Sprite definition.
RotateType 1 indicates that the object is going to be rotatable in 4 directions. It will take the sprite indicated by the coordinates and the 2 sprites to the right of it. The first sprite is the object in its original position, the 2nd sprite is the 180° rotated version of the sprite, and the third sprite is the 90° rotated version. (The 270° rotation is created by the game automatically by mirroring the 90° version. I am not entirely sure how the third sprite works with an object that is not square (like the above example). I would guess that for that sprite the w and h values are swapped to accomodate.

RotateType 2 on the other hand would indicate that the object is switchable between horizontal and vertical (e.g. the prison windows, that only have a front and side view). If you select this, the game will only pick the indicated sprite and the one to the right of it.

If you already tried RotateType 1 and it didn't work, then maybe you haven't placed the sprites right. They have to be next to each other. Not above/below or otherwise. The starting point of the next sprite will be the starting point of the first plus the dimensions. In the above example the sprites would have to be located at:
x 2, y 0; x 4, y 0; x 6, y 0.
(One coordinate block in the sprites.png is 32x32 pixels.)
User avatar
Phraxas
level2
level2
Posts: 107
Joined: Sun Aug 31, 2014 12:10 am
Location: USA - PA

Re: Rotating an Object

Postby Phraxas » Sat Sep 06, 2014 9:26 pm

Thank you very much! That was quite in depth and informative.

My only issue now is that with an irregular shape it's swapping the width and height as you said. This is terribly confusing as many of the sprites are higher than their width and are exactly in the same line as each other but have no issues with rotation. Is this yet again another hard code issue?

Edit: Ok, so apparently rotatetype 3 is what I need to make it act like rotatetype 1 except without swapping the dimensions.

Return to “Modding”

Who is online

Users browsing this forum: No registered users and 1 guest