Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # ■ Character Graphic Extension
- #------------------------------------------------------------------------------
- # Rotate a character image and adjust the display coordinates in pixels.
- #
- # ●How to use
- # 1. Use "Script" from "Set Move Route..." and put-
- # self.rotate(90, 0, 0) -> rotate 90 degrees clockwise
- # 2. Rotation is used ot the origin, adjusts X and Y coordinates
- # self.rotate(90, 16, -16) -> rotate 90 degrees clockwise
- # X coordinate move 16 to the right and the Y coordinate 16 upward.
- #
- # ●Terms of use
- # It can be modified and redistributed without permission from the author.
- # Free for commercial and non-commercial use.
- #-----------------------------------------------------------------------------
- # Copyright (c) 2016 Triacontane
- # This software is released under the MIT License.
- # http://opensource.org/licenses/mit-license.php
- #-----------------------------------------------------------------------------
- # Version
- # 1.0.1 2016/05/05 Fixed an error when loading save data without using a script.
- # 1.0.0 2016/05/04 Initial release
- # ----------------------------------------------------------------------------
- # [Blog] : http://triacontane.blogspot.jp/
- # [Twitter]: https://twitter.com/triacontane/
- # [GitHub] : https://github.com/triacontane/
- #=============================================================================
- class Game_CharacterBase
- #--------------------------------------------------------------------------
- # ● Public instance variables
- #--------------------------------------------------------------------------
- attr_accessor :angle # Rotation angle
- attr_accessor :adjustment_x # X coordinate adjuster
- attr_accessor :adjustment_y # Y coordinate adjuster
- #--------------------------------------------------------------------------
- # ● Initializing public member variables
- #--------------------------------------------------------------------------
- alias cge_init_public_members init_public_members
- def init_public_members
- cge_init_public_members
- @angle = 0
- @adjustment_x = 0
- @adjustment_y = 0
- end
- #--------------------------------------------------------------------------
- # ● Get the screen X coordinate
- #--------------------------------------------------------------------------
- alias cge_screen_x screen_x
- def screen_x
- cge_screen_x + (@adjustment_x ? @adjustment_x : 0)
- end
- #--------------------------------------------------------------------------
- # ● Get the screen Y coordinate
- #--------------------------------------------------------------------------
- alias cge_screen_y screen_y
- def screen_y
- cge_screen_y + (@adjustment_y ? @adjustment_y : 0)
- end
- #--------------------------------------------------------------------------
- # ● Rotation
- #--------------------------------------------------------------------------
- def rotate(angle, adjustment_x, adjustment_y)
- @angle = angle
- @adjustment_x = adjustment_x
- @adjustment_y = adjustment_y
- end
- end
- class Sprite_Character
- #--------------------------------------------------------------------------
- # ● Other updates
- #--------------------------------------------------------------------------
- alias cge_update_other update_other
- def update_other
- cge_update_other
- self.angle = (@character.angle ? @character.angle : 0)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement