Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Hitboxes...............................
- richgar04
-
17 posts
Hitboxes...............................
My hitbox wont stay on the ground no matter what!! It keeps falling into the void!
- Vaibhs11
-
1000+ posts
Hitboxes...............................
can you share and link the project?
- richgar04
-
17 posts
Hitboxes...............................
can you share and link the project?https://scratch.mit.edu/projects/599216611/
- Vaibhs11
-
1000+ posts
Hitboxes...............................
It's okay for me.
Well, if turbo is on, then it'll pass through the walls
Well, if turbo is on, then it'll pass through the walls
Last edited by Vaibhs11 (Nov. 28, 2021 02:53:54)
- richgar04
-
17 posts
Hitboxes...............................
It happens after the tutorial, It would go underneath the ground. It's okay for me.
Well, if turbo is on, then it'll pass through the walls
- Vaibhs11
-
1000+ posts
Hitboxes...............................
tutorial? If it is the first level, I can't pass the level.It happens after the tutorial, It would go underneath the ground. It's okay for me.
Well, if turbo is on, then it'll pass through the walls
- richgar04
-
17 posts
Hitboxes...............................
After the dialouge it will be the tutorial, You use space to shoot and arrows to movetutorial? If it is the first level, I can't pass the level.It happens after the tutorial, It would go underneath the ground. It's okay for me.
Well, if turbo is on, then it'll pass through the walls
- Vaibhs11
-
1000+ posts
Hitboxes...............................
I think the problem is, in the hitbox sprite, there is a huge waste of ifs and change y by 1's.After the dialouge it will be the tutorial, You use space to shoot and arrows to movetutorial? If it is the first level, I can't pass the level.It happens after the tutorial, It would go underneath the ground. It's okay for me.
Well, if turbo is on, then it'll pass through the walls
Replace that chunk with
- Thingied
-
1000+ posts
Hitboxes...............................
Each problem will be in their individual sections.
1. Collision Failing After Tutorial
Because the hitbox doesn't show after the second cutscene ends, the hitbox of the hitbox (lol) is removed because it's hidden. The fix is to move the show block to the moveable broadcast like this:

What this does is make it show whenever it is called, which is usually after a cutscene.
2. X Collision Problems
@Vaibhs11 pointed this out so I might as well address it here.
Because the variable that stores the x velocity (I'll say Xv for short) is changed after the sprite moves, it isn't accurate to how much it has actually moved after. You kind of solved it by increasing how much it goes back but it's not full proof. The least confusing fix is to just move the friction block up so that the change in position is accurate to the actual variable after moving.

This is optional but will make the code cleaner:

1. Collision Failing After Tutorial
Because the hitbox doesn't show after the second cutscene ends, the hitbox of the hitbox (lol) is removed because it's hidden. The fix is to move the show block to the moveable broadcast like this:

What this does is make it show whenever it is called, which is usually after a cutscene.
2. X Collision Problems
@Vaibhs11 pointed this out so I might as well address it here.
Because the variable that stores the x velocity (I'll say Xv for short) is changed after the sprite moves, it isn't accurate to how much it has actually moved after. You kind of solved it by increasing how much it goes back but it's not full proof. The least confusing fix is to just move the friction block up so that the change in position is accurate to the actual variable after moving.

This is optional but will make the code cleaner:

Last edited by Thingied (Nov. 28, 2021 03:19:50)
- Discussion Forums
- » Help with Scripts
-
» Hitboxes...............................