Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Furwerkstudio on Sat 19/08/2017 23:21:57

Title: Target Combat coding
Post by: Furwerkstudio on Sat 19/08/2017 23:21:57
I've been on a combat system where an object would pop up, the player has to click on it within a time limit or else loose an inventory item, a stand-in for health.

I made up a mock code for a target, I was wondering if this will work. If you have tips to make this better I would be thankful.

Code (ags) Select

function {
SetTimer(1,200):
oObjectX.Visible = true;
oObjectX.Animate(1, 2, eOnce, eNoBlock); //shows how much time player has left
if (IsTimerExpired(1) == 1) {
oObjectX.Visible = False
Character.LoseInventory(InventoryItem ItemX);
}
}
Title: Re: Target Combat coding
Post by: Kara Jo Kalinowski on Sat 19/08/2017 23:57:47
You would execute this statement in repeatedly_execute or repeatedly_execute_always:

if (IsTimerExpired(1) == 1) {
oObjectX.Visible = False
Character.LoseInventory(InventoryItem ItemX);
}

Otherwise it seems logically sound to me.