
previous

page 23
next
Here's my list:
- clicking the same card twice makes it vanish;
- clicking an empty space - a card appears;
- click on lots of cards rapidly and many are turned;
- no green background;
- display not centred on page;
- cards not in a 4 x 4 layout;
- if the browser window is small, you can't see all the cards.
Making Things Better
The first two are easy to fix once we realise that a player should only be able to click on a card back.
So all we need is something like:
function card_clicked(image) {
if (image.src=='cards/back.png') {
if (image.src=='cards/back.png') {
You may like to try this and then come back here to find out why (surprisingly) it doesn't work!
Try this to see what the problem is:
function card_clicked(image) {
alert(image.src);
alert(image.src);
So we have to figure out a way to use the browser's way of storing an image's source.
previous
next