Project update! (+ need code help).
Sorry for the delayed update, had some busy weeks and trying to keep this project away from "prying eyes" aka my partner has proven difficult haha
Here's what I've now got.
- The conveyor belt is now attached to Crank and works in both directions.
- The letterbox at the bottom will become the Goal of the level.
- Three letters are floating, they are placeholders for the 3 ask functions I will attach to the letterbox.
- Was trialling some visuals like the buttons and how they might function ON/OFF.
- Using a few of the platformer posts on these forums I've been able to get the player (envelope) to have gravity on an interval of 10 ticks until it hits a solid tile.
Now I need help with the letter moving left and right when on the conveyor belt and it detects the direction of the crank. (Please and thank you!)
I attempted to reuse code from this project/post which worked somewhat, but I removed the code as I'm not sure it is what I needed.
For example, originally the frameIndex for the conveyor belt was moving 1 frame per 15 or so degrees of the crank rotation. But it meant that the envelope and the conveyor belt were moving at two different speeds visually. I've since bumped the frameIndex to 2 frames per 15 degrees which slightly helped.
This is how I envision my player movement working;
- Check if the tile below the player is solid (or a conveyor belt).
- If crank rotation (ra) is greater than 15 move in that direction (to match belts).
- If crank rotation (ra) is greater than -15 move in the opposite direction.
- Stretch goal, the envelope moves at a believable pace relative to the conveyor belt anims.
Here's a quick mock-up of what I mean in case I'm not making much sense haha
- red squares and arrows to indicate player and direction.
- purple arrows, the player can't detect a solid (or belt) under it so the gravity ticks kick in.
- green == solid tile checks as example.
If required I could upload the project to this post to help come up with a solution.
I appreciate everyone's help with this!