now my Gunnar can crouch and duck. If he does, his HitPointBox will change to a new animation (with a smaller Hitbox in height, so he can crouch under Blocks.
So far, so good.
But if he is not anymore in collision with a block, he will stand up - thats fine! But if he crouches ON TOP of a block, he is still in collision with the block so he cannot stand up. Weird.
So i thought:
IF Player is in Collision with the block
IF PlayerHitPoint.PointX("Head);PlayerHitPoint.PointY("Head) is in collision the block.
I did this to check if the Player stands on top of a Trampoline to jump higher and it worked.
But if i change to: “PlayerHitBox.PointX(“Kopf”);PlayerHitBox.PointY(“Kopf”)” (so that’s the way i named it) the player stays crouched forever - if there is a block or not.
The only thing i Changed ist the
If Gunnar is in collision with a platform
If PlayerHitBox.PointX(“Kopf”);PlayerHitBox.PointY(“Kopf”) is in collision with a platform.
Ah, good. I just wanted to know the exact event.
While I’m recreating the system, could you check some things?
Could you have a text object show the values of ducken and kriechen to see if they’re both 0 when you exit the crawling part.
If so, check if there’s something that resets the animations to normal if the player’s not ducking or crawling.
EDIT: This is tough…
Try putting the event that says
“NOT if down key pressed and NOT if gunnar’s head in collision with platform: Ducken and Kriechen and gunnar animation = 0”
at the very end…
OKOKOK, now i get a step closer! think so. perhaps not. perhaps i´m stupid.
Short walk to another thing - my teleporter. Think of it as the green tubes from mario to get to the secret worlds under the ground.
First i had:
If PlayerHitbox is in collision with Teleporter and presses down: teleport him.
It worked but it also worked when the player stands near the Teleporter.
So i added a Point “PlayerCheck” above the Object “Teleporter”.
As you can see in the “code”, now he checks both. Now the Teleporter only works, when the Player is on top of the Teleporter. Fine.
But - and now i´m getting confused:
It says in the red box:
Is PlayerhitBox in collision
is down Button pressed
is PointXandY in Playerhitbox.
Thats the way it works very fine!
now in my understanding, if i change the change the conditions 1,2,3,4 to per example 2,1,3,4 or 3,1,2,4 or what combination ever, it should work the exact same way. But it doesn´t.
Also, in my understanding, i don´t need the “If PlayerHitBox is in collision with Teleporter” while i have the “If Teleporter.PointX(“PlayerCheck”);Teleporter.PointY(“PlayerCheck”) is in PlayerHitbox” - right?
But it won´t work. Only in this way 1,2,3,4 it works. Makes no sense for me. But ok, i´m still new to all of this.
Phoo. At this point, I’d say the best course of action would be to strip down everything to its bare components and try to start from scratch. Simple is best.
The point collision thing gave me some trouble. I don’t know exactly why. So, I just used the same variable I used for the text. Worked like a charm!
Hm. Those actions are very weird. And usually, the condition layout doesn’t matter. But, I think I may understand…
The “is down Button pressed” can be put anywhere from 1-3. It does not have an effect, it seems.
The “Trigger once” I have recently posted on the forum about. It actually matters whether it is at top or at bottom. It seems to be the best practice that you should just put it at the bottom, always.
Here is Arthuro’s explanation.
So it seems that conditions 1 and 3 are the culprit!
I think what happens is, if you do the PointXpointY one first, it does not know for which teleporter to check. I’m guessing it checks just the first one you made.
Meanwhile, if you use “PlayerHitBox in collision” first, then it will know which teleporter to check - the one that is in collision with the player.
This seems to be a common problem. If that’s the case, I hope the action gets rethought or documented in the wiki…
Thank you Gruk, but for my problem with the PointX and Y for crouching i thought it could be helpful. As i wrote, the Teleporter thing works fine, but it thought if i understand why the teleporter works this way, i could figure out why the crouching thing does not. both are made this PointX and Y thing. There was no new issue. I´m new at Gdev, but not new in forums. Anyway, i thank you for your thoughts and help. Sometimes the language is my problem to tell what i exactly mean. School is 25 years over. My german is better
So thank you very much Sciller, i think you found the point… first be in collision, so he knows which object is to be checked for the PointX and Y story. Cant wait to test it your way, but for now (it´s late here) i have to eat and sleep.
Tried to copy your way but the result is the same as before. The animations dont’t work, but i found the mistake. You set the “crouch” variable to 1, but the “duck” variable still was 1. So i changed it and now the animations work fine as before.
But now the exactly same issue as before:
When he stands up, he switches very fast from “collision” to “no Collision” and back forever.
I’ll come back to this tonight, as I am busy.
For now, though, I noticed that the part you put a question mark next to is in reverse order to my screenshot.
For whatever reason GDev does not like to play with the inverted “if point in object” condition. For now, make the events say:
[No condition]: Change the text of collision to “no collision”
if point in platform: Change the text of collision to “collision”