Discuss Scratch

inaciopro
Scratcher
6 posts

how i make a hitbox that is smaller than the sprite?

im coding a top down rpg project, tried griffpatch's tutorial but it didn't help. tried making a different sprite but it makes the game laggy. i also tried this but it didnt work also.

when green flag clicked
forever
switch costume to [ player]
switch costume to [ Phitbox]
end

any help?
cs3868895
Scratcher
1000+ posts

how i make a hitbox that is smaller than the sprite?

Going to put this in the help with scripts.
Your not in trouble
inaciopro
Scratcher
6 posts

how i make a hitbox that is smaller than the sprite?

cs3868895 wrote:

Going to put this in the help with scripts.
Your not in trouble
sorry for posting it in the wrong place
LittleGreyCells
Scratch Team
1000+ posts

how i make a hitbox that is smaller than the sprite?

Moved
MultiTasker801
Scratcher
100+ posts

how i make a hitbox that is smaller than the sprite?

using a different sprite that's smaller is the right move
consider using a custom block with “run without screen refresh” for this task
forever // your player's game loop
...::grey
check collisions::custom
if <(colliding) = [1]> then
code for collision::grey
end
...::grey
end

// define a custom block with run without screen refresh turned on
define check collisions
switch costume to [hitbox v]
if <touching [target v]?> then
set [colliding v] to [1]
else
set [colliding v] to [0] // there is a more compact way to do this, but it looks weird
end
switch costume to [player v]

Last edited by MultiTasker801 (Oct. 15, 2023 01:43:20)

Powered by DjangoBB