mirror of
https://github.com/DragonRidersUnite/book
synced 2024-11-16 07:47:42 +01:00
deploy: c9f430d016
This commit is contained in:
parent
ee0980f42b
commit
6f45c0a80d
2 changed files with 2 additions and 2 deletions
|
@ -158,7 +158,7 @@
|
|||
<p><code>#frame_index</code> is a method DragonRuby GTK gives us on integers to keep track of what frame to use when animating. <code>0</code> is when we want to start the animation, which we want to start at the beginning of our game. We have 6 frames in our animation, and we want to display each of them for 8 ticks, repeating forever! Change the <code>hold_for</code> value and see how it affects the animation speed and feel of the game. Pick a rate that feels good for you or just stick with 8.</p>
|
||||
<p>Then we take the <code>player_sprite_index</code> and use that when specifying the <code>path</code> of our player sprite by interpolating it into the path to our sprite. Our dragon frames are named <code>dragon-0.png</code>, <code>dragon-1.png</code>, and so on. So we take what <code>#frame_index</code> gives us and inject it into the path to the image, making that value dynamic. Remember string interpolation from Chapter 1? It comes into play all the time when coding.</p>
|
||||
<h2 id="a-note-on-spritesheets"><a class="header" href="#a-note-on-spritesheets">A Note on Spritesheets</a></h2>
|
||||
<p>If you've done any game development before, you may be familiar with spritesheets, where each frame of an animation is contained within one image file. When using a spritesheet for animation, instead of changing which image file path is used for the sprite to render, you change which piece of the large spritesheet you render. <a href="http://docs.dragonruby.org/#----animation-using-sprite-sheet---main-rb">The DragonRuby GTK docs have a detailed example of how to do this.</a></p>
|
||||
<p>If you've done any game development before, you may be familiar with spritesheets, where each frame of an animation is contained within one image file. When using a spritesheet for animation, instead of changing which image file path is used for the sprite to render, you change which piece of the large spritesheet you render. <a href="https://docs.dragonruby.org/#/samples/rendering-sprites?id=animation-using-sprite-sheet-mainrb">The DragonRuby GTK docs have a detailed example of how to do this.</a></p>
|
||||
<h2 id="extra-credit"><a class="header" href="#extra-credit">Extra Credit</a></h2>
|
||||
<ul>
|
||||
<li>How would you increase the animation speed when the dragon is moving to simulate faster flapping of their wings?</li>
|
||||
|
|
|
@ -1 +1 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:pagemap="http://www.google.com/schemas/sitemap-pagemap/1.0" xmlns:xhtml="http://www.w3.org/1999/xhtml"><url><loc>https://book.dragonriders.community</loc><lastmod>2024-08-11T16:34:59+00:00</lastmod><changefreq>weekly</changefreq><priority>1.0</priority></url><url><loc>https://book.dragonriders.community/01-hello-dragon.html</loc><lastmod>2024-08-11T16:34:59+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/02-player-movement.html</loc><lastmod>2024-08-11T16:34:59+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/03-spit-fire.html</loc><lastmod>2024-08-11T16:34:59+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/04-target-practice.html</loc><lastmod>2024-08-11T16:34:59+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/05-fireball-clean-up.html</loc><lastmod>2024-08-11T16:34:59+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/06-time-attack.html</loc><lastmod>2024-08-11T16:34:59+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/07-high-score.html</loc><lastmod>2024-08-11T16:34:59+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/08-sound.html</loc><lastmod>2024-08-11T16:34:59+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/09-background.html</loc><lastmod>2024-08-11T16:34:59+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/10-animation.html</loc><lastmod>2024-08-11T16:34:59+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/11-scenes.html</loc><lastmod>2024-08-11T16:34:59+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/12-ship-it.html</loc><lastmod>2024-08-11T16:34:59+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/404.html</loc><lastmod>2024-08-11T16:34:59+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/beyond-the-code.html</loc><lastmod>2024-08-11T16:34:59+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/dragonruby-resources.html</loc><lastmod>2024-08-11T16:34:59+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/game-dev-resources.html</loc><lastmod>2024-08-11T16:34:59+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/outro.html</loc><lastmod>2024-08-11T16:34:59+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/ruby-primer.html</loc><lastmod>2024-08-11T16:34:59+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/source-control.html</loc><lastmod>2024-08-11T16:34:59+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url></urlset>
|
||||
<?xml version="1.0" encoding="UTF-8"?><urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:pagemap="http://www.google.com/schemas/sitemap-pagemap/1.0" xmlns:xhtml="http://www.w3.org/1999/xhtml"><url><loc>https://book.dragonriders.community</loc><lastmod>2024-11-04T19:42:45+00:00</lastmod><changefreq>weekly</changefreq><priority>1.0</priority></url><url><loc>https://book.dragonriders.community/01-hello-dragon.html</loc><lastmod>2024-11-04T19:42:45+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/02-player-movement.html</loc><lastmod>2024-11-04T19:42:45+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/03-spit-fire.html</loc><lastmod>2024-11-04T19:42:45+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/04-target-practice.html</loc><lastmod>2024-11-04T19:42:45+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/05-fireball-clean-up.html</loc><lastmod>2024-11-04T19:42:45+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/06-time-attack.html</loc><lastmod>2024-11-04T19:42:45+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/07-high-score.html</loc><lastmod>2024-11-04T19:42:45+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/08-sound.html</loc><lastmod>2024-11-04T19:42:45+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/09-background.html</loc><lastmod>2024-11-04T19:42:45+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/10-animation.html</loc><lastmod>2024-11-04T19:42:45+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/11-scenes.html</loc><lastmod>2024-11-04T19:42:45+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/12-ship-it.html</loc><lastmod>2024-11-04T19:42:45+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/404.html</loc><lastmod>2024-11-04T19:42:45+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/beyond-the-code.html</loc><lastmod>2024-11-04T19:42:45+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/dragonruby-resources.html</loc><lastmod>2024-11-04T19:42:45+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/game-dev-resources.html</loc><lastmod>2024-11-04T19:42:45+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/outro.html</loc><lastmod>2024-11-04T19:42:45+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/ruby-primer.html</loc><lastmod>2024-11-04T19:42:45+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url><url><loc>https://book.dragonriders.community/source-control.html</loc><lastmod>2024-11-04T19:42:45+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority></url></urlset>
|
Loading…
Reference in a new issue