This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:guides:beginners:spritesheets_and_animation [2018/02/13 20:47 (7 years ago)] – ↷ Links adapted because of a move operation iarwain | en: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 '' |
- | {{ : | + | {{ : |
- | We can change the [HeroGraphic] to use this image file instead. But first, | + | We can change the [HeroGraphic] to use this image file instead. But first, |
- | + | ||
- | Expand the texture resource list as: | + | |
- | + | ||
- | < | + | |
- | [Resource] | + | |
- | Texture = ../data/object # ../ | + | |
- | </ | + | |
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: |
< | < | ||
[HeroObject] | [HeroObject] | ||
Graphic | Graphic | ||
- | Position | + | Position |
Scale = 2 | Scale = 2 | ||
AnimationSet = HeroAnimationSet | AnimationSet = HeroAnimationSet | ||
</ | </ | ||
- | Next is to define the AnimationSet itself: | + | Next is to define the '' |
< | < | ||
[HeroAnimationSet] | [HeroAnimationSet] | ||
- | Texture = soldier_full.png | + | Texture |
FrameSize = (32, 32, 0) | FrameSize = (32, 32, 0) | ||
</ | </ | ||
Line 63: | Line 56: | ||
< | < | ||
[HeroAnimationSet] | [HeroAnimationSet] | ||
- | Texture = soldier_full.png | + | Texture |
FrameSize = (32, 32, 0) | FrameSize = (32, 32, 0) | ||
- | HeroRun = 6 ; or -1 would be fine too. | + | HeroRun |
StartAnim = HeroRun | StartAnim = HeroRun | ||
</ | </ |