Bootstrap Reactive Unit 5 Displaying the position

5 views
Skip to first unread message

Luis Saltos

unread,
Apr 17, 2019, 8:05:46 AM4/17/19
to Bootstrap-Teachers
Hi,  I am currently working on Unit 5 from Bootstrap Reactive.  There is an optional assignment to display the position of Sam the Butterfly on the screen.  How do I do this so that I can display both the x and y coordinate of Sam?
Thanks

Schanzer (Director)

unread,
Apr 17, 2019, 10:18:13 AM4/17/19
to Bootstrap-Teachers
Hi Luis - thanks so much for writing! As you might imagine, changing what's displayed onscreen is going to require modification to the draw-state function. Specifically, you'll be needing to use put-image to layer another image on top of everything else. This other image is going to be Sam's coordinates.

I'd try the following:
1) Use the text function to make an image of the text "X: 42, Y: 100" (note: the whole thing - including the numbers - is just one big string)
2) Use the text and num-to-string function together to make an image of a string that includes real numbers.
3) Use your solution to #2 inside draw-state, so you see those same (unchanging) numbers when you run the animation
4) Replace those numbers with the fields from a-char

Let us know how it goes - and if you get stuck on one of these, let us know which one!
Emmanuel
Reply all
Reply to author
Forward
0 new messages