Advertisement
hikanh

Untitled

Oct 23rd, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. def pbTextSprite(viewport = nil, type = "System")
  2. sprite = Sprite.new(viewport)
  3. sprite.z = 99999
  4. sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
  5. eval("pbSet#{type}Font(sprite.bitmap)")
  6. return sprite
  7. end
  8.  
  9. If you just want a sprite for a type icon, you can just do "mySprite = pbTypeSprite(type, viewport)" with this. Type should be a number or a "PBMove" object.
  10.  
  11. def pbTypeSprite(type, viewport = nil)
  12. type = type.type if type.is_a?(PBMove)
  13. sprite = Sprite.new(viewport)
  14. sprite.bmp("Graphics/Pictures/types")
  15. sprite.src_rect.height = sprite.bitmap.height / PBTypes.getCount
  16. sprite.src_rect.y = sprite.src_rect.height * type
  17. return sprite
  18. end
  19.  
  20. Example:
  21. mySprite = pbTypeSprite(0, @viewport)
  22.  
  23. This sprite is now the icon of the Normal type. If it does not work properly, the types.txt PBS file and the types.png sheet may not have the same amount of types.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement