Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define circulo (circle 20 "solid" "red"))
- (define rectangulo (rectangle 80 10 "solid" "orange"))
- (define fondo (rectangle 300 300 "solid" "blue"))
- (define cuadrado (rectangle 50 50 "solid" "pink"))
- (define nave
- (underlay/align
- "center"
- "bottom"
- circulo
- rectangulo)
- )
- (define (mover n)
- (underlay/align
- "center"
- "top"
- fondo
- (underlay/xy
- circulo
- 20
- n
- rectangulo)
- )
- )
- ;;vamos a utilizar la función bigbang
- (define (terminar n)
- (cond
- [(= 100 n) #t]
- [else #f]
- ))
- (define (juego n)
- (big-bang n
- [to-draw mover]
- [on-tick add1]
- [stop-when terminar]
- )
- )
- (define (animacion n)
- (underlay/align
- "center"
- "bottom"
- (underlay/xy
- fondo
- 120
- n
- nave)
- cuadrado)
- )
- (define (tecla estado k)
- (cond
- [(key=? "d" k) (/ estado 2)]
- [(key=? "w" k) (* estado 2)]
- [else estado]
- )
- )
- (define (juego2 n)
- (big-bang n
- [on-tick add1]
- [to-draw animacion]
- [stop-when terminar]
- [on-key tecla]
- )
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement