Class: RPG::Sprite

Inherits:
Sprite show all
Defined in:
docs/0_Dependencies.rb,
docs/5_Battle_99_Pokemon_Script_Project.rb

Overview

Class representing a RMXP Sprite

Direct Known Subclasses

Sprite_Character

Constant Summary collapse

SHADER =

Scripting shader for RPG::Sprite

Returns:

"uniform sampler2D texture;\nuniform float hue;\n\n// Source: https://gist.github.com/mairod/a75e7b44f68110e1576d77419d608786\nvec3 hueShift( vec3 color, float hueAdjust ) {\n\n  const vec3  kRGBToYPrime = vec3 (0.299, 0.587, 0.114);\n  const vec3  kRGBToI      = vec3 (0.596, -0.275, -0.321);\n  const vec3  kRGBToQ      = vec3 (0.212, -0.523, 0.311);\n\n  const vec3  kYIQToR     = vec3 (1.0, 0.956, 0.621);\n  const vec3  kYIQToG     = vec3 (1.0, -0.272, -0.647);\n  const vec3  kYIQToB     = vec3 (1.0, -1.107, 1.704);\n\n  float   YPrime  = dot (color, kRGBToYPrime);\n  float   I       = dot (color, kRGBToI);\n  float   Q       = dot (color, kRGBToQ);\n  float   hue     = atan (Q, I);\n  float   chroma  = sqrt (I * I + Q * Q);\n\n  hue += hueAdjust;\n\n  Q = chroma * sin (hue);\n  I = chroma * cos (hue);\n\n  vec3    yIQ   = vec3 (YPrime, I, Q);\n\n  return vec3( dot (yIQ, kYIQToR), dot (yIQ, kYIQToG), dot (yIQ, kYIQToB) );\n}\n\nvoid main() {\n  vec4 color = texture2D(texture, gl_TexCoord[0].xy);\n  color.rgb = hueShift(color.rgb, hue);\n  gl_FragColor = color * gl_Color;\n}\n"
@@_animations =
[]
@@_reference_count =
{}

Instance Attribute Summary collapse

Attributes inherited from LiteRGSS::ShaderedSprite

#blendmode, #shader

Attributes inherited from LiteRGSS::Sprite

#__index__, #angle, #bitmap, #height, #mirror, #opacity, #ox, #oy, #src_rect, #viewport, #visible, #width, #x, #y, #z, #zoom, #zoom_x, #zoom_y

Instance Method Summary collapse

Methods inherited from Sprite

#load, #mouse_in?, #set_origin_div, #set_rect, #set_rect_div, #set_z, #simple_mouse_in?, #translate_mouse_coords

Methods inherited from LiteRGSS::Sprite

#set_origin, #set_position

Methods inherited from LiteRGSS::Disposable

#disposed?

Constructor Details

#initialize(viewport = nil) ⇒ Sprite

Initialize a new Sprite



2598
2599
# File 'docs/0_Dependencies.rb', line 2598

def initialize(viewport = nil)
end

Instance Attribute Details

#blend_type

Returns the value of attribute blend_type.



2579
2580
2581
# File 'docs/0_Dependencies.rb', line 2579

def blend_type
  @blend_type
end

#bush_depth

Returns the value of attribute bush_depth.



2580
2581
2582
# File 'docs/0_Dependencies.rb', line 2580

def bush_depth
  @bush_depth
end

#color ⇒ Color

Get the color of the sprite

Returns:



2589
2590
2591
# File 'docs/0_Dependencies.rb', line 2589

def color
  @color
end

#tone ⇒ Tone

Get the tone of the sprite

Returns:



2593
2594
2595
# File 'docs/0_Dependencies.rb', line 2593

def tone
  @tone
end

Instance Method Details

#animation(animation, hit, reverse = false)

Set an animation to the sprite

Parameters:

  • animation (RPG::Animation) —

    animation to set

  • hit (Boolean) —

    is it a hit animation

  • reverse (Boolean) (defaults to: false) —

    is the animation reversed



2623
2624
# File 'docs/0_Dependencies.rb', line 2623

def animation(animation, hit)
end

#animation_process_timing(timing, hit)

Process animation timing effects

Parameters:

  • timing (RPG::Animation::Timing) —

    timing to process

  • hit (Boolean) —

    whether the animation hit the target



2670
2671
# File 'docs/0_Dependencies.rb', line 2670

def animation_process_timing(timing, hit)
end

#animation_set_sprites(sprites, cell_data, position)

Set animation sprites based on cell data and position

Parameters:

  • sprites (Array<Sprite>) —

    array of sprites to set

  • cell_data (Array) —

    animation cell data

  • position (Integer) —

    position of the animation



2665
2666
# File 'docs/0_Dependencies.rb', line 2665

def animation_set_sprites(sprites, cell_data, position)
end

#appear

Make the sprite appear



2607
2608
# File 'docs/0_Dependencies.rb', line 2607

def appear
end

#blink? ⇒ Boolean

Check if the sprite is blinking

Returns:

  • (Boolean)


2646
2647
# File 'docs/0_Dependencies.rb', line 2646

def blink?
end

Stop blinking effect



2642
2643
# File 'docs/0_Dependencies.rb', line 2642

def blink_off
end

Start blinking effect



2639
2640
# File 'docs/0_Dependencies.rb', line 2639

def blink_on
end

#collapse

Make the sprite collapse



2613
2614
# File 'docs/0_Dependencies.rb', line 2613

def collapse
end

#damage(value, critical)

Display damage on the sprite

Parameters:

  • value (Numeric, String) —

    damage value (negative for healing)

  • critical (Boolean) —

    whether the damage is critical



2618
2619
# File 'docs/0_Dependencies.rb', line 2618

def damage(value, critical)
end

#dispose

Dispose the sprite



2601
2602
# File 'docs/0_Dependencies.rb', line 2601

def dispose
end

#dispose_animation

Dispose the animation sprites



2633
2634
# File 'docs/0_Dependencies.rb', line 2633

def dispose_animation
end

#dispose_damage

Dispose the damage sprite



2630
2631
# File 'docs/0_Dependencies.rb', line 2630

def dispose_damage
end

#dispose_loop_animation

Dispose the looping animation sprites



2636
2637
# File 'docs/0_Dependencies.rb', line 2636

def dispose_loop_animation
end

#effect? ⇒ Boolean

Check if any effect is running on the sprite

Returns:

  • (Boolean)


2650
2651
# File 'docs/0_Dependencies.rb', line 2650

def effect?
end

#escape

Make the sprite escape



2610
2611
# File 'docs/0_Dependencies.rb', line 2610

def escape
end

#flash(color, duration)

Make the sprite flash

Parameters:

  • args (Array) —

    arguments



2585
2586
# File 'docs/0_Dependencies.rb', line 2585

def flash(*args)
end

#handle_flash

Handle the flash effect



33
34
# File 'docs/5_Battle_99_Pokemon_Script_Project.rb', line 33

def handle_flash
end

#loop_animation(animation)

Play a looping animation on the sprite

Parameters:



2627
2628
# File 'docs/0_Dependencies.rb', line 2627

def loop_animation(animation)
end

#register_position

Register the current position of the sprite



15
16
# File 'docs/5_Battle_99_Pokemon_Script_Project.rb', line 15

def register_position
end

#reset_position

Reset the position of the sprite to the registered one



18
19
# File 'docs/5_Battle_99_Pokemon_Script_Project.rb', line 18

def reset_position
end

#update

Update the sprite



2653
2654
# File 'docs/0_Dependencies.rb', line 2653

def update
end

#update_animation

Update the animation sprites



2656
2657
# File 'docs/0_Dependencies.rb', line 2656

def update_animation
end

#update_loop_animation

Update the looping animation sprites



2659
2660
# File 'docs/0_Dependencies.rb', line 2659

def update_loop_animation
end

#whiten

Make the sprite whiten



2604
2605
# File 'docs/0_Dependencies.rb', line 2604

def whiten
end

#x=(x)

Set the x coordinate of the sprite

Parameters:

  • x (Integer) —

    new x coordinate



2674
2675
# File 'docs/0_Dependencies.rb', line 2674

def x=(x)
end

#y=(y)

Set the y coordinate of the sprite

Parameters:

  • y (Integer) —

    new y coordinate



2678
2679
# File 'docs/0_Dependencies.rb', line 2678

def y=(y)
end