SHARE
TWEET

Untitled

a guest Jun 20th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Draws a value
  2. characters = []
  3. def drawValue(xPos, yPos, value):
  4.   for c in characters:
  5.     object_destroy(c)
  6.   game.characters = []
  7.   if (value == 0):
  8.     number = object_new("obj_number")
  9.     number.sprite = sprite_new("spr_number_0")
  10.     number.x = xPos
  11.     number.y = yPos
  12.     game.characters.append(number)
  13.     return
  14.   width = -2
  15.   place = 1
  16.   ch = 0
  17.   n = value
  18.   while (n >= place):
  19.     width += 2
  20.     place *= 10
  21.     ch = (n % place) * 10 / place
  22.     n -= ch * place / 10
  23.     if (ch == 1):
  24.       width += 16
  25.     else:
  26.       width += 24
  27.   place = 1
  28.   ch = 0
  29.   xPos += (width / 2) + 2
  30.   n = value
  31.   while (n >= place):
  32.     xPos -= 2
  33.     place *= 10
  34.     ch = (n % place) * 10 / place
  35.     n -= ch * place / 10
  36.     number = object_new("obj_number")
  37.     number.y = yPos
  38.     if (ch == 1):
  39.       number.sprite = sprite_new("spr_number_1")
  40.       number.x = xPos - 8
  41.       xPos -= 16
  42.     else:
  43.       number.sprite = sprite_new("spr_number_" + str(ch))
  44.       number.x = xPos - 12
  45.       xPos -= 24
  46.     game.characters.append(number)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top