How do I set a number value to a text value?

0 favourites
  • 2 posts
From the Asset Store
OpenAI TTS
$10 USD
Text-to-Speech plugin.Allows your Construct 3 project to convert written text into spoken words
  • So in my game I created health bars. As there are many types of ennemies (warriors, archers, etc...). I created a value called "Stick To" for the health bar. When an ennemy, whose name is "RedWarrior" is created, the value "Stick To" sets to "RedWarrior", so that every tick, the health bar sets its position to "Stick To".X for X and "Stick To".Y for Y. How do I code that in the game?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • If you can have multiple instances of each enemy type, then you need to link health bars to enemies by their UID. Add all enemies to a family "Enemies". Add enemyUID variable to the health bar sprite.

    Enemies on Created 
    	-> Enemies spawn HealthBar
    	-> HealthBar pin to Enemies
    	-> HealthBar set enemyUID variable to Enemies.UID
    
    
    Enemies on collision with Bullet
     -> Enemies subtract 1 from health
    	
     	HealthBar compare variable enemyUID=Enemies.UID
    	 -> (update health bar)
    
    

    .

    Another option is to create a separate health bar object for each enemy type in your game. Then you can simply add each health bar into a container with each enemy, and they will be linked automatically, no need for instance variables.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)