playMaker

Author Topic: How to make an animation's end time determine another animation's start time?  (Read 2406 times)

Zeldag

  • Full Member
  • ***
  • Posts: 198
Hi all! My first post on these forums, although ive been lurking for a while.

First of all thank you all for the help I have found on these forum so far, it is been a great source of information.

Also playmaker is awesome, via a combination of these forums and youtube for info, playmaker has allowed me to figure out how to do everything I ever wanted so far...

The short version:

I have been trying to make one animation start time be dependant on another animation's finish time. So if an animation on my character was transitioned to another animation - an animation on my projectile would start from a certain time.

An example of what im trying to do is that if two animations are 5 seconds long, If animation A ends 2 seconds after starting- I need animation B to start 2 seconds from it's end.

After trying a few strange attempts at this I think I just got muddled up in all the logic lol. To be honest im not sure if it is even possible and what actions to use. Apart from timing the start and end somehow in the fsm itself, which I need to experiment more with.

But really I was hoping the animator could make this easier and maybe im just missing the right action.

Thank you all for reading, I hope it made some sense after all my rambling and I really hope someone can help.

Also let me apolagize in advance if this should be totally obvious, im still quite a noob. Ive literally only been learning game making for a few months and this is the first thing that has really stumped me, I think it may be because i just have no idea how to search for the answer and have tried many different searches.


The full story of the problem:

I am trying to make a 2d 'tentacle like' rope attack for a side-scrolling 2d game. I guess it could be compared to the mortal combat 'get over here move' but without the dragging over here of the enemy.

I would like my character to fire a rope/tentacle which extends from his hand. Upon reaching an enemy the tentacle would detach from the player's hand and appear to dissapear into the enemy.

The issue is I want the tentacle to be able to be fired,  detach and disappear into the enemy regardlesa of the distance the character is from the enemy.

A diagram:

Character = []  Enemy= ()  Tentacle= ----

[]----       ()   =character fires tentacle
[]--------  ()
[]----------()    =tentacle hits enemy
[]   -------()
[]       ---()     =tentacle disapears into enemy
[]           ()

The way ive been trying to do it is by having the character play an anim of the tentacle coming out. At the same time the character creates a moving invisable object, which i have timed to move perfectly with the animation (the object is parented to char upon creation).

When the object triggers an enemy it stops moving and plays the 'retracting tentacle' animation on where the object is.

When the object hits an enemy it sends event to char and stops the character from playing the 'extending tentacle' animation.

That all more or less works (i think i need to parent the object to the enemy it hits, but that is not the problem).

The problem is that I need to make the 'retracting tentacle' animation be dependant on  the length of the 'extending tentacle' animation.


Also ive considered using scaling to do it also, just havnt thought it through yet.
The main body of the tentacle can be scaled on the X axis without it affecting the way it looks (basic green tentacle), just has a pointy end- if that gives anyone an easy idea to do it with scaling...

Thank you all, especially if you have read this far, I appreciate any input. The great thing is that im such a noob that i bet there is plenty of ways to do what im doing and im just not seeing it.

(also just realised the way i described the attack- it sounds gruesome, in the game the tentacle does not disapear into the enemy's body, rather it binds the enemy lol. Also sorry for the super long post, just realising now...) :o

Zeldag

  • Full Member
  • ***
  • Posts: 198
Hi everyone, sorry to be bumping this, but I just wasted a day's worth of time trying to make this work.

Here is a youtube video of it nearly working (basically what i have so far):

Please guys, I know there are many geniuses here who could put together an attack like this in 5 minutes or so. I would really appreciate even the tiniest bit of input from one of you.

My eyes hurt and my head is starting to, but i just cant let this go lol. Right now it is working barely through a bunch of FSMs that are in a very non-elegant fashion... I better get back to it... Thank you all.

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
If you could state your question or issue in a shorter and more concise fashion that would help others try to answer the question.

From your first post- I can't really understand what you are trying to do.

Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

Zeldag

  • Full Member
  • ***
  • Posts: 198
Lol, i was afraid that was a problem, as I try to be clearer- I end up rambling. Thanks for trying to understand.

I just want a 2d side scroller binding/hook-shot/grappling hook weapon and was wondering if anyone might know how to elegantly make one with playmaker.

Ramble:

Right now ive tried various things from raycasts to adding velocity to an empty object and my latest attempt which I am liking so far is simply using animator to move the head of the grappling hook. My fsms are starting to be a real mess from experimenting...

But the biggest problem is that I want the line to break off from the player and retract into the enemy I hit. Smoothly regardless of the distance I hit the enemy from (right now i have 19 different retracting animations and I play a different one depending on thre distance the player was from the enemy upon trigger :/).


My attempts on video, should give an idea of what Im trying to achieve:


Close to working 1 (but not really, videonfrom above post):
The current state of things:


Just want my little vine shoot weapon to work smoothly... :(

Thanks again for looking and Sorry if I just rambled on again...
« Last Edit: February 03, 2016, 03:32:52 AM by Zeldag »

Zeldag

  • Full Member
  • ***
  • Posts: 198
Hi everyone.

Sorry to bump again

I pretty much nearly solved it (as much as it is possible with my skill level).

Would still appreciate any input on how to improve it.

Here is a video of what I have so far (my focus is the little green hook-shot weapon that drags stuff and binds enemies):


Ill post some screenshots and stuff later, of the setup but basically, what I have done is:

First I spawn a chaim, a handle and a head of the hook shot.

The chain Im spawning is a chain of vines links (game objects) (with a collider on each). They are made invisable in each one's start fsm.

A trigger with the head  makes them visable, then triggering again makes them invisable.

A trigger with the handle makes them destroy themselves.

So a slider joint is used between character and head, then the head spawns the links and destroys them if im retractong on player. If im retractibg on hook point or enemy the handle destroys the links.

Of course there is a whole lot of parenting and unparenting and all sorts of other stuff going on, that my head hurts even thinking about it right now. But above is the basics of it...

Its dodgey but works mostly...

Right now im super tired, this took me the best part of the week, to the extent that my household is seriously becoming concerned about me lol.

Thank you anyone for looking and helping.
« Last Edit: February 06, 2016, 02:32:37 AM by Zeldag »