Skip to content

Commit

Permalink
Strokewidth is evil. It's now been vanquished.
Browse files Browse the repository at this point in the history
  • Loading branch information
qrush committed Aug 24, 2008
1 parent 4669cdf commit d320287
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions snake.rb
@@ -1,6 +1,6 @@
SPEED = 10
FIELD_SIZE = 15
CELL_SIZE = 20
CELL_SIZE = 10
START_X = 50
START_Y = 50

Expand All @@ -20,14 +20,15 @@ class Cell

def initialize(app, row, col)
@app = app

@x = START_X + (CELL_SIZE * row)
@y = START_Y + (CELL_SIZE * col)
end

def paint(color = Colors::GROUND)
@color = color
@app.fill color
@app.strokewidth 0
#@app.oval(@x, @y, 20, 20)
@app.rect :left => @x, :top => @y, :width => CELL_SIZE, :height => CELL_SIZE
end
end
Expand Down Expand Up @@ -114,9 +115,15 @@ def initialize(app)

def reset
Logger.debug "Reset!"

side = CELL_SIZE * FIELD_SIZE
@app.strokewidth 0
@app.rect(START_X, START_Y, side, side)
=begin
@cells.each do |c|
c.paint if c.color != Colors::GROUND
end
=end
end

def paint
Expand All @@ -136,16 +143,15 @@ def rand
Shoes.app :height => 500, :width => 500, :title => "Snakes" do
background "#08ab2e".."#1c582a"

def new_game(startup = false)
@field.reset if !startup
def new_game
@snake.reset
end

@field = Field.new(self)
@snake = Snake.new(@field)

@field.paint
new_game(true)
new_game

animate(SPEED) do
if @snake.moving
Expand Down

0 comments on commit d320287

Please sign in to comment.