Advertisement
Guest User

Untitled

a guest
Nov 12th, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. Shoes.app title:"datbuoy", width: 280, height: 600 do
  2. def draw_board(rect_x,rect_y,numbers_x,numbers_y,text_y, colour)
  3. a_to_j = [*?A..?J]
  4. battleship_board = []
  5. for board_y in 0..9
  6. battleship_board.push([])
  7. for board_x in 0..9
  8. battleship_board[board_y].push(0)
  9. end
  10. end
  11. # to test board:
  12. # battleship_board[1][2] = 1
  13. for y in 0..9
  14. for x in 0..9
  15. if battleship_board[y][x] == 0
  16. rect(top: rect_y, left: rect_x, radius:10)
  17. fill colour
  18. else
  19. button(top: rect_y, left: rect_x, height: 27, width: 23)
  20. end
  21. rect_x += 23
  22. end
  23. grid_label_y = para (y + 1)
  24. grid_label_y.style(top: numbers_y)
  25. grid_label_x = para a_to_j[y]
  26. grid_label_x.style(top: text_y, left: numbers_x, font: "trebuchet ms")
  27. numbers_x += 23
  28. numbers_y += 22.5
  29. rect_x = 25
  30. rect_y += 23
  31. end
  32. end
  33. draw_board(25, 25, 26.5, 20, 3, red)
  34. draw_board(25, 350, 26.5, 345, 329, blue)
  35. line 0,290,280,290
  36. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement