Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
136 lines (135 sloc) 5.91 KB
#![enable(implicit_some)]
/*!
@import /amethyst_assets/src/prefab/mod.rs#Prefab
@import ../../sprite_animation/main.rs#MyPrefabData
Prefab<MyPrefabData>
*/
Prefab(
entities: [
// Grey arrow
PrefabEntity(
data: MyPrefabData(
// SpriteScenePrefab
sprite_scene: (
// SpriteSheetPrefab with index 0
sheet: Sheet(
// TexturePrefab
texture: File("texture/arrow_semi_transparent.png", (
"IMAGE", (
sampler_info: (
min_filter: Nearest,
mag_filter: Nearest,
mip_filter: Nearest,
wrap_mode: (Tile, Tile, Tile),
lod_bias: (0),
lod_range: (
start: ( 0 ),
end: ( 8000 ),
),
comparison: None,
border: (0),
normalized: true,
anisotropic: Off,
),
),
)),
sprites: [
// arrow sprites
List((
texture_width: 192,
texture_height: 64,
sprites: [
(x: 0, y: 0, width: 32, height: 32, offsets: (0.0, 0.0)),
(x: 32, y: 0, width: 32, height: 32, offsets: (0.0, 0.0)),
(x: 64, y: 0, width: 32, height: 32, offsets: (0.0, 0.0)),
(x: 64, y: 0, width: 32, height: 32, offsets: (0.0, 0.0)),
(x: 96, y: 0, width: 32, height: 32, offsets: (0.0, 0.0)),
(x: 128, y: 0, width: 32, height: 32, offsets: (0.0, 0.0)),
(x: 0, y: 32, width: 32, height: 32, offsets: (0.0, 0.0)),
(x: 32, y: 32, width: 32, height: 32, offsets: (0.0, 0.0)),
(x: 64, y: 32, width: 32, height: 32, offsets: (0.0, 0.0)),
(x: 64, y: 32, width: 32, height: 32, offsets: (0.0, 0.0)),
(x: 96, y: 32, width: 32, height: 32, offsets: (0.0, 0.0)),
(x: 128, y: 32, width: 32, height: 32, offsets: (0.0, 0.0)),
],
)),
],
// optional
name: "arrow",
),
// SpriteRenderPrefab
render: (
sheet: "arrow",
sprite_number: 0,
),
// Transform
transform: (
translation: (50.0, 37.5, 0.0),
),
),
// AnimationSetPrefab
animation_set: (
animations: [
(
// AnimationId
Fly,
(
samplers: [
(
0,
// Only SpriteIndex channel allowed for SpriteRender in AnimationSetPrefab
SpriteIndex,
(
// Time of key frames
input: [0.0, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4],
// Sprite indexes from SpriteSheet for key frames
output: [5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 4],
// Sprites can only ever be animated with Step
function: Step,
),
),
],
),
),
],
),
),
),
// Brown arrow
(
data: (
sprite_scene: (
render: (
// We have already added a SpriteSheet for the previous entity,
// now we can refer to it
sheet: "arrow", // or sheet: 0,
sprite_number: 6,
),
transform: (
translation: (0.0, 37.5, 0.0),
),
),
animation_set: (
animations: [
(
Fly,
(
samplers: [
(
0,
SpriteIndex,
(
input: [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6],
output: [6, 7, 8, 9, 10, 11],
function: Step,
),
),
],
),
),
],
),
),
),
],
)
You can’t perform that action at this time.