diff options
author | elioat <elioat@tilde.institute> | 2022-12-21 21:23:29 -0500 |
---|---|---|
committer | elioat <elioat@tilde.institute> | 2022-12-21 21:23:29 -0500 |
commit | 8ea136db5417727a5bb286fd3c6c1cb94793474a (patch) | |
tree | 4bd63fe224fb42a3148ef3c2a6fc401a7eb31c2e | |
parent | 7a62b573087cde23285195d154c8bb73a760b048 (diff) | |
download | december-2022-8ea136db5417727a5bb286fd3c6c1cb94793474a.tar.gz |
*
-rw-r--r-- | src/pokedex/pokedex.rkt | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/pokedex/pokedex.rkt b/src/pokedex/pokedex.rkt index 5af1710..0adebbf 100644 --- a/src/pokedex/pokedex.rkt +++ b/src/pokedex/pokedex.rkt @@ -22,7 +22,6 @@ ;; API URL (define *POKE-API* "https://pokeapi.co/api/v2/") - (define (get-pokemon id) "queries the api, returns a butt ton of info" (call/input-url (string->url (~a *POKE-API* "pokemon/" id)) ; ~a, like string-append but appends *either* strings or numbers to a string @@ -49,10 +48,11 @@ (display (~a " key: " k "\nvalue: " v "\n=====\n"))))) h) -(inspector (dex-entry 11)) -(inspector (dex-entry "bulbasaur")) +; (inspector (dex-entry 11)) +; (inspector (dex-entry "bulbasaur")) (define (get-image id sprite-file-name) + "download a sprite" (define img (hash-ref (dex-entry id) "sprite")) (define img-url (string->url img)) @@ -65,10 +65,12 @@ (display-image sprite-file-name)) (define (display-image image) + "display a sprite" (define display-image (bitmap (make-object bitmap% image))) (frame (scale display-image 1))) (define (see-pokemon id) + "check to see if we've already got a sprite, if we don't, get it" (define sprite-file-name (~a "imgs/" id ".png")) (if (file-exists? sprite-file-name) @@ -78,4 +80,4 @@ (see-pokemon "bulbasaur") (see-pokemon "butterfree") (see-pokemon "pikachu") -(see-pokemon 124) \ No newline at end of file +(see-pokemon 33) \ No newline at end of file |