(AGK version: AGK2)
Submitted: 2018-01-14 22:18:20
// Created scene with visual editor that has buildings with streetlight poles.
// Load GreyGuy (spriter sample) skeleton and place him between buildings 
// and light poles so it looks like he's walking on the sidewalk.

// ... Visual Editor code to load scene goes above.
// load greyguy JSON exported sample Spine file from spriter
sk = LoadSkeleton2DFromSpriterFile( "GreyGuy.scon", 0.3, 0 )

// position him on sidewalk
SetSkeleton2DPosition( sk, 380, 550 )

// Get current depth of lightpole component (Sprite6ID)
lightPoleDepth = GetSpriteDepth(Sprite6ID)

//  Make depth space between lightpole and buildings (could have been done in Vis-Ed)
lightPoleDepth = lightPoleDepth - 10       // will be 5000 - 10 = 4990
SetSpriteDepth(Sprite6ID,lightPoleDepth)

// Now set GreyGuy depth to between lightpoles (4990 + 5)
ggDepth = lightPoleDepth + 5
SetSkeleton2DDepth(sk,ggDepth)     //  <=  SETS DEPTH TO BETWEEN BACKGROUND COMPONENTS

// play the walk animation
PlaySkeleton2DAnimation( sk, "walk", 0, 1, 0.25 )
Help make AGK better by submitting an example for this command!
(All examples are subject to approval)
Login to post an example of your own.