Author | Message |
---|---|
Amedrano
Posts: 80
|
Posted 15:46 Oct 23, 2015 |
(my-animate (list HIGHEST-Y-POS LOWEST-Y-POS) create-scene up-and-down at-bottom?) I tried to run this but I can only see one ball on screen. Anyone else have this problem? |
dbravoru
Posts: 60
|
Posted 15:52 Oct 23, 2015 |
I think you're the one that's supposed to make it create two balls on the screen. In the notes it says you should be able to use (my-animate (list ball1 ball2) <your draw function> <your update function> <your termination function>) whereas the method you have uses a list of y positions. |
dbravoru
Posts: 60
|
Posted 15:53 Oct 23, 2015 |
Sorry if that wasn't entirely helpful, still trying to figure it out myself lol. |
Amedrano
Posts: 80
|
Posted 15:53 Oct 23, 2015 |
isn't that what this (define (create-scene y-pos-pair) ;; create the background image (let* ([image0 (empty-scene WIDTH HEIGHT)] [x-pos1 (/ WIDTH 3)] [y-pos1 (min (first y-pos-pair) LOWEST-Y-POS)] ;; put the object on the background image to create image1 [image1 (place-image FALLING-OBJECT x-pos1 y-pos1 image0)] [x-pos2 (* 2 (/ WIDTH 3))] [y-pos2 (max (second y-pos-pair) HIGHEST-Y-POS)] ;; put the second object on image1 to create image2. [image2 (place-image FALLING-OBJECT x-pos2 y-pos2 image0)] ) ;; return image2 as the result. image2)) function does? |
Amedrano
Posts: 80
|
Posted 15:54 Oct 23, 2015 |
No worries I appreciate all the help and responses I get. :) |
dbravoru
Posts: 60
|
Posted 15:55 Oct 23, 2015 |
I had previously thought so as well. This basically sets up the animation. In an animation, you have still images that appear to be moving, but what is really happening is the same image is being placed in a slightly different position than before. Think of a slow-motion movie; if you pause and unpause, it looks like each frame can be individual images. That is what is happening here. |
dbravoru
Posts: 60
|
Posted 15:57 Oct 23, 2015 |
http://www.ccs.neu.edu/home/matthias/HtDP2e/part_prologue.html The section on 'Inputs and Outputs' simplifies what is happening there. |
jasonmz
Posts: 7
|
Posted 16:58 Oct 23, 2015 |
By the way, the code from the wiki [image2 (place-image FALLING-OBJECT x-pos2 y-pos2 image0)] should be. [image2 (place-image FALLING-OBJECT x-pos2 y-pos2 image1)] Just a typo I think. |
dbravoru
Posts: 60
|
Posted 17:08 Oct 23, 2015 |
I think you're right ^ |
rabbott
Posts: 1649
|
Posted 19:35 Oct 23, 2015 |
You're right. The line should be [image2 (place-image FALLING-OBJECT x-pos2 y-pos2 image1)] And you're right that this is the function that puts two balls on the screen. |