Skip to content

Instantly share code, notes, and snippets.

@jmeggitt
Last active August 23, 2019 16:06
Show Gist options
  • Save jmeggitt/857b2df021a248ff913dc4b31340f5c1 to your computer and use it in GitHub Desktop.
Save jmeggitt/857b2df021a248ff913dc4b31340f5c1 to your computer and use it in GitHub Desktop.
Prefab(
entities: [
// Grey bat
PrefabEntity(
data: MyPrefabData(
// SpriteScenePrefab
sprite_scene: (
// SpriteSheetPrefab with index 0
sheet: Sheet(
// TexturePrefab
texture: File("texture/Tracks/Track_2_C.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),
anisotropic: Off,
),
),
)),
sprites: [
List((
texture_width: 84,
texture_height: 246,
sprites: [
(x: 0, y: 0, width: 42, height: 246, offsets: (0.0, 0.0)),
(x: 42, y: 0, width: 42, height: 246, offsets: (0.0, 0.0)),
],
)),
],
// optional
name: "tracks",
),
// SpriteRenderPrefab
render: (
sheet: "tracks",
sprite_number: 0,
),
// Transform
transform: (
translation: (-200.0, 37.5, 0.0),
scale: (2.0, 2.0, 2.0),
),
),
// AnimationSetPrefab
animation_set: (
animations: [
(
// AnimationId
Move,
(
samplers: [
(
0,
// Only SpriteIndex channel allowed for SpriteRender in AnimationSetPrefab
SpriteIndex,
(
// Time of key frames
input: [1.0, 1.0,],
// Sprite indexes from SpriteSheet for key frames
output: [1, 0],
// Sprites can only ever be animated with Step
function: Step,
),
),
],
),
),
],
),
),
),
],
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment