marijnh / Eloquent-JavaScript

The sources for the Eloquent JavaScript book
https://eloquentjavascript.net
3.02k stars 796 forks source link

Chapter 17, Images section #524

Closed hkiame closed 4 years ago

hkiame commented 4 years ago

The picture containing the game character is of deminsion 480 x 60. Each subpicture is 48 pixels wide and 60 pixels high. So spriteW should be 48 and spriteH should be 60.

karbassi commented 4 years ago

Hello @hkiame, great find. I can see how that can be confusing.

@marijnh has a larger version of the image that is used to showcase what the sprite looks like and the actual image.

The large image /img/player_big.png is 480px × 60px, but the image the code uses is /img/player.png, which is 240px × 30px.

Maybe @marijnh uses the 480px × 60px in both examples to save from confusion.