same: draw mouse-under blob in a slightly darker color and make the scoring bonus easier to get (and worth more)
This commit is contained in:
parent
b8459737f0
commit
0d72df472f
|
@ -17,13 +17,13 @@
|
||||||
(define board-height 16)
|
(define board-height 16)
|
||||||
(define colors (map (lambda (x) (make-object color% x))
|
(define colors (map (lambda (x) (make-object color% x))
|
||||||
(list "blue" "red" "brown" "forestgreen" "purple")))
|
(list "blue" "red" "brown" "forestgreen" "purple")))
|
||||||
(define pale-colors (map (λ (x)
|
(define pale-colors
|
||||||
(define (paleize x) (- 255 (floor (* (- 255 x) 1/2))))
|
(for/list ([x (in-list colors)])
|
||||||
(make-object color%
|
(define (paleize x) (- 255 (floor (* (- 255 x) 2/3))))
|
||||||
(paleize (send x red))
|
(make-object color%
|
||||||
(paleize (send x green))
|
(paleize (send x red))
|
||||||
(paleize (send x blue))))
|
(paleize (send x green))
|
||||||
colors))
|
(paleize (send x blue)))))
|
||||||
|
|
||||||
;; these are the sizes that the on-paint callback draws at;
|
;; these are the sizes that the on-paint callback draws at;
|
||||||
;; a scaling factor is applied to make the board fit the window
|
;; a scaling factor is applied to make the board fit the window
|
||||||
|
@ -80,8 +80,10 @@
|
||||||
(for ([v (in-vector v)])
|
(for ([v (in-vector v)])
|
||||||
(when (vector-ref v 0)
|
(when (vector-ref v 0)
|
||||||
(set! cells-filled-in (+ cells-filled-in 1)))))
|
(set! cells-filled-in (+ cells-filled-in 1)))))
|
||||||
(define bonus (if (<= cells-filled-in 20)
|
(define bonus-start 50) ;; bonus for getting down to 49 (or fewer) balls
|
||||||
(* 50 (- 20 cells-filled-in))
|
(define bonus-per-ball 50) ;; number of points for clearing each of those last 'bonus-start' balls
|
||||||
|
(define bonus (if (<= cells-filled-in bonus-start)
|
||||||
|
(* bonus-per-ball (- bonus-start cells-filled-in))
|
||||||
0))
|
0))
|
||||||
(send score-message set-label
|
(send score-message set-label
|
||||||
(format "~a + ~a = ~a"
|
(format "~a + ~a = ~a"
|
||||||
|
@ -150,10 +152,7 @@
|
||||||
[mouse-clicked-x ;; has the mouse been clicked in a clickable place?
|
[mouse-clicked-x ;; has the mouse been clicked in a clickable place?
|
||||||
(cond
|
(cond
|
||||||
[(and mouse-over? mouse-clicked-over? multiple-cells?)
|
[(and mouse-over? mouse-clicked-over? multiple-cells?)
|
||||||
(send dc set-pen
|
(send dc set-pen (list-ref pale-colors color) (* pen-size 2/3) 'solid)
|
||||||
(list-ref pale-colors color)
|
|
||||||
(* pen-size 2/3)
|
|
||||||
'solid)
|
|
||||||
(draw-blob blob i j)]
|
(draw-blob blob i j)]
|
||||||
[(and mouse-over? mouse-clicked-over?)
|
[(and mouse-over? mouse-clicked-over?)
|
||||||
(send dc set-pen
|
(send dc set-pen
|
||||||
|
@ -170,10 +169,7 @@
|
||||||
[else
|
[else
|
||||||
(cond
|
(cond
|
||||||
[mouse-over?
|
[mouse-over?
|
||||||
(send dc set-pen
|
(send dc set-pen (list-ref pale-colors color) (* pen-size 2/3) 'solid)
|
||||||
(list-ref pale-colors color)
|
|
||||||
pen-size
|
|
||||||
'solid)
|
|
||||||
(draw-blob blob i j)]
|
(draw-blob blob i j)]
|
||||||
[else
|
[else
|
||||||
(send dc set-pen (list-ref colors color) pen-size 'solid)
|
(send dc set-pen (list-ref colors color) pen-size 'solid)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user