I just cut this out of my editor hope it helps this takes a vector frameimg from tiled. I just wrote this function. If you already have a tiled importor this will help to see what I did.
void RSPRITE::ADDANMISPRITE22(char *name,int layernum, int spriteimp,vector<int> frameimg,int thespritewidth,int thespritehieght,int mapw, int maph,int xpos,int ypos,int depth)
{
int cnt=0,cnt2=0;
int counter=0;
int xpost=0;
int spritecreate=agk::CreateSprite(agk::LoadImage(name));
int numtframes=agk::Ceil(agk::GetSpriteHeight(spritecreate)*agk::GetSpriteWidth(spritecreate)/thespritewidth/thespritehieght);
agk::SetSpriteAnimation(spritecreate,thespritewidth,thespritehieght,numtframes);
//agk::Create
agk::SetSpriteDepth(spritecreate,depth);
int theclonespr;
positionsprite.animationcnt=1;
int numt=0;
float irenx=0,ireny=0;
float renderX=0,renderY=0;
for(int xxxcnt=0;xxxcnt<maph;xxxcnt++)
{
// renderX = thespritehieght-((xxxcnt%1) * thespritewidth/2);
for(int yyycnt=0;yyycnt<mapw;yyycnt++)
{
if(cnt<frameimg.size()&&frameimg.size()!=0)
{
if(frameimg[cnt]!=0)
{
theclonespr=agk::CloneSprite(spritecreate);
agk::SetSpriteFrame(theclonespr,frameimg[cnt]);
// agk::SetSpriteShape(clone,2);
agk::SetSpritePosition(theclonespr,renderX,renderY);
ADDSPRITE(name,theclonespr,0,lpos,true,thespritewidth,thespritehieght);
listpositionsprite[lpos][listpositionsprite[lpos].size()-1].animatedsprite=true;
listpositionsprite[lpos][listpositionsprite[lpos].size()-1].activatedsprite=true;
listpositionsprite[lpos][listpositionsprite[lpos].size()-1].intacross=thespritewidth;
listpositionsprite[lpos][listpositionsprite[lpos].size()-1].intdown=thespritehieght;
for(int ttcnt=0;ttcnt<listpositionsprite[lpos][listpositionsprite[lpos].size()-1].tickmark.size();ttcnt++)
{
listpositionsprite[lpos][listpositionsprite[lpos].size()-1].xpossprite[ttcnt]=renderX;
listpositionsprite[lpos][listpositionsprite[lpos].size()-1].ypossprite[ttcnt]=renderY;
listpositionsprite[lpos][listpositionsprite[lpos].size()-1].angle[ttcnt]=0;
listpositionsprite[lpos][listpositionsprite[lpos].size()-1].curframe2[ttcnt]=frameimg[cnt];
}
listpositionsprite[lpos][listpositionsprite[lpos].size()-1].spriteanimationframes=numtframes;
}
// sprites.push_back(clone);
}
renderX += thespritewidth/2;
renderY+=thespritehieght/2;
cnt++;
}
irenx-= thespritewidth/2;
ireny+= thespritehieght/2;
renderX=irenx;
renderY=ireny;
//renderX=renderX-thespritewidth/2;
}
for(int xxcnt=32;xxcnt<47;xxcnt++)
{
agk::DeleteSprite(xxcnt);
agk::CloneSprite(xxcnt,spritecreate);
agk::FixSpriteToScreen(xxcnt,1);
agk::SetSpriteDepth(xxcnt,2);
agk::SetSpriteSize(xxcnt,32,32);
agk::SetSpritePosition(xxcnt,agk::GetDeviceWidth()-37,numt*34+40);
agk::SetSpriteFrame(xxcnt,positionsprite.animationcnt);
positionsprite.animationcnt++;
numt++;
}
agk::DeleteSprite(spritecreate);
this is the part that that is the easy part about it
renderX += thespritewidth/2;
renderY+=thespritehieght/2;
cnt++;
}
irenx-= thespritewidth/2;
ireny+= thespritehieght/2;
renderX=irenx;
renderY=ireny;
Developer of Space Chips, pianobasic, zipzapzoom, and vet pinball apps. Developed the tiled map engine seen on the showcase. Veteran for the military.