Class: Sprite_Picture

Inherits:
Sprite
  • Object
show all
Defined in:
Sprite_Picture.rb

Overview

** Sprite_Picture


This sprite is used to display pictures. It observes an instance of the

Game_Picture class and automatically changes sprite states.

Instance Method Summary (collapse)

Constructor Details

- (Sprite_Picture) initialize(viewport, picture)


  • Object Initialization

    picture : Game_Picture



13
14
15
16
17
# File 'Sprite_Picture.rb', line 13

def initialize(viewport, picture)
  super(viewport)
  @picture = picture
  update
end

Instance Method Details

- (Object) dispose


  • Free




21
22
23
24
# File 'Sprite_Picture.rb', line 21

def dispose
  bitmap.dispose if bitmap
  super
end

- (Object) update


  • Frame Update




28
29
30
31
32
33
34
35
# File 'Sprite_Picture.rb', line 28

def update
  super
  update_bitmap
  update_origin
  update_position
  update_zoom
  update_other
end

- (Object) update_bitmap


  • Update Transfer Origin Bitmap




39
40
41
42
43
44
45
# File 'Sprite_Picture.rb', line 39

def update_bitmap
  if @picture.name.empty?
    self.bitmap = nil
  else
    self.bitmap = Cache.picture(@picture.name)
  end
end

- (Object) update_origin


  • Update Origin




49
50
51
52
53
54
55
56
57
# File 'Sprite_Picture.rb', line 49

def update_origin
  if @picture.origin == 0
    self.ox = 0
    self.oy = 0
  else
    self.ox = bitmap.width / 2
    self.oy = bitmap.height / 2
  end
end

- (Object) update_other


  • Update Other




76
77
78
79
80
81
# File 'Sprite_Picture.rb', line 76

def update_other
  self.opacity = @picture.opacity
  self.blend_type = @picture.blend_type
  self.angle = @picture.angle
  self.tone.set(@picture.tone)
end

- (Object) update_position


  • Update Position




61
62
63
64
65
# File 'Sprite_Picture.rb', line 61

def update_position
  self.x = @picture.x
  self.y = @picture.y
  self.z = @picture.number
end

- (Object) update_zoom


  • Update Zoom Factor




69
70
71
72
# File 'Sprite_Picture.rb', line 69

def update_zoom
  self.zoom_x = @picture.zoom_x / 100.0
  self.zoom_y = @picture.zoom_y / 100.0
end