Animated Hud Example: Difference between revisions

From Unofficial EFPSE wiki Extended
Jump to navigation Jump to search
No edit summary
No edit summary
Line 6: Line 6:
Then the hud image is loaded: '''hud image PlayerHP''' followed by the horizontal, vertical position and scale of the hud image.  '''0.64 0.773 0.4''' then the path to your image. In this case mine is in the HUD folder '''HUD/PlayerHP.png'''
Then the hud image is loaded: '''hud image PlayerHP''' followed by the horizontal, vertical position and scale of the hud image.  '''0.64 0.773 0.4''' then the path to your image. In this case mine is in the HUD folder '''HUD/PlayerHP.png'''


That alone will show a single image however if I add $.global.PlayerHealth in to the file name where the image would have its number then when the script reads this part it will see the value for example, if you are at 50% health then the global.PlayerHealth would equal 50 and the scrip would read PlayerHP$global.PlayerHealth.png as PlayerHP50.png showing image number 50 in the sequence.  
That alone will show a single image however if I add $.global.PlayerHealth in to the file name where the image would have its number then when the script reads this part it will see the value, for example, if you are at 50% health then the global.PlayerHealth would equal 50 and the scrip would read PlayerHP$global.PlayerHealth.png as PlayerHP50.png showing image number 50 in the sequence.  
  player check hp global.PlayerHealth
  player check hp global.PlayerHealth
  hud image PlayerHP 0.64 0.773 0.4 HUD/PlayerHP$global.PlayerHealth.png
  hud image PlayerHP 0.64 0.773 0.4 HUD/PlayerHP$global.PlayerHealth.png

Revision as of 11:09, 27 March 2024

Animating a HUD element is pretty straight forward and can be effected by global values. In the following example we are using the level loop script so that we can constantly check the value of global.PlayerHealth and inserting that value in to the image sequence

this part is checking the players health (player check hp global.PlayerHealth)

Then the hud image is loaded: hud image PlayerHP followed by the horizontal, vertical position and scale of the hud image. 0.64 0.773 0.4 then the path to your image. In this case mine is in the HUD folder HUD/PlayerHP.png

That alone will show a single image however if I add $.global.PlayerHealth in to the file name where the image would have its number then when the script reads this part it will see the value, for example, if you are at 50% health then the global.PlayerHealth would equal 50 and the scrip would read PlayerHP$global.PlayerHealth.png as PlayerHP50.png showing image number 50 in the sequence.

player check hp global.PlayerHealth
hud image PlayerHP 0.64 0.773 0.4 HUD/PlayerHP$global.PlayerHealth.png