Game Development Community

bitmap constraint issue

by Ron Yacketta · in Torque Game Engine · 06/02/2003 (6:50 am) · 3 replies

All,

I am trying to make a "sliding" effect for several bitmaps. I am just looping over them and either increasing or decreasing their x pos. I am trying to figure out a way to constrain it such that 5 bitmaps will always be visible.

Here is the code so far

$Slide = 0;
function NextPrevBmp(%val)
{

		clientCmdClear();
		if (%val>0)
		{
			for(%i = 0; %i < $NUM_SLOTS; %i++)
			{
				%j = %i + $Slide;
				if( %j > 9)  {
					%j -= 10;
				}
				
				$VISITEMS[%i] = $MYITEMS[%j];
				
				%item1 = $MYITEMS[%i];
				%posX = getWord(%item1.getPosition(),0) - 56;
				%posY = getWord(%item1.getPosition(),1);
				%item1.Position = %posX SPC %posY;
       
			}
		}
		else
		{
			for(%i = 0; %i < $NUM_SLOTS; %i++)
			{
				%j = %i + $Slide;
				if( %j > 9)  {
					%j -= 10;
				}
				
				$VISITEMS[%i] = $MYITEMS[%j];
				
				%item1 = $MYITEMS[%i];
				%posX = getWord(%item1.getPosition(),0) + 56;
				%posY = getWord(%item1.getPosition(),1);
				%item1.Position = %posX SPC %posY;	
			}
		}
			$Slide++;
			
			if( $Slide > 4) 
			{
				$Slide = 0;
			}
			echo("=>" SPC $Slide);
}



Can you think of a way to ensure that 5 bitmaps are displayed at all times? Right now I have a 290x64 guicontrol that they reside in.

-Ron

#1
06/02/2003 (7:29 am)
I made a similar effect by using animated bitmap control, instead of sliding or scaling the controls. Is that an option for you Ron?
#2
06/02/2003 (7:36 am)
Robert,

care to shed more light than that ;) not sure I follow what your suggesting

maybe you can share a hint of your solution either here or via email? (ryacketta@ciber.com)

-Ron

Only if annimation in TGE was as smooth and easy as RE ;)
#3
06/02/2003 (7:49 am)
Ron,

He means this resource for animated bitmaps.