Advertisement
Shubhra_Sarker

obj_text_start

Aug 24th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. #****************************************************
  2. # Author:
  3. # Ivo van der Marel
  4. #
  5. # Summary:
  6. # the obj_text can be used to display numeric text in pixelpad.
  7. # Note that it only displays WHOLE NUMBERS. The text will auto round down any decimal number
  8. # Text like "abc" will not work
  9. #
  10. # Example usage:
  11. # score_txt = object_new("obj_text")
  12. # score_txt.nr = 50
  13. # score_txt.char_size = 0.5
  14. #
  15. # You can modify some values to fit your game
  16. #****************************************************
  17.  
  18. #you can change these values from somewhere else
  19. char_distance = 50
  20. char_size = 1
  21. nr = 0
  22.  
  23. #defaults
  24. max_digits = 10
  25.  
  26. #the obj_text should not show any sprite itself
  27. sprite_sheet = sprite_new('spr_font', 4, 3)
  28. empty = animation_new(sprite_sheet, 0, 11, 12)
  29. animation_set(self, empty)
  30.  
  31. #setting up 7 empty obj_chars
  32. char_os = []
  33. #add one for the negative symbol
  34. for p in range(max_digits+1):
  35. co = object_new("obj_char")
  36. co.spr_sheet_name = spr_sheet_name
  37. char_os.append(co)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement