Sha256: 6ff4de9f738e507923192e619ba03f86e088baa6cee8b255c0755a2baa9442c2

Contents?: true

Size: 640 Bytes

Versions: 4

Compression:

Stored size: 640 Bytes

Contents

class ScoreView < ActorView
  def draw(target,x_off,y_off,z)
    text = @actor.score.to_s
    text = '0'*(6-text.size)+text

    font = @stage.resource_manager.load_font 'Asimov.ttf', 30
    x = @actor.x
    y = @actor.y
    font.draw text, x,y,z#, 1,1,target.convert_color([250,250,250,255])
  end
end
class Score < Actor

  has_behavior :layered => {:layer => 999}

  def setup
    clear if backstage[:score].nil?
  end

  def score
    backstage[:score]
  end

  def clear
    backstage[:score] = 0
  end

  def +(amount)
    backstage[:score] += amount
    self
  end

  def -(amount)
    backstage[:score] -= amount
    self
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gamebox-0.3.4 lib/gamebox/actors/score.rb
gamebox-0.3.3 lib/gamebox/actors/score.rb
gamebox-0.3.2 lib/gamebox/actors/score.rb
gamebox-0.2.1 lib/gamebox/actors/score.rb