Yes! John just taught you how to fish.
> On Mar 22, 2017, at 3:51 PM, 'John Clements' via Racket Users
> wrote:
>
>
>> On Mar 22, 2017, at 12:45 PM, Angus wrote:
>>
>> I am a bit stuck on rendering images in a list.
>>
>> Here is my code below.
>>
>> (require 2htdp/image)
>>
>> (define
Hi Angus
Usually it helps to start by getting something simple to work and then
little-by-little adding more.
E.g. Here's a working example with squares instead of bears, and limited to
just varying rotation ...
#lang racket
(require 2htdp/image)
(define blue-square (square 25 'solid 'blue))
> On Mar 22, 2017, at 12:51 PM, 'John Clements' via Racket Users
> wrote:
>
>> On Mar 22, 2017, at 12:45 PM, Angus wrote:
>>
>> render-bear works but I can't get render-bears to work. What am I doing
>> wrong? Any hints?
>
> Rendering bears is quite dangerous. I’m surprised you got even on
2thdp/image isn't effectful; images are values. You need to combine the
image you get from rendering one bear with the image you get from rendering
the rest of the list. You can do so using one of the combiners provided by
the library:
(combiner-of-choice (render-bear (first bears))
> On Mar 22, 2017, at 12:45 PM, Angus wrote:
>
> I am a bit stuck on rendering images in a list.
>
> Here is my code below.
>
> (require 2htdp/image)
>
> (define-struct bear-state (x y rotation size))
>
> (define MTS (empty-scene WIDTH HEIGHT))
>
> BEAR-IMAGE is just a graphic - of a bear.
I am a bit stuck on rendering images in a list.
Here is my code below.
(require 2htdp/image)
(define-struct bear-state (x y rotation size))
(define MTS (empty-scene WIDTH HEIGHT))
BEAR-IMAGE is just a graphic - of a bear.
(define (render-bear b)
(place-image (scale (bear-state-size b) (rota
6 matches
Mail list logo