forked from reidab/pacpdx
-
Notifications
You must be signed in to change notification settings - Fork 1
/
client_pinky.rb
38 lines (31 loc) · 1 KB
/
client_pinky.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
require 'drb'
DRb.start_service
Shoes.app(:width => 700, :height => 700, :title => 'Pinky') do
COLUMNS = [11,120,238,358,475]
ROWS = [89,204,320,440,539,649]
background black
@back = image('images/map.jpg')
@pinky = image('images/pinky.jpg')
remote_pinky = DRbObject.new(nil,'druby://localhost:7704')
fill blue
@cursor = oval(0,0,30)
@cursor_row = 1
@cursor_column = 1
@cursor.move(COLUMNS[@cursor_row-1],ROWS[@cursor_column-1])
keypress do |key|
case key
when :up
@cursor_row -= 1 unless @cursor_row == 1
when :down
@cursor_row += 1 unless @cursor_row == ROWS.size
when :left
@cursor_column -= 1 unless @cursor_column == 1
when :right
@cursor_column += 1 unless @cursor_column == COLUMNS.size
when ' '
@pinky.move(COLUMNS[@cursor_column-1]-5,ROWS[@cursor_row-1]-5)
remote_pinky.move_to(COLUMNS[@cursor_column-1]-5,ROWS[@cursor_row-1]-5)
end
@cursor.move(COLUMNS[@cursor_column-1],ROWS[@cursor_row-1])
end
end