=begin
╔══════════════════════════════════════════════════════════════════════════════╗
║ Character Sprite Addons ║
║ Version 1.1 by Punk ║
╟──────────────────────────────────────────────────────────────────────────────╢
╟──────────────────────────────────────────────────────────────────────────────╢
║ ■ Description: ║
║ └─ Adds on additional properties to character sprites which weren't included ║
║ before such as Angle, Tone, Color, Mirror, Zoom_X and Zoom_Y. ║
╟──────────────────────────────────────────────────────────────────────────────╢
║ ■ Features: ║
║ ├─ Gives character sprites additional properties from the Sprite class such ║
║ │ as angle, tone, color, mirror, zoom_x and zoom_y. ║
║ └─ Change the angle, size, color, tone of a character sprite as well as ║
║ flipping it horizontally with script calls. (New to Version 1.1) ║
╟──────────────────────────────────────────────────────────────────────────────╢
║ ■ Customization ║
║ └─ For those who don't like how in the zoom functions, the value 1.0 ║
║ signifies "actual pixel size", I've changed it a bit to make the value ║
║ 100.0 signify actual pixel size. For those who may not like the update, ║
║ you can disable this by jumping to the third line after this long box ║
║ and set CharacterSpriteZoom100 to false. ║
╟──────────────────────────────────────────────────────────────────────────────╢
║ ■ Usage: ║
║ │ ► Tones. ║
║ ├─ How do I change the tone of the player's sprite? ║
║ │ 1. Use Call script event command. ║
║ │ 2. Type this (replace red green blue saturation with values): ║
║ │ $game_player.tone = Tone.new(red, green, blue(, sat)) ║
║ │ return true ║
║ ├─ How do I change the tone of an event's sprite? ║
║ │ 1. Use Call script event command. ║
║ │ 2. Type this (replace id with an event id): ║
║ │ $game_map.events[id].tone = Tone.new(red, green, blue(, sat)) ║
║ │ return true ║
║ ├─ Example usage? I may still be confused. ║
║ │ $game_player.tone = Tone.new(100, 100, 100, 255);return true ║
║ │ $game_player.tone = Tone.new(-64, 0, -64, 0);return true ║
║ │ $game_player.tone = Tone.new(-64, 0, -64);return true ║
║ │ ║
║ │ ► Angles. ║
║ ├─ How do I change the angle of the player's sprite? ║
║ │ 1. Use Call script event command. ║
║ │ 2. Type this (replace angle with a value): ║
║ │ $game_player.angle = value ║
║ ├─ How do I change the angle of an event's sprite? ║
║ │ 1. Use Call script event command. ║
║ │ 2. Type this (replace angle with a value, id with an event id): ║
║ │ $game_map.events[id].angle = value ║
║ │ ║
║ │ ► Colors. ║
║ ├─ How do I change the color of the player's sprite? ║
║ │ 1. Use Call script event command. ║
║ │ 2. Type this (replace red green blue alpha with values): ║
║ │ $game_player.color = Color.new(red, green, blue(, alpha)) ║
║ │ return true ║
║ ├─ How do I change the angle of an event's sprite? ║
║ │ 1. Use Call script event command. ║
║ │ 2. Type this (replace id with an event id): ║
║ │ $game_map.events[id].color = Color.new(red, green, blue(, alpha)) ║
║ │ return true ║
║ ├─ Example usage? I may still be confused. ║
║ │ $game_player.color = Color.new(100, 100, 100, 100);return true ║
║ │ $game_player.color = Color.new(200, 0, 200, 255);return true ║
║ │ $game_player.color = Color.new(200, 0, 200);return true ║
║ │ ║
║ │ ► zoom_x and zoom_y. ║
║ ├─ How do I change the sprite's x-axis zoom level? ║
║ │ For players: $game_player.zoom_x = value ║
║ │ For events: $game_map.events[id].zoom_x = value ║
║ ├─ How do I change the sprite's y-axis zoom level? ║
║ │ For players: $game_player.zoom_y = value ║
║ │ For events: $game_map.events[id].zoom_y = value ║
║ │ ║
║ │ ► Mirror. ║
║ ├─ How do I flip character sprites horizontally? ║
║ │ For players: $game_player.mirror = true ║
║ │ For events: $game_map.events[id].mirror = true ║
║ └─ Okay, how do I unflip them? ║
║ For players: $game_player.mirror = false ║
║ For events: $game_map.events[id].mirror = false ║
╟──────────────────────────────────────────────────────────────────────────────╢
║ ■ Methods Aliased: ║
║ ├─ update - Sprite_Character < RPG::Sprite ║
║ └─ initialize - Game_Character ║
╟──────────────────────────────────────────────────────────────────────────────╢
║ ■ Changelog: ║
║ ├─ Version 1.1 (5/10/09) - Replaced attr_reader with attr_accessor. ║
║ └─ Version 1.2 (5/12/09) - Updated the zoom stuff. (More info below) ║
╟──────────────────────────────────────────────────────────────────────────────╢
║ ■ About Version 1.2 change: ║
║ Originally, the value '1.0' for properties zoom_x and zoom_y stood for ║
║ the character sprite's actual size. I felt like trying to explain that in ║
║ the instructions of this script and add-ons made to it would just confuse ║
║ some people. So I wanted to make the value 100.0 denote the actual pixel ║
║ size of the sprite. ║
╚══════════════════════════════════════════════════════════════════════════════╝
=end
#╔═════════════════════════════════════════════════════════════════════════════╗
#║ ■ Customize ║
#╚═════════════════════════════════════════════════════════════════════════════╝
class PK8
CharacterSpriteZoom100 = true
# If false, sprite's zoom level value 1.0 would denote actual pixel size.
# If true, sprite's zoom level value 100.0 would denote actual pixel size.
end
#===============================================================================
# ** Game_Character
#===============================================================================
class Game_Character
#-----------------------------------------------------------------------------
# * Public Instance Variables
#-----------------------------------------------------------------------------
attr_accessor :tone
attr_accessor :angle
attr_accessor :zoom_x
attr_accessor :zoom_y
attr_accessor :mirror
attr_accessor :color
#-----------------------------------------------------------------------------
# * Alias Listings
#-----------------------------------------------------------------------------
alias_method :pk8_character_sprite_addons_initialize, :initialize
#-----------------------------------------------------------------------------
# * Object Initialization
#-----------------------------------------------------------------------------
def initialize(*args)
@tone = Tone.new(0, 0, 0, 0)
@angle = 0
@zoom_x = (PK8::CharacterSpriteZoom100 ? 100.0 : 1.0)
@zoom_y = (PK8::CharacterSpriteZoom100 ? 100.0 : 1.0)
@mirror = false
@color = Color.new(0, 0, 0, 0)
pk8_character_sprite_addons_initialize(*args)
end
end
#===============================================================================
# ** Sprite_Character
#===============================================================================
class Sprite_Character < RPG::Sprite
#-----------------------------------------------------------------------------
# * Alias Listings
#-----------------------------------------------------------------------------
alias_method :pk8_character_sprite_addons_update, :update
#-----------------------------------------------------------------------------
# * Update
#-----------------------------------------------------------------------------
def update
pk8_character_sprite_addons_update
self.tone = @character.tone#Tone.new(104, 124, 140)
self.angle = @character.angle
if PK8::CharacterSpriteZoom100 == true
self.zoom_x = @character.zoom_x / 100.0
self.zoom_y = @character.zoom_y / 100.0
elsif PK8::CharacterSpriteZoom100 == false
self.zoom_x = @character.zoom_x
self.zoom_y = @character.zoom_y
end
self.mirror = @character.mirror
self.color = @character.color
end
end