I am putting together my character animation controls and I'm having the hardest time defining a waiting time that would stop fight actions from overriding each other, this is a test of the fight part of my input thus far, (with help from the forum search),with the timing code the animation never gets called, if I leave it out the (bolded part) the actions work, but only if u dont click very fast ,
both actions finish cycle in under two seconds
I need to have each fight move finish with a slight pause regardless of the the click rate, but cant figure out what I'm missing, any help would be appreciated
TIA
private int fightmove;
// time of last update
private float lastUpdate = 0;
private float kicktime;
private float punchtime;
anybody this is really driving me nuts, its seemingly simple, because I've already worked out a decent weapons fire delay that works well and with reload time too, but cant seem to apply the same principles to this situation some how any advice on what I could be missing would be appreciated
well, I dont know if this will help you, but I had sort of a similar situation.
I had a character who could jump (with spacebar) and each time it would add like 3 y vector physics force.
But, I could hit the spacebar as much as i wanted and i would fly away! lol
so how I solved this problem.
As an example (these arent the numbers I used, also this is psuedo code)
I made a float at, say = 100. Then I had an if statement in the update which said if float is < 100, add .25 to it. so, until this float was acted upon, it didnt really clog up the update.
so, when the character hit spacebar, an if statement was run to see if the float = 100, if it wasnt, nothing happened. if it was = 100, then it set the float = 0, and performed the action.
At least, that is the way I solved my problem, however, I dont know if it is the most efficient way, or if that is even the same sort of problem you are having.
I dont want to "kill" the action trigger that will make fight controls feel non-responsive.... no :?, I want to queue each call to kick or punch so that if I click the mouse 3 times no matter how fast, I should get "punch......kick.....punch" played sequentially in there entirety and not the "animation blended confusion" I get now, hope I'm clearer
this is how I set it up now but still no go :? :? :( it still only work when I control how fast I click
I also have an isStanding boolean that I have not used yet, I can listen for that as my end state variable, but the timing code may still be an issue, will test it, still though, ideas would be cool thanks
just got back to this your linkedList idea worked a bit after I reorganized my code some
the animations dont get smushed together anymore but click speed causes fightmoves to get missed some how, especially if more than 2 clicks are queued, see attached text file for console output, can u notice anything I might be doing wrong.
TIA
the move identifier
private LinkedList<Integer> fightQ = new LinkedList<Integer>();
private String moveName;
private int fightmove;
public void update(float tpf) {
super.update(tpf);
pHandler.useCursor("default");
input.update(tpf);
some moves fired dont get animated, but as despotes suggests it might be getting ignored by the updates, sounds plausible but is there a way to get arround this, and my framerate is controlled, I set the max at 85 but the fps count stays arround 57fps with this enabled
@tim8dev enums huh…more reading to do then, but what can be done …if anything to reduce commands getting lost :? despite what the console spits out every first fight animation (punch) gets ignored i.e if I press six times quickly I only get the kicks and a punch at the end it its last in the queue.
You'll definitely want to go with a queuing system, as was suggested. I have used this sort of thing to queue up special effects and Fire them off in succession or to test if any effects are still active before moving onto the next thing. For the "actions getting skipped" issue, have you confirmed this by message/log output or are you just not seeing them? If they are truly being skipped then obviously you will have to hunt down the bug or condition that causes it to not be fully processed.
You'll definitely want to go with a queuing system, as was suggested. I have used this sort of thing to queue up special effects and Fire them off in succession or to test if any effects are still active before moving onto the next thing. For the "actions getting skipped" issue, have you confirmed this by message/log output or are you just not seeing them? If they are truly being skipped then obviously you will have to hunt down the bug or condition that causes it to not be fully processed.
I dont suppose u have an example laying around you are willing to share, I am queuing the extremely simple trigger(see above) I know....I know.... not extensible but.................
Well… I could dig something up, but I'm not sure how useful it would be… seeing as my system was not real-time but turn-based and so I didn't have to contend with a user who might click/punch, click/kick, click/punch, click/kick, etc., all day long. However, my second thought about this, now that I've read into the code a bit more, is that the problem might be that there's a problem with removing the moves from the LinkedList while new moves are being added. Have you considered using a simple ArrayList and just using add(move) and remove(0) to handle the queue?
Btw, I wasn't able to make much sense of the log that you posted. Maybe a script telling what you did to view along with the log would be helpful and where the problem occured.
Well... I could dig something up, but I'm not sure how useful it would be... seeing as my system was not real-time but turn-based and so I didn't have to contend with a user who might click/punch, click/kick, click/punch, click/kick, etc., all day long. However, my second thought about this, now that I've read into the code a bit more, is that the problem might be that there's a problem with removing the moves from the LinkedList while new moves are being added. Have you considered using a simple ArrayList and just using add(move) and remove(0) to handle the queue?
Btw, I wasn't able to make much sense of the log that you posted. Maybe a script telling what you did to view along with the log would be helpful and where the problem occured.
thank for the idea will give that a run, as for the log sorry for the vagueness but the basic idea is, depending on the "timing" some animations don't happen, mostly the punches
clicking just fast enough for 1 to be queued and removed
move fired: punch
No. of moves queued: 1
punching <- animates
No. of moves Left: 0
o.k finally got it working, apparently I needed to add a couple more conditions…in case u are wondering the goal of all this was to have animation not to errr shallow each other when those damned button smashers get going, there will be max queue size thank for the help guy, bits and pieces of your advice got me there.
the Listener code now…doubt my shit code will be use to anybody, but ya nevva know
public void notify(Animator animator, int type, Object userObject)
{
if (type==IAnimationListener.ANIMATION_CYCLE_ENDED && (animator == player.getPunchAnimator() || animator == player.getKickAnimator()))
{
player.isPunching = false;
player.isKicking = false;
animator.fadeOut(0.1f, false);
if(fightQ.size()>0)
{
System.out.println("No. of moves queued: "+ fightQ.size());