Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8,257 changes: 4,166 additions & 4,091 deletions examples/assets/spine/spineboy-pro.json

Large diffs are not rendered by default.

Binary file modified examples/assets/spine/spineboy-pro.skel
Binary file not shown.
92 changes: 48 additions & 44 deletions examples/assets/spine/spineboy.atlas
Original file line number Diff line number Diff line change
Expand Up @@ -3,92 +3,96 @@ spineboy.png
filter: Linear, Linear
scale: 0.5
crosshair
bounds: 352, 7, 45, 45
bounds: 263, 11, 45, 45
eye-indifferent
bounds: 862, 105, 47, 45
bounds: 214, 11, 47, 45
eye-surprised
bounds: 505, 79, 47, 45
bounds: 965, 33, 47, 45
rotate: 90
front-bracer
bounds: 826, 66, 29, 40
bounds: 2, 5, 29, 40
rotate: 90
front-fist-closed
bounds: 786, 65, 38, 41
bounds: 505, 3, 38, 41
rotate: 90
front-fist-open
bounds: 710, 51, 43, 44
bounds: 790, 9, 43, 44
rotate: 90
front-foot
bounds: 210, 6, 63, 35
bounds: 149, 21, 63, 35
front-shin
bounds: 665, 128, 41, 92
bounds: 505, 43, 41, 92
rotate: 90
front-thigh
bounds: 2, 2, 23, 56
bounds: 359, 14, 23, 56
rotate: 90
front-upper-arm
bounds: 250, 205, 23, 49
bounds: 955, 8, 23, 49
rotate: 90
goggles
bounds: 665, 171, 131, 83
bounds: 180, 58, 131, 83
gun
bounds: 798, 152, 105, 102
bounds: 313, 39, 105, 102
head
bounds: 2, 27, 136, 149
bounds: 29, 83, 136, 149
rotate: 90
hoverboard-board
bounds: 2, 178, 246, 76
bounds: 180, 143, 246, 76
hoverboard-thruster
bounds: 722, 96, 30, 32
rotate: 90
bounds: 790, 57, 30, 32
hoverglow-small
bounds: 275, 81, 137, 38
bounds: 826, 54, 137, 38
mouth-grind
bounds: 614, 97, 47, 30
bounds: 707, 8, 47, 30
mouth-oooo
bounds: 612, 65, 47, 30
bounds: 658, 8, 47, 30
mouth-smile
bounds: 661, 64, 47, 30
bounds: 548, 11, 47, 30
muzzle-glow
bounds: 382, 54, 25, 25
bounds: 997, 194, 25, 25
muzzle-ring
bounds: 275, 54, 25, 105
rotate: 90
bounds: 2, 114, 25, 105
muzzle01
bounds: 911, 95, 67, 40
bounds: 965, 82, 67, 40
rotate: 90
muzzle02
bounds: 792, 108, 68, 42
muzzle03
bounds: 956, 171, 83, 53
bounds: 953, 151, 68, 42
rotate: 90
muzzle03
bounds: 420, 31, 83, 53
muzzle04
bounds: 275, 7, 75, 45
bounds: 2, 36, 75, 45
muzzle05
bounds: 140, 3, 68, 38
bounds: 79, 43, 68, 38
neck
bounds: 250, 182, 18, 21
bounds: 997, 171, 18, 21
portal-bg
bounds: 140, 43, 133, 133
bounds: 563, 86, 133, 133
portal-flare1
bounds: 554, 65, 56, 30
bounds: 79, 11, 56, 30
portal-flare2
bounds: 759, 112, 57, 31
rotate: 90
bounds: 836, 21, 57, 31
portal-flare3
bounds: 554, 97, 58, 30
bounds: 895, 22, 58, 30
portal-shade
bounds: 275, 121, 133, 133
bounds: 428, 86, 133, 133
portal-streaks1
bounds: 410, 126, 126, 128
bounds: 698, 91, 126, 128
portal-streaks2
bounds: 538, 129, 125, 125
bounds: 826, 94, 125, 125
rear-bracer
bounds: 857, 67, 28, 36
bounds: 756, 2, 28, 36
rear-foot
bounds: 663, 96, 57, 30
bounds: 599, 14, 57, 30
rear-shin
bounds: 414, 86, 38, 89
bounds: 599, 46, 38, 89
rotate: 90
rear-thigh
bounds: 756, 63, 28, 47
bounds: 310, 9, 28, 47
rotate: 90
rear-upper-arm
bounds: 60, 5, 20, 44
bounds: 417, 9, 20, 44
rotate: 90
torso
bounds: 905, 164, 49, 90
bounds: 698, 40, 49, 90
rotate: 90
Binary file modified examples/assets/spine/spineboy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ class FlameSpineExample extends FlameGame with TapCallbacks {
);

// Set the "walk" animation on track 0 in looping mode
spineboy.animationState.setAnimationByName(0, 'walk', true);
spineboy.animationState.setAnimation(0, 'walk', true);
await add(spineboy);
}

@override
void onTapDown(_) {
_stateIndex = (_stateIndex + 1) % states.length;
spineboy.animationState.setAnimationByName(0, states[_stateIndex], true);
spineboy.animationState.setAnimation(0, states[_stateIndex], true);
}

@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ class SharedDataSpineExample extends FlameGame with TapCallbacks {
components.
''';

late final SkeletonData cachedSkeletonData;
late final Atlas cachedAtlas;
late final SkeletonDataFlutter cachedSkeletonData;
late final AtlasFlutter cachedAtlas;
late final List<SpineComponent> spineboys = [];

@override
Future<void> onLoad() async {
await initSpineFlutter();
// Pre-load the atlas and skeleton data once.
cachedAtlas = await Atlas.fromAsset('assets/spine/spineboy.atlas');
cachedSkeletonData = await SkeletonData.fromAsset(
cachedAtlas = await AtlasFlutter.fromAsset('assets/spine/spineboy.atlas');
cachedSkeletonData = await SkeletonDataFlutter.fromAsset(
cachedAtlas,
'assets/spine/spineboy-pro.skel',
);
Expand All @@ -30,15 +30,19 @@ class SharedDataSpineExample extends FlameGame with TapCallbacks {
// atlas.
final rng = Random();
for (var i = 0; i < 100; i++) {
final drawable = SkeletonDrawable(cachedAtlas, cachedSkeletonData, false);
final drawable = SkeletonDrawableFlutter(
cachedAtlas,
cachedSkeletonData,
false,
);
final scale = 0.1 + rng.nextDouble() * 0.2;
final position = Vector2.random(rng)..multiply(size);
final spineboy = SpineComponent(
drawable,
scale: Vector2.all(scale),
position: position,
);
spineboy.animationState.setAnimationByName(0, 'walk', true);
spineboy.animationState.setAnimation(0, 'walk', true);
spineboys.add(spineboy);
}
await addAll(spineboys);
Expand All @@ -47,10 +51,10 @@ class SharedDataSpineExample extends FlameGame with TapCallbacks {
@override
void onTapDown(_) {
for (final spineboy in spineboys) {
spineboy.animationState.setAnimationByName(0, 'jump', false);
spineboy.animationState.setAnimation(0, 'jump', false);
spineboy.animationState.setListener((type, track, event) {
if (type == EventType.complete) {
spineboy.animationState.setAnimationByName(0, 'walk', true);
spineboy.animationState.setAnimation(0, 'walk', true);
}
});
}
Expand Down
11 changes: 11 additions & 0 deletions packages/flame_spine/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,14 @@ conditions of the Spine Runtime License Agreement (see the LICENSE file).

**In particular, in order to use `flame_spine` you are required to obtain a valid Spine Editor
License.**


## Spine 4.2 vs Spine 4.3

Make sure that you are using the right version of `flame_spine` for your current version of the
Spine Editor.

For Spine 4.2, `v0.2.2` is the last release. Spine 4.3 support begins with `v0.3.0`.

To migrate from 4.2 to 4.3 models, make sure to re-export any existing 4.2 models through the 4.3
Spine Editor, and follow the `spine_flutter` [migration guide](https://pub.dev/packages/spine_flutter/changelog).
Binary file modified packages/flame_spine/example/assets/spineboy-pro.skel
Binary file not shown.
92 changes: 48 additions & 44 deletions packages/flame_spine/example/assets/spineboy.atlas
Original file line number Diff line number Diff line change
Expand Up @@ -3,92 +3,96 @@ spineboy.png
filter: Linear, Linear
scale: 0.5
crosshair
bounds: 352, 7, 45, 45
bounds: 263, 11, 45, 45
eye-indifferent
bounds: 862, 105, 47, 45
bounds: 214, 11, 47, 45
eye-surprised
bounds: 505, 79, 47, 45
bounds: 965, 33, 47, 45
rotate: 90
front-bracer
bounds: 826, 66, 29, 40
bounds: 2, 5, 29, 40
rotate: 90
front-fist-closed
bounds: 786, 65, 38, 41
bounds: 505, 3, 38, 41
rotate: 90
front-fist-open
bounds: 710, 51, 43, 44
bounds: 790, 9, 43, 44
rotate: 90
front-foot
bounds: 210, 6, 63, 35
bounds: 149, 21, 63, 35
front-shin
bounds: 665, 128, 41, 92
bounds: 505, 43, 41, 92
rotate: 90
front-thigh
bounds: 2, 2, 23, 56
bounds: 359, 14, 23, 56
rotate: 90
front-upper-arm
bounds: 250, 205, 23, 49
bounds: 955, 8, 23, 49
rotate: 90
goggles
bounds: 665, 171, 131, 83
bounds: 180, 58, 131, 83
gun
bounds: 798, 152, 105, 102
bounds: 313, 39, 105, 102
head
bounds: 2, 27, 136, 149
bounds: 29, 83, 136, 149
rotate: 90
hoverboard-board
bounds: 2, 178, 246, 76
bounds: 180, 143, 246, 76
hoverboard-thruster
bounds: 722, 96, 30, 32
rotate: 90
bounds: 790, 57, 30, 32
hoverglow-small
bounds: 275, 81, 137, 38
bounds: 826, 54, 137, 38
mouth-grind
bounds: 614, 97, 47, 30
bounds: 707, 8, 47, 30
mouth-oooo
bounds: 612, 65, 47, 30
bounds: 658, 8, 47, 30
mouth-smile
bounds: 661, 64, 47, 30
bounds: 548, 11, 47, 30
muzzle-glow
bounds: 382, 54, 25, 25
bounds: 997, 194, 25, 25
muzzle-ring
bounds: 275, 54, 25, 105
rotate: 90
bounds: 2, 114, 25, 105
muzzle01
bounds: 911, 95, 67, 40
bounds: 965, 82, 67, 40
rotate: 90
muzzle02
bounds: 792, 108, 68, 42
muzzle03
bounds: 956, 171, 83, 53
bounds: 953, 151, 68, 42
rotate: 90
muzzle03
bounds: 420, 31, 83, 53
muzzle04
bounds: 275, 7, 75, 45
bounds: 2, 36, 75, 45
muzzle05
bounds: 140, 3, 68, 38
bounds: 79, 43, 68, 38
neck
bounds: 250, 182, 18, 21
bounds: 997, 171, 18, 21
portal-bg
bounds: 140, 43, 133, 133
bounds: 563, 86, 133, 133
portal-flare1
bounds: 554, 65, 56, 30
bounds: 79, 11, 56, 30
portal-flare2
bounds: 759, 112, 57, 31
rotate: 90
bounds: 836, 21, 57, 31
portal-flare3
bounds: 554, 97, 58, 30
bounds: 895, 22, 58, 30
portal-shade
bounds: 275, 121, 133, 133
bounds: 428, 86, 133, 133
portal-streaks1
bounds: 410, 126, 126, 128
bounds: 698, 91, 126, 128
portal-streaks2
bounds: 538, 129, 125, 125
bounds: 826, 94, 125, 125
rear-bracer
bounds: 857, 67, 28, 36
bounds: 756, 2, 28, 36
rear-foot
bounds: 663, 96, 57, 30
bounds: 599, 14, 57, 30
rear-shin
bounds: 414, 86, 38, 89
bounds: 599, 46, 38, 89
rotate: 90
rear-thigh
bounds: 756, 63, 28, 47
bounds: 310, 9, 28, 47
rotate: 90
rear-upper-arm
bounds: 60, 5, 20, 44
bounds: 417, 9, 20, 44
rotate: 90
torso
bounds: 905, 164, 49, 90
bounds: 698, 40, 49, 90
rotate: 90
4 changes: 2 additions & 2 deletions packages/flame_spine/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ class SpineExample extends FlameGame with TapCallbacks {
);

// Set the "walk" animation on track 0 in looping mode
spineboy.animationState.setAnimationByName(0, 'walk', true);
spineboy.animationState.setAnimation(0, 'walk', true);
await add(spineboy);
}

@override
void onTapDown(_) {
_stateIndex = (_stateIndex + 1) % states.length;
spineboy.animationState.setAnimationByName(0, states[_stateIndex], true);
spineboy.animationState.setAnimation(0, states[_stateIndex], true);
}

@override
Expand Down
Loading