hi to all …
i want to make almost a QTE event for my game.
but i don’t know what i should to do.
for example i think you have play last tomb rider.
in first level when she want to get her bow … she try and pull her hands to get bow if we tap E.
how i can do this ?
it means play a animation by tap E and stop this (or change animation in idle) when untap E !
i don’t know how we can detect repeatedly press a key with no repeatedly !
please hellp me.
I haven’t done anything with QTE so not sure on the best practices but a simple way with lots of control would be to keep a count of how many times a key was pressed and a timer. Example below is a QTE that must be completed within X amount of time
E.G.
Variables -
int iCount = 0;
int iTargetCount = 10;
float fTimer = 5f;
In Update
- If an QTE is Active!
– Get Input from keyboard using (Input.GetKeyUp(KeyCode.E))
– If “E” Pressed… increase iCount
– Then separately while QTE is Active decrease the timer using Time.deltaTime
–if(timer > 0.0f) We still have time left
– Percentage of animation/success is (100f/iTargetCount ) * iCount;
–else - user failed to complete QTE in time!
–Set animation/Percentage/Score etc… to percentage.
Its not a perfect system, you will need a overall manager which will decide when to start and stop QTE but a simple system like this should give you a starting point. If you wanted to have no time limit/failure scenario you could use a simple growth/decay system where you have a float variable which on detecting E Press you increase it (+=10 etc…) and then every update you decrease it by X * Time.deltaTime. Then all you need is a trigger check for when the action hits above a certain value.
thanx for you’r help my friend.
but i think its depend on Key and Animations.
every Tap a key play one frame of an animation until the animation will over.
if you untap key … the animation will go to first frame.
so you tap key until animate over …
i want to code these but i don’t know how …
mecanim is a good thing to make qte … but i don’t know how tell that when get key …
for example if at this time gamer pressed E … i don’t know how is it.