Permalink
Browse files

Player uses Background for "alpha" transparency

  • Loading branch information...
1 parent df1245c commit 86576db59033e96a50db8918be3cee5fb0391e39 @dhotson dhotson committed with Jan 15, 2012
Showing with 4 additions and 3 deletions.
  1. +4 −3 asc.rb
View
7 asc.rb
@@ -124,7 +124,7 @@ def initialize horizon, background
@ticks = 0
@horizon = horizon
@building_generator = BuildingGenerator.new(self)
- @player = Player.new(25)
+ @player = Player.new(25, background)
@buildings = [ Building.new(-10, 30, 120) ]
@misc = [ Scoreboard.new(self), RoflCopter.new(50, 4) ]
@speed = 4
@@ -251,16 +251,17 @@ def pixel x, y, rx, ry, ticks
class Player
include Renderable
- def initialize y
+ def initialize y, background
@y = y
+ @background = background
@velocity = 1
@walking = false
end
def x; 0; end
def width; 3 end
def height; 3 end
def pixel x, y, rx, ry, ticks
- Pixel.new char(rx, ry, ticks), 255, 16
+ Pixel.new char(rx, ry, ticks), 255, @background.color(x, y)
end
def char rx, ry, ticks

0 comments on commit 86576db

Please sign in to comment.