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.
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.
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.
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.
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.
Create a variable, "Y velocity", "yvelo", or whatever suits your needs.
In a forever block, change Y velocity by -1.
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.
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