Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » My hitboxes aren't functional.
- zablonb2424
-
Scratcher
93 posts
My hitboxes aren't functional.
So I was developing my game, but then I found something while messing ariund with the player in the editor. If you stop the project, then put it up in the air, and then start it up again, a hitbox error occurs. Could anyone help to try fix this? Here is the link: build around, mess around (test) on Scratch
- PlatoHero_
-
Scratcher
500+ posts
My hitboxes aren't functional.
Hi. The link doesn't work, because the project isn't shared. Please share it in your main or an alt account for people to be able to help you.
- zablonb2424
-
Scratcher
93 posts
My hitboxes aren't functional.
Hi. The link doesn't work, because the project isn't shared. Please share it in your main or an alt account for people to be able to help you.Sorry, I'll share right now.
- hi_bobux725
-
Scratcher
100+ posts
My hitboxes aren't functional.
why not just put a wait block so when you hold the player the velo wont go to like 152,378 per secondHi. The link doesn't work, because the project isn't shared. Please share it in your main or an alt account for people to be able to help you.Sorry, I'll share right now.
- PlatoHero_
-
Scratcher
500+ posts
My hitboxes aren't functional.
So I was developing my game, but then I found something while messing ariund with the player in the editor. If you stop the project, then put it up in the air, and then start it up again, a hitbox error occurs. Could anyone help to try fix this? Here is the link: build around, mess around (test) on ScratchI don't really notice any hitbox errors. What behaviour are you you seeing?
- Mig08Gamer1
-
Scratcher
10 posts
My hitboxes aren't functional.
To improve your hitbox, follow these steps.
Step One!
Firstly, in the hitbox sprite, put this code (if you don't make i't)when green flag clicked
go to x: (0) y: (0)
switch costume to [your hitbox costume name v]
set [X speed v] to [0]
set [Y speed v] to [0]
show
forever
if <<key [a v] pressed?> or <key [left arrow v] pressed?>> then
change [X speed v] by (-1)
end
if <<key [d v] pressed?> or <key [right arrow v] pressed?>> then
change [X speed v] by (1)
end
if <<key [w v] pressed?> or <key [up arrow v] pressed?>> then
set [Y speed v] to (8)
end
end
Step Two!
Add Colision To The Scriptwhen green flag clicked
go to x: (0) y: (0)
switch costume to [your hitbox costume name v]
set [X speed v] to [0]
set [Y speed v] to [0]
show
forever
if <<key [a v] pressed?> or <key [left arrow v] pressed?>> then
change [X speed v] by (-1)
end
if <<key [d v] pressed?> or <key [right arrow v] pressed?>> then
change [X speed v] by (1)
end
if <<<key [w v] pressed?> or <key [up arrow v] pressed?>> and <touching (ground v)?>> then
set [Y speed v] to (8)
end
end
Step Three!
Check if it is working, and, DON'T forget to add the player and ground sprites
- Matthobro120
-
Scratcher
69 posts
My hitboxes aren't functional.
Ah, the problem is that the un-collision isn't instant and the sprite constantly moves, a good fix is making another costume with a rectangle, this rectangle will serve as the hitbox(be sure to align it to the regular costume):
forever
...
Collision Check::custom
end
define Collision CheckBe sure to check “run without screen refresh” for Collision Check
switch costume to [hitbox v]
repeat until <not<touching [Ground v] ?>>
change y by (1)
end
switch costume to [Regular Costume v]
Last edited by Matthobro120 (Sept. 23, 2025 18:04:06)
- Discussion Forums
- » Help with Scripts
-
» My hitboxes aren't functional.