Announcement

Collapse
No announcement yet.

Shifting Controls Inside A GFxMoviePlayer

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Shifting Controls Inside A GFxMoviePlayer

    Hey Everyone,

    I have a HUD Element that displays the health of my player and what I would like to do is have it stay centered on itself similar to how Skyrims health bar works so that it moves inward on itself. Below is an example



    What I did is set up a reference to the object and stored its default variables in a ASDisplayInfo structure along with its default width. Then every time I go to update I make a new version of this information and push the bar over from its initial starting position half of the xscale which is what I modify to make it grow or shrink. Here is the code...

    Code:
    function TickHUD() 
    {
    	local UTPawn UTP;
    	local ASDisplayInfo DI;
    
    	//Health Mechanic
    	UTP = UTPawn(PlayerOwner.Pawn);
    	if (UTP != None) 
    	{
    		if (LastHealthpc != getperc(UTP.Health, UTP.HealthMax)) 
    		{
    			LastHealthpc = getperc(UTP.Health, UTP.HealthMax);
    			
    			if(LastHealthpc < 0) //Make sure this is not a negative number
    				LastHealthpc = 0;
    			
    			DI = HealthBarDefaultDisplay;
    			DI.x = HealthBarDefaultDisplay.x + (HealthBarDefaultWidth*(LastHealthpc/2));
    			DI.y = HealthBarDefaultDisplay.y;
    			DI.XScale = (LastHealthpc > 100 ? 100.0f : LastHealthpc);
    
    			`log("Def.X: " $ HealthBarDefaultDisplay.x);
    			`log("X: " $ DI.x);
    			`log("X-Scale: " $ DI.x);
    			
    			
    			HealthBarMC.SetDisplayInfo(DI);
    		}
    	}
    }
    Unfortunately this does not work, it still acts as the default health bar did and only shifts the scale. The logs are of no use since the numbers never change in the log even though I can clearly see my box scaling, it just wont shift.

    Anybody have any ideas as to why?

    Thanks,

    #2
    Never mind, I got it working thanks to anyone who was working on it.

    Comment

    Working...
    X