Now I am trying to set new child cards to them but it gives me problem, meaning it sets first child row at the right position but they rest of children row are at wrong position.
I am finding the last child in the children list of parent node thenode[j]
by doing
Code: Select all
last_node->setPosition(vector3df(node_pos_x,node_pos_y,node_pos_z));
parent_node=thenode[i];
list_node=(ISceneNode*)(*parent_node->getChildren().getLast());
Code: Select all
list_node->addChild(last_node);
Whys that happening ?? (
Problem 2 ::First time this fucntion set_new_row(int level) is called, it sets the new child card at right distance from last child of that particular column but when I call this function second time or third time , it messes up the distance .
I havent been able to figure out either ( , Please help me .
Thanks a lot !
Code: Select all
void set_new_row(int level)
{
ISceneNode* last_node;
ISceneNode* parent_node;
ISceneNode* list_node;
int node_pos_x=0;
int node_pos_y=0;
int node_pos_z=0;
ITexture* halfchild_texture = driver->getTexture("media_jpg/b1pt.jpg");
ITexture* fullchild_texture;
int ran_num;
char buffer[30];
char *texture_name=new char[20];
for(int i=0;i<10;i++)
{
ran_num=non_rep_rand_num();
texture_name=texture_file(texture_name,ran_num,level);
sprintf_s(buffer,30,"media_jpg/%s",texture_name);
fullchild_texture = driver->getTexture(buffer);
node_pos_x=0;
node_pos_y=cards_per_col[i];
node_pos_z=-((11*cards_per_col[i])+50);
printf("node_pos_z==\n",node_pos_z);
last_node=smgr->addMeshSceneNode(full_cards_mesh);
last_node->setMaterialFlag(EMF_LIGHTING, false);
last_node->setMaterialTexture(0,fullchild_texture);
last_node->setPosition(vector3df(node_pos_x,node_pos_y,node_pos_z));
parent_node=thenode[i];
list_node=(ISceneNode*)(*parent_node->getChildren().getLast());
list_node->addChild(last_node);
cards_per_col[i]=cards_per_col[i]+1;
}
return;
}