How do I Turn system?

0 favourites
  • 5 posts
From the Asset Store
A well commented RPG game template to learn from or use as a base for your own game!
  • In the game, I use one sprite to have several enemies who are identical sprites placed in different locations on the layout.

    Each enemy has an instance variable called ‘AP,’ and they all start with 10 AP.

    Now, when I press the spacebar (start his turn), a sequence of events should occur. First, the system selects ONE random enemy, sets a timer to decrement its AP by 1 every 0.1 seconds until it reaches 0. Once an enemy’s AP reaches 0, the system selects the next enemy, and the process repeats. When all enemies have 0 AP do something, for example start Player turn. How can I achieve this?

  • To select the random enemy use system pick a random instance of enemy. Use a variable on the enemy to enable when it's selected and the AP is reducing. Then you compare if enemy.variable=true and enemy.AP=0 then run the random pick again.

  • To select the random enemy use system pick a random instance of enemy. Use a variable on the enemy to enable when it's selected and the AP is reducing. Then you compare if enemy.variable=true and enemy.AP=0 then run the random pick again.

    that working, thanks

  • To select the random enemy use system pick a random instance of enemy. Use a variable on the enemy to enable when it's selected and the AP is reducing. Then you compare if enemy.variable=true and enemy.AP=0 then run the random pick again.

    I have last question, how can i check, all enemies have no AP left?

    to make Player turn events should check there are no Action Points for Enemies left ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you do a condition enemy.AP=0, you can set a global variable to enemy.pickedcount. This value will be the number of enemies with AP=0. You will need to add an Else and the Else is run when it can't find any i.e. what you wanted when there are no enemies with AP, it will run on the Else.

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