Basic Health Bar

26.  Rename to HealthBar.py
  • Text Editor menu >> Name box
Note:
  • You don't have to rename it
     
  • You can leave it as HealthBar.txt
27. Add a Message Sensor to Health_Bar
  • Logic Editor >> Sensors >> Add Sensor >> Message
     
  • Subject: Update_Health_Bar
Note:
  • The message sensor will listen for messages with the Subject Update_Health_Bar.
     
  • A message actuator attached to the Player (in the Main Scene) will send the message.
28.  Add a Python Controller
  • Logic Editor >> Controllers >> Add Controller >> Python
     
  • Execution Method: Script
Note:
  • You need a Python Controller to run a python script
29.  Select the python script named HealthBar.py
  • Logic Editor >> Controllers >> Python Controller
     
  • Script >> Script List >> HealthBar.py
Note:
  • Earlier, we opened HealthBar.py in the Text Editor 
     
  • That added HealthBar.py to the game engine's python script list
30. Add an Action Actuator
  • Logic Editor >> Actuators >> Add Actuator >> Action