-
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.
-
AyreGuitar, thanks for that link!
I'm going to study this so that I'm not constantly shocked about how MMF 2 carries out my instructions; forcing me to create inefficient workarounds. Clickteam really needs to address these "secret procedures" in their product since they are not intuitive to most. It would be a tough undertaking, but I believe that a lot of user frustration stems from these hidden procedures, or a lack of understanding regarding them.
-
My problem seems to be that I am unable to specify IN THE EVENT which object I am referring to. So if I have duplicates 1 2 3 and 4 of the same swing object, even when I use a condition like "player collides with swing object + swing object is overlapping <zone 1 object> + player is overlapping <zone 1 object>" (which should specify that I am only checking for swing objects in that zone), my event is still "set position to (trig functions of swing object)," and the EVENT is still positioning my player at the most recently created swing object, NOT the one specified in the CONDITION. Additionally, it is my player, not the swing objects themselves, that affected by this condition, so I don't know how to specify which swing my PLAYER should snap to.
-
FinalSpecimen - sounds like you need to do a Fastloop or ForEach for each rope object and test that your character is overlapping a specific rope by using a spread value (for Fastloop) or that the the rope's unique ID=ForEach loop index (for ForEach).
Fastloop:
Always: Spread Alt Val A of ("rope") with 0
Always: Start Fastloop "i" for number of ("rope") objects
On Fastloop "i"
+"MySprite" is overlapping "rope"
+Alt Val A ("rope") = index(Fastloop "i"): Set position of MySprite
This is from memory as I'm not near MMF2 to check. But something along those lines should work for you.