Log In  

EDIT_2
lol nevermind I figured it out. I'm so happy about this

EDIT!

so I finally came back to this and got some of the fixes implemented, but now every time my character collides with a surface they teleport back to the top of the screen. Can someone point out what I'm doing wrong?

Thanks again

Cart #cosmo_test-0 | 2023-09-07 | Code ▽ | Embed ▽ | No License


original post:

I'm stuck again, this time on why my movement isn't working correctly.

When I try to go left, all movement and physics stop. when I try to go right, I "jump" and then fall through the floor.
additionally, the jump "boost" only works when also moving right

i'm following along with the NerdyTeachers YouTube tutorial, but I've rewatched the vids I think would make sense for these issues at least 3x each and I'm still stuck

P#87366 2021-02-08 00:42 ( Edited 2023-09-07 22:28)

1

I think possibly a lot of the issues are caused by if statements not ended when they need to be.

For example, the if btn(->) not being closed, so the btn(O) code is inside the if for the btn(->) code. That explains why the boost only works when you're moving right, because it's inside that right button if statement. I think the "jump" you do when moving right is also related to some of the dy checks you're doing in this block which are probably meant to happen after the right button check ends.

Same goes for why you can't move left - you are only updating plr.x inside of the elseif plr.dx>0, so when moving left, the position never gets updated.

You just need to add an end for those two blocks and you'll be back on track!

P#87945 2021-02-20 19:41

finally came back to this

and I implemented 2bitchuck's suggestions, but I've ran into a new issue

See edit in original post

P#134035 2023-09-07 20:01

[Please log in to post a comment]