07-05-2009, 08:04 AM
Character Sprite Addons VX
Version: 1.2
Version: 1.2
Introduction
Adds on additional properties from the Sprite class to character sprites which weren't included before such as Angle, Tone, Color, Mirror, Zoom_X and Zoom_Y. As of version 1.1, it also allows devs to change certain properties of character sprites.
Features
- Gives character sprites additional properties from the Sprite class such as angle, tone, color, mirror, zoom_x and zoom_y.
- Change the color, tone, angle and size of character sprites with script calls.
- 1 customization option. (See Customization section in text file.)
Character Sprite Add-ons VX
Code:
=begin
????????????????????????????????????????????????????????????????????????????????
? Character Sprite Addons ?
? Version 1.2 by PK8 ?
????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????
? ? 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 < Sprite_Base ?
? ?? 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
#==============================================================================
# ** Sprite_Character
#------------------------------------------------------------------------------
# This sprite is used to display characters. It observes a instance of the
# Game_Character class and automatically changes sprite conditions.
#==============================================================================
class Sprite_Character < Sprite_Base
alias pk8_character_sprite_addons_update :update
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
pk8_character_sprite_addons_update
self.tone = @character.tone
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
#==============================================================================
# ** Game_Character
#------------------------------------------------------------------------------
# This class deals with characters. It's used as a superclass of the
# Game_Player and Game_Event classes.
#==============================================================================
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 pk8_character_sprite_addons_initialize :initialize
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def initialize
pk8_character_sprite_addons_initialize
@tone = Tone.new(0, 0, 0, 0)
@angle = 0
if PK8::CharacterSpriteZoom100 == true
@zoom_x = 100.0
@zoom_y = 100.0
elsif PK8::CharacterSpriteZoom100 == false
@zoom_x = 1.0
@zoom_y = 1.0
end
@mirror = false
@color = Color.new(0, 0, 0, 0)
end
end
Instructions
Copy-paste! Also, look for any add-on topics which may link to this as a requirement for use.
FAQ
Changing the tone of a character sprite
Player:
- Use Call script event command.
- Type this (replace red green blue saturation with values):
$game_player.tone = Tone.new(red, green, blue(, sat))
return true
- Use Call script event command.
- Type this (replace id with an event id):
$game_map.events[id].tone = Tone.new(red, green, blue(, sat))
return true
Example usage of changing character sprite tone?
- $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
Changing the color of a character sprite.
Player:
- Use Call script event command.
- Type this (replace red green blue alpha with values):
$game_player.color = Color.new(red, green, blue(, alpha))
return true
- Use Call script event command.
- Type this (replace id with an event id):
$game_map.events[id].color = Color.new(red, green, blue(, alpha))
return true
Example usage of changing character sprite color?
- $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
Changing the angle of a character sprite
Players:
$game_player.angle = value
Events:
$game_map.events[id].angle = value
$game_player.angle = value
Events:
$game_map.events[id].angle = value
Changing the x-axis and y-axis zoom level of a character sprite
Player:
$game_player.zoom_x = value
$game_player.zoom_y = value
Events:
$game_map.events[id].zoom_x = value
$game_map.events[id].zoom_y = value
$game_player.zoom_x = value
$game_player.zoom_y = value
Events:
$game_map.events[id].zoom_x = value
$game_map.events[id].zoom_y = value
Flipping character sprite horizontally
Players:
$game_player.mirror = boolean
Events
$game_map.events[id].mirror = boolean
* boolean meaning either true or false.
$game_player.mirror = boolean
Events
$game_map.events[id].mirror = boolean
* boolean meaning either true or false.
Compatibility
This aliases the following methods from the following classes.
- Sprite_Character < Sprite_Base
- update
- update
- Game_Character
- initialize
- initialize
I want scripters to add on to it. :3
Terms and Conditions
It's not necessary to credit me for this.
------------------------------
Add-onsEvent Tone, Angle, Color, Mirror and Size comment commands.
RPG Maker Scripts
Change Character Opacity in Frames
Change Picture Properties in Frames
Change Window Properties in Frames
Change Windowskin
Composite Windowskins
Custom Movement
Damage Text Revamp
Data Backup System 2
Dash VX for XP
Dash-Enabling Equipment
Disable Dash
Initial Switches and Variables
Memorize Tones
Mirror Events
Modify Battler Collapse Effect
Move During Messages
More Move Routes
New Character Properties
New Picture Properties
Arevulopapo's Particle Engine for VX & Ace
Picture Below Characters for XP & Ace
Pictures Can Scroll Too
Rataime's Passability Indicator Tool
The Self Data Suite
Speed Up Frame Rate for Test Play
Tileset Hues
Switchless Common Events
Unlimited Graphically Layered Maps
Windowskin Converter
Change Picture Properties in Frames
Change Window Properties in Frames
Change Windowskin
Composite Windowskins
Custom Movement
Damage Text Revamp
Data Backup System 2
Dash VX for XP
Dash-Enabling Equipment
Disable Dash
Initial Switches and Variables
Memorize Tones
Mirror Events
Modify Battler Collapse Effect
Move During Messages
More Move Routes
New Character Properties
New Picture Properties
Arevulopapo's Particle Engine for VX & Ace
Picture Below Characters for XP & Ace
Pictures Can Scroll Too
Rataime's Passability Indicator Tool
The Self Data Suite
Speed Up Frame Rate for Test Play
Tileset Hues
Switchless Common Events
Unlimited Graphically Layered Maps
Windowskin Converter