10. Challenge 4 - Solution
How to set up a simple game window that uses a very large scrollable game board with a huge image as the background, so that game pieces placed on that background would scroll in and out of view?
You can get some nice maps on the web site http://imgur.com/. Use the following url to fetch them: http://i.imgur.com/. The following images http://imgur.com/gallery/OssbQN3.jpeg and http://i.imgur.com/XXxgr7x.jpeg are particularly nice map background. The solution may look like the figure below.
- You can create a morph from an image using
- You can obtain the size of an image (usefull to create a PasteUpMorph of the right size) with the following messages
- You can download a picture using
ZnEasy getJpeg: url.
- Have a look at
PasteUpMorph this is a morph to drop stuff in.
- To define the size of a pasteUpMorph, use the message
extent:. To define the background morph of a pasteUpMorph use the message
- You will need to add Scrollbars so use a ScrollPane: Use
aScrollPane scroller addMorph: aPasteUp to put the scrollbar around the pasteUp.