User Tools

Site Tools


en:guides:beginners:spritesheets_and_animation

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:guides:beginners:spritesheets_and_animation [2018/02/13 20:47 (7 years ago)] – ↷ Links adapted because of a move operation iarwainen:guides:beginners:spritesheets_and_animation [2021/07/05 20:22 (4 years ago)] (current) – Typo iarwain
Line 1: Line 1:
 ====== Part 7 – Spritesheets and Animation ====== ====== Part 7 – Spritesheets and Animation ======
  
-In the previous part, we put an object on the screen that used a single image. Most often though, you will want to use a sprite sheet for your objects that contain one or more animations.+In the previous part, we put an object on the screen that used a single image of a soldier. Most often though, you will want to use a sprite sheet for your objects that contain one or more animations.
  
 Using config we can cut the image up into many graphic sections and make them available for animations. Using config we can cut the image up into many graphic sections and make them available for animations.
  
-In the data\anim asset folder is a spritesheet for our hero called soldier_full.png which looks like this:+Back over in the Orx project, in the ''orx/tutorial/data/anim'' asset folder is a spritesheet for our hero called soldier_full.png which looks like this:
  
-{{ :guides:beginners:soldier_full.png?nolink&128 |}}+{{ :guides:beginners:soldier_full.png?200&nolink&128 |}}
  
-We can change the [HeroGraphic] to use this image file instead. But first, the config needs to know how to find the anim folder. +We can change the [HeroGraphic] to use this image file instead. But first, copy this image to the ''data/texture'' folder in our project.
- +
-Expand the texture resource list as: +
- +
-<code=ini> +
-[Resource] +
-Texture = ../data/object # ../data/anim +
-</code>+
  
 Now it is possible to change the HeroGraphic texture: Now it is possible to change the HeroGraphic texture:
Line 39: Line 32:
 In order to use all six frames on the sprite sheet to animate our hero character, we can define some animation for him. In order to use all six frames on the sprite sheet to animate our hero character, we can define some animation for him.
  
-Our first task is the give the hero object an animation set:+Our first task is to give the hero object an animation set:
  
 <code=ini> <code=ini>
 [HeroObject] [HeroObject]
 Graphic      = HeroGraphic Graphic      = HeroGraphic
-Position     = (50400, 0)+Position     = (-350100, 0)
 Scale        = 2 Scale        = 2
 AnimationSet = HeroAnimationSet AnimationSet = HeroAnimationSet
 </code> </code>
  
-Next is to define the AnimationSet itself:+Next is to define the ''AnimationSet'' itself:
  
 <code=ini> <code=ini>
 [HeroAnimationSet] [HeroAnimationSet]
-Texture = soldier_full.png+Texture   = soldier_full.png
 FrameSize = (32, 32, 0) FrameSize = (32, 32, 0)
 </code> </code>
Line 63: Line 56:
 <code=ini> <code=ini>
 [HeroAnimationSet] [HeroAnimationSet]
-Texture = soldier_full.png+Texture   = soldier_full.png
 FrameSize = (32, 32, 0) FrameSize = (32, 32, 0)
-HeroRun = 6 ; or -1 would be fine too.+HeroRun   = 6 ; or -1 would be fine too.
 StartAnim = HeroRun StartAnim = HeroRun
 </code> </code>
en/guides/beginners/spritesheets_and_animation.1518583676.txt.gz · Last modified: 2018/02/14 00:47 (7 years ago) (external edit)