Problem with collision and jumping

Hello!
This is my first time being here on the forum.
Uh, so there's something I don't know how to do.
The problem is that jumping is too fast, and looks weird, and unnatural.
I dunno how to make collision. I tried to add a hitbox, but I don't know where to start.
Help would be greatly appreciated.

Thanks!

Welcome to the Snap! forum!
The link you included appears to be to an empty project. Do you need help in creating a link?

Yes, thank you! I also have an issue with knowing how to exit the editor and save. I have no idea.

Never mind, I figured out how to make the link. Snap! Build Your Own Blocks (berkeley.edu)
Idk why, but you can't click on the link normally, you have to right click.

Are you sure? I get: “ 404 Error - This project does not exist or is private”.
Did you Share the project? You can achieve this through the Save as option from the IDE’s File menu.

Open/save dialog has a "Share" button. You need to share the project so we can see it.

Okay, now I pressed share. Now are you able to see it?

I still get the same error message. You need to use Open… to access Share; confirm you want the project shared; the project name will be in boldface. Sorry to have misinformed you at first.

I pressed share and publish. Now can you see it? I'm extremely confused. I pressed share before, and it didn't work. Hopefully this time it works.

It seems like it's working!

No, I meant that I need help adding the collision when touching the wall. You can go through walls, I need to add collision.

And I mean the link. THAT's the thing that's working.

Oh, ok.

You can experiment with Y velocity, which is how fast or slow an object goes when jumping, instead of going down at a constant rate. This overall creates a better result, visually and functionally.

Screen recording 2024-08-15 19.11.59

In the open / save as dialog, you have to click on the project you want to share then click the share button. When you share a project, the url bar will update to point to the project, which you can share. When you publish the project, people can find it on the snap website.

Wow, thanks! But how do I do it?

  1. Create a variable, "Y velocity", "yvelo", or whatever suits your needs.
  2. In a forever block, change Y velocity by -1.
  3. If the player is in a grounded state (touching the ground), set the Y velocity to 1, so that the player is on the ground, rather than in.
  4. Add a warp function that changes the player's Y by 1 if it's touching the ground. At the end of the loop, add a change Y by 1. This makes it so the character looks like it's touching the ground as normal!

Here's a summarized scratchblocks visualization.

when gf clicked
forever
change [Y velocity v] by (-1) //You can change -1 with your own gravity factor
change y by (Y velocity)
if (grounded state) then
set [Y velocity v] to (1)
warp {
repeat until \<not \<touching [ground v]\>\>
change y by (1)
end
change y by (-1)
}::grey
end
when [key v] key pressed
if (grounded state) then
set [Y velocity v] to (12) //You can change 12 with your own jump height
end

This will help, thanks!

Yep, sorry for the late reply, it didn't work. :grimacing:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.