Question Asynchronous Problem

EwiSkywalker

New member
Joined
Aug 28, 2019
Messages
1
Programming Experience
Beginner
I'm having trouble coding the logic for an RPG game that I'm making. Basically the way I'm working it is there are attack buttons, that when pushed run a bunch of code to execute the move. To create the turn order, I need to only allow the next character in the order go once the previous person has finished their attack(I'm using Unity btw). Basically I need to have the program wait until a method runs in another script, but that method cannot be called within the code; it has to be called by a button press by the player. I'm having trouble coming up with a way for this to work, so if you can help me that would be great. Thanks!
 

Skydiver

Well-known member
Joined
Apr 6, 2019
Messages
919
Location
Virginia Beach, VA
Programming Experience
10+
In your button press handler, you could put the requested actions in a queue and then have a timer which runs and pulls stuff out of the queue and executes them sequentially.
 
Top Bottom