Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions ugh.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def initialize(width, height)
@taxi = Taxi.new(15, 15)
@passengers = []
create_new_passanger
@destinations = [EndPoint.new(10,15), EndPoint.new(20,30), EndPoint.new(20,1)]
@destinations = [EndPoint.new(10,15), EndPoint.new(2,9), EndPoint.new(20,3)]
end

def exit_message
Expand Down Expand Up @@ -54,19 +54,19 @@ def sleep_time
end

def move_left
objects.first.x -= 1
objects.first.x -= 1 if objects.first.x > 0
end

def move_right
objects.first.x += 1
objects.first.x += 1 if objects.first.x < @width-1
end

def move_down
objects.first.y += 1 if objects.first.y < @height
objects.first.y += 1 if objects.first.y < @height-1
end

def move_up
objects.first.y -= 1
objects.first.y -= 1 if objects.first.y > 0
end

def any_delivered?
Expand All @@ -84,7 +84,7 @@ def delivered(passanger)
end

def fall
move_down if @tick % 30 == 0
move_down if @tick % 40 == 0 && objects.first.y < @height-1
end

def create_new_passanger
Expand Down Expand Up @@ -161,4 +161,4 @@ def passanger?

end

Gaminator::Runner.new(UghGame, :rows => 40, :cols => 100).run
Gaminator::Runner.new(UghGame, :rows => 30, :cols => 50).run