Hello.
I'm wondering if anyone knows how to make a character sit on a swinging platform? Moving platforms I can handle but swinging is a whole other kettle of fish. Can it be done without the platform swing object (no flash extension)? I've read that you need to test the distance it's moved while on it and adjust it all in real time- I've had no luck, doesn't help that my coding skill are awful.
Any ideas would be greatly appreciated.
I haven't actually tried it yet, but I came up with an idea using trig and the "Move-thing-moved-distance" technique. Check out Pixelthief's article on it:
Yes, I read the article by pixelthief- Can't quite figure out the 'set a value to the x pos of the bottom detector' BEFORE the swing moves then move the character the difference from AFTER it moves. In my game the swing is always moving- I don't understand the whole time frame working- makes me feel they the same way I feel when thinking about the terminator plot too much
Doesn't seem to be working for me.
The goal of that technique is to find how much the platform moves each frame by X & Y. So if its on X=100 on one frame, and X=107 on the next, its moved +7 pixels in X. Then the player, who is standing on it somehow, must be moved 7 pixels. So if you record the old position of the platform before moving, and the new position after moving, you can subtract to find the difference, and add this difference to the player's position.
Thanks pixelthief. I've tried this using counters so I can see what's happening. The difference flashes between 1 and 6 pixels- when this is applied to the character's position, he still slides about on the platform... Maybe this measurement is not fast enough? I'm using an in-built path movement for the platform- not sure if this matters... Have you got this approach to work?