-
Action Spot Simulation
I got platform engine and I made a rope for it - very dirty and not perfectly working - it always moves and I can stick my character to it via Action Spot (which is on far bottom). And everything works great but...
When my character collides with the rope in the middle and I attempt to catch it it teleports to Action Spot so is there any way to simulate action spot instead of providing few different animation frames, and try to on base of calculation take the one with the closest action spot to reduce the visual lag of teleportation?
-
I'm not sure if I follow...
When your player jumps on to the rope, you "stick" it to the rope using its hotspot. But, depending on where you player collides with the rope, there is a noticeable jump in the players position?
I'd have to see your code, but you need to work out the difference between the x,y position of your player and the x,y position of the rope at the time of collision, then add or subtract the difference in x and y position when you align your player with the rope.
However, this means your player won't always be positioned at the spot on the rope. This may or may not be a problem for you.
What I suggest is have an invisible detector always positioned at the middle of your player. Make this detector 1 pixel wide and as high as your player. Simply test when the detector collides with the rope, as opposed to your player. This way, your player "attaches" to the rope only then he/she is in the middle of it, thus no noticeable change in position.
If none of that makes sense, upload your mfa and I'll show you. :)
-
1 Attachment(s)
It makes sense but I'm using action spot and rope is always in movement. I will try my quirky solution and upload MFA with it.
OK my idea seems to be working just fine:
http://tm2fk.pl/line_expanded.html
-
1 Attachment(s)
Your swinging rope code is insane and I'm not quiet sure what those two actives are for, so I've just made an example from scratch.
Using Pythagoras you can work out at exactly what point on the rope your player collided with it, and then using Cos and Sin you can swing your player on the rope.
-
Other actives where for different tests, but your solution seems to be much nicer - thanks.
-
@ ChrisBurrows - I am trying out your example for a swing of my own, but the only thing I can't seem to customize is my player's position on the rope - I have an animation with his arm holding on to the rope, so there is very little margin for error to make this look right. Is there a way to have the player 'snap' to the same point each time he collides with the rope?
-
Sorry to bump this - I have figured out my previous question, but when I duplicate the rope object and put 4-5 rope objects in the frame, I have a problem.
When my player collides with a rope, he doesn't latch onto that particular rope but rather seems to be teleporting to the last rope created in the frame editor. Usually when I am working with duplicated objects, I can write a condition that affects only one object at a time, but I can't seem to find a way around this one. Any thoughts?
-
FinalSpecimen: That's strange. Would cloning the ropes and adding all the ropes to a group help?
-
That seemed like a good idea Jester, but still having the same problem.
-
FinalSpecimen - May I suggest you read these articles by Chris Burrows on Object Pairing and Object Scope?
http://www.diybandits.com.au/MMF/articles.html
They should help you understand how MMF2 works with duplicates of the same object.