Game Development Community

Objects in right spot but don't show?

by J Sears · in Torque Game Builder · 11/20/2006 (5:56 pm) · 1 replies

Here is my code for setting up a game of freecell

$levelNumber=50;
function createLevel()
{
  %file= new FileObject();
  %file.OpenForRead("~/data/levels/levels.cs");
  for(%i=0;%i<$levelNumber;%i++)
  %level=%file.readline();
   
  //set array values to 0
  for(%i=0;%i<8;%i++)
    {
    %columns[%i]=%i;
    }

  %objCount = t2dScene.getSceneObjectCount();
  %objList = t2dScene.getSceneObjectList();
  %columnCounter = 1; 

  //setup the starting 8 column markers, after those the cards themselves will be used
  for(%i=0;%i<%objCount;%i++)
  {
    %obj= getWord(%objList, %i);
    if(%obj.isColumn == %columnCounter)
    {  
      %spot = %columnCounter - 1;    
      %columns[%spot] = %obj;
      echo("this is the obj that should be in there now", %obj);     
      %columnCounter++; 
      echo(%columns[%spot], "this is the object  in the column starting spot");
    }
    if(%columnCounter==9)
      %i=%objCount;
  }  
  %columnCounter = 0;
  %layerCounter = 15; 
  %number = getWordCount(%level); 
  //let's mount those cards
  for(%i=0;%i<%number;%i++)
  {     
     
     for(%j=0;%j<%objCount;%j++)
     {	  
  	  %obj = getWord(%objList, %j);
        %currentWord = getWord(%level, %i);
        if(%obj.imageMap $= %currentWord)
        {    
          %obj.Layer = %layerCounter;         
          %mountPoint = %columns[%columnCounter];
          echo(%mountPoint, "this should be the same objects as above");
          %obj.mount(%mountPoint,0,0.5,0,false,false,false,false);
          %columns[%columnCounter]=%obj;          
	    %columnCounter++;         
          if(%columnCounter==8)
          {
		  %layerCounter--;
		  %columnCounter=0;
          }
	    %j=%objCount;
        }
        
     }
  }
}

it's strange all the echo's come out right and when I hit the stop button and it goes back in the game builder it shows all the cards stacked in the exact right spots right order and right layers. But they won't show up while it's running and that is completly baffling me.

#1
11/20/2006 (6:01 pm)
Nevermind it's amazing how quickly something comes to you when you step away from it for a bit, I had to reorder the way things got called in my game.cs this thread can be deleted.