Sha256: e64e4fd03f755a9d014d32bddabd90c5da7c82dc19b093ad5de557a880451edd

Contents?: true

Size: 668 Bytes

Versions: 4

Compression:

Stored size: 668 Bytes

Contents

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

    font = @stage.resource_manager.load_font 'Asimov.ttf', 30
    text_image = font.render text, true, [250,250,250,255]

    x = @actor.x
    y = @actor.y

    text_image.blit target.screen, [x,y]
  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.1.1 lib/gamebox/actors/score.rb
gamebox-0.1.0 lib/gamebox/actors/score.rb
gamebox-0.0.9 lib/gamebox/actors/score.rb
gamebox-0.0.8 lib/gamebox/actors/score.rb