Thanks for buying the book. I do hope that it delivers what you are looking for in JavaScript and programming in particular.
You are not going to find a lot there on SVG (but plenty on graphics in general). You might find this link https://www.aleksandrhovhannisyan.com/blog/svg-tutorial-how-to-code-svg-icons-by-hand/ helpful though. The title suggests that it is all about icons but it ends up as an excellent introduction to drawing with SVG.
Hi Mike, I purchased a couple of copies of the First Edition of your 'Learn to Program' book, one as a gift for my lad. Thanks for taking the time to put it all together. Lots of useful ground covered and I am enjoying going through it.
So far, I've only built a version of the breakout game. It works reasonably well. Checking elsewhere to see what might improve the 'glitchiness' in the animation in my browser on my laptop, the general consensus seems to be to use requestAnimationFrame(yourGameLoop) instead of setInterval(), passing in your game loop function as a callback.
For anyone else who has a similar issue, requestAnimationFrame() seems to be the recommended way to update animations in a way that's synchronised with the browser's refresh rate. It ensures that your update routines are called at the best time for rendering performance. However, you will have to change the approach to speeding up the movement. Helpful docs can be found on Mozilla's developer site, here: https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame
I'm looking forward to learning more as I go through your book. I would have liked to see a few more explanatory illustrations to help explain some of the trickier code sections and for general explanations for things like collision detection.
I do think a section on SVG animation for a future edition would make a good addition, but I'm grateful for what you have made available here on your blog. Maybe you have already added an SVG example to the second edition?
Thanks again!
PS. The Amazon Fulfillment production is very good. So far, my copy is holding together well after a lot of page turning. Due to its size, it stays open at the page I want without having to hold it which is perfect for reading and typing!
Hi, I do hope that you are reading the second edition of "Learn to Program" and not the first which has been out of print for quite a while. The second edition was written in response to some changes in the proposed "tool set" and to some changes to browser security that had an impact on later projects. This also allowed some improvements in the text. You can quickly check by looking at the Contents - chapter 10 is titled "Gamepads and Touch" in the first edition and "A Touch of This" in the second.
To address your point on using requestAnimationFrame() rather than setInterval(). You are quite correct IF your primary intention is to learn game programming although choosing that timing procedure is best left until the latter stages of developing a project. It is very useful to be able to adjust the time interval while developing the code - it makes the development process (particularly in that first project) clearer. In truth it also made it easier for me to use the same code across multiple hardware platforms.
I do hope that you continue to work through the book as I think that there is a lot of pleasure to be gained in trying and learning the whole range of programming techniques. [OK, as the author, I am probably prejudiced.]
Just bought your book, hoping to read up on your SVG code as I progress through your book.
ReplyDeleteThanks for buying the book. I do hope that it delivers what you are looking for in JavaScript and programming in particular.
ReplyDeleteYou are not going to find a lot there on SVG (but plenty on graphics in general). You might find this link https://www.aleksandrhovhannisyan.com/blog/svg-tutorial-how-to-code-svg-icons-by-hand/ helpful though. The title suggests that it is all about icons but it ends up as an excellent introduction to drawing with SVG.
Hi Mike, I purchased a couple of copies of the First Edition of your 'Learn to Program' book, one as a gift for my lad. Thanks for taking the time to put it all together. Lots of useful ground covered and I am enjoying going through it.
ReplyDeleteSo far, I've only built a version of the breakout game. It works reasonably well. Checking elsewhere to see what might improve the 'glitchiness' in the animation in my browser on my laptop, the general consensus seems to be to use requestAnimationFrame(yourGameLoop) instead of setInterval(), passing in your game loop function as a callback.
For anyone else who has a similar issue, requestAnimationFrame() seems to be the recommended way to update animations in a way that's synchronised with the browser's refresh rate. It ensures that your update routines are called at the best time for rendering performance. However, you will have to change the approach to speeding up the movement. Helpful docs can be found on Mozilla's developer site, here: https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame
I'm looking forward to learning more as I go through your book. I would have liked to see a few more explanatory illustrations to help explain some of the trickier code sections and for general explanations for things like collision detection.
I do think a section on SVG animation for a future edition would make a good addition, but I'm grateful for what you have made available here on your blog. Maybe you have already added an SVG example to the second edition?
Thanks again!
PS. The Amazon Fulfillment production is very good. So far, my copy is holding together well after a lot of page turning. Due to its size, it stays open at the page I want without having to hold it which is perfect for reading and typing!
Hi, I do hope that you are reading the second edition of "Learn to Program" and not the first which has been out of print for quite a while. The second edition was written in response to some changes in the proposed "tool set" and to some changes to browser security that had an impact on later projects. This also allowed some improvements in the text. You can quickly check by looking at the Contents - chapter 10 is titled "Gamepads and Touch" in the first edition and "A Touch of This" in the second.
ReplyDeleteTo address your point on using requestAnimationFrame() rather than setInterval(). You are quite correct IF your primary intention is to learn game programming although choosing that timing procedure is best left until the latter stages of developing a project. It is very useful to be able to adjust the time interval while developing the code - it makes the development process (particularly in that first project) clearer. In truth it also made it easier for me to use the same code across multiple hardware platforms.
I do hope that you continue to work through the book as I think that there is a lot of pleasure to be gained in trying and learning the whole range of programming techniques. [OK, as the author, I am probably prejudiced.]