|
Post by deadred on Aug 28, 2017 4:22:55 GMT
Hello. I am having a problem with my character dropping into (or jumping up into) gaps the same size as him. If there is a gap below him in the walkway 2 blocks wide (16 pixels) he just walks over it as if there are blocks there. The blocks are set to empty space. Any help with this would be gratefully received. I have added an image demonstrating the issue. Thank you.
|
|
|
Post by alessandro on Aug 29, 2017 9:47:44 GMT
I have noticed the same behavior since the times of AGD 2.x, but only when the character keeps walking left or right over a two spaces wide gap. It will only fall if it stops while exactly aligning with the gap. In this case the solution is to make the gap at least three spaces wide. However in the example you made the character falls into the gap:
|
|
|
Post by andrewvanbeck on Aug 29, 2017 13:49:11 GMT
Perhaps it would help to keep track of the previous state. Like - store a value for whether the player is touching the ground...
IF CANGODOWN LET G = 0 ELSE LET G = 1 ENDIF
Then, after you move the player left or right, immediately check to see if the player was on the ground but can now go down...
IF KEY 0 SPRITELEFT ENDIF IF KEY 1 SPRITERIGHT ENDIF IF G=1 IF CANGODOWN SPRITEDOWN ENDIF ENDIF
So, if G is 0 then the player is in the air, if its 1 then the player is on the ground - and if the player is on the ground, moves left or right, and then theres a gap that lets them fall down, they should start falling down and not be able to step over 2 character gaps anymore.
|
|
|
Post by alessandro on Aug 29, 2017 16:46:58 GMT
It is not necessary to use a global variable and a double IF CANGODOWN check (double IF...ENDIF checks in the same event script should be avoided anyway). Simply try: IF CANGODOWN FALL ELSE ENDIF
Tested and working as intended
|
|
|
Post by deadred on Aug 30, 2017 3:46:52 GMT
Hi guys, thank you for the responses and help. I was racking my brains last night and in the end I just dug in deep and found the solution. I had to move all the exit room, left, right, up and down code to the end after all my key controlled movement. I also placed my fall command after all the key control code but before the exit room code. Now its running perfectly and the water, lifts, ladders etc are working pretty great although they will need a bit of tweaking later on.
Thank you again.
.
|
|
|
Post by Jonathan Cauldwell on Sept 16, 2017 18:38:00 GMT
Also make sure you don't have an odd Y coordinate. This can happen when setting the new coordinate after moving left or right a screen. Make sure you set the Y coordinate to an even number.
|
|