Discuss Scratch

PotterSkywalker3712
Scratcher
42 posts

Problem with platformer moving mechanism?

So, I have this code that I use for most of my platformers, and although it's not the best, it's been working just fine. I've only used it for about 2 other platformers, and in those other platformers, instead of falling to your death, you would have fallen into lava, or something of the sort. But now that I've tried with coding “If Y position > ” Whatever the y is, it just glitches me to the bottom of the screen. I can move around, but not jump. However, once I took out the block that I originally put in place, it doesn't fix the problem. I'm not sure if I'm just being dumb here, but I don't want to go and copy off of other people's projects. Can anyone help?
Thanks!

Edit: I've tried the ‘if sprite touched’ script. It still spawns me at the bottom of the screen. And yes, I do have a ground block. And yes, I did ‘When flag clicked go to X: ( ) Y: (0).’ Neither make a difference.

Last edited by PotterSkywalker3712 (Feb. 3, 2022 04:11:24)

Relic_Codes
Scratcher
100+ posts

Problem with platformer moving mechanism?

Could you share the project and give me a link?

when green flag clicked
forever
go to [follow button v]
if <mouse down?> then
broadcast ["Relic_Codes" Followed v]
PotterSkywalker3712
Scratcher
42 posts

Problem with platformer moving mechanism?

Yes, of course, I apologize about replying late -_-
https://scratch.mit.edu/projects/628789085/
ideapad-320
Scratcher
1000+ posts

Problem with platformer moving mechanism?

You have to share your projects so people dont have to use turbowarp.
The bug is you dont reset the X and Y vars at the beginning. The var y also does not decay on their own. Could not test X because the death loop was making it not leave 0.
Consider changing the vars X and Y to Xv and Yv to make your code cleaner.

This is my siggy.
Can't wait for FRC water game!
PotterSkywalker3712
Scratcher
42 posts

Problem with platformer moving mechanism?

Alright, thanks.

Powered by DjangoBB