Discuss Scratch

Uusratcher
Scratcher
21 posts

How do you add hit boxes.

HOWWWWWWWWWWWWW
coIIide
Scratcher
100+ posts

How do you add hit boxes.

Can you elaborate? If you mean for a platformer, just switch to a costume before doing all the code to move, then switch back.

whenclickedforeverswitchcostumetohitboxmovementswitchcostumetoplayer

Last edited by coIIide (Jan. 19, 2024 02:59:20)

Masterscratch1117
Scratcher
500+ posts

How do you add hit boxes.

Make sure to use a run without screen refresh custom block to prevent flickering between the costume and hitbox.
TheUltimateHoodie
Scratcher
1000+ posts

How do you add hit boxes.

whenclickedforeveriftouchingthing you wanna collide with?thengotox:xy:yelsesetxtoxpositionsetytoyposition
pythonicKI
Scratcher
100+ posts

How do you add hit boxes.

The most easy way for a beginner is probably to make a hitbox sprite, draw the hitbox, and put this code:

whenclickedhideforevergotoplayer
Uusratcher
Scratcher
21 posts

How do you add hit boxes.

Ok
Jupitorspaceman
Scratcher
19 posts

How do you add hit boxes.

I just do
whenclickedforeverrepeatuntiltouchinggroundchangeyby-10
PotatoManthetrue
Scratcher
34 posts

How do you add hit boxes.

Just do this

whenclickedforeverswitchcostumeto Hitboxmovedoesn'thavetobethemove,imjustusingthistoshowmovemnetstepsiftouching level thenmove-whateverstepsswitchcostumeto Player


There is probably an easier way, but this is what I could get off the top of my head. I also suggest converting this to a custom block instead when a “when green flag clicked.”

Last edited by PotatoManthetrue (Jan. 19, 2024 19:46:27)

pythonicKI
Scratcher
100+ posts

How do you add hit boxes.

@potatomanthetrue's script, but better

whenclickedforeverswitchcostumetoHitboxmovedoesn'thavetobethemove,imjustusingthistoshowmovemnetstepsiftouchinglevelthenmove-whateverstepsswitchcostumetoPlayer

Last edited by pythonicKI (Jan. 19, 2024 20:28:23)

TheUltimateHoodie
Scratcher
1000+ posts

How do you add hit boxes.

TheUltimateHoodie wrote:

whenclickedforeveriftouchingthing you wanna collide with?thengotox:xy:yelsesetxtoxpositionsetytoyposition
i think this is the easiest
pythonicKI
Scratcher
100+ posts

How do you add hit boxes.

TheUltimateHoodie wrote:

(#10)

TheUltimateHoodie wrote:

whenclickedforeveriftouchingthing you wanna collide with?thengotox:xy:yelsesetxtoxpositionsetytoyposition
i think this is the easiest
the question was about hitboxes… i don't see hitboxes here?
chippysmall4
Scratcher
1000+ posts

How do you add hit boxes.

This Is A Hitbox Based Engine: https://scratch.mit.edu/projects/948304375/
Check The Collision Custom Block For How To Make A Hitbox
TheUltimateHoodie
Scratcher
1000+ posts

How do you add hit boxes.

pythonicKI wrote:

TheUltimateHoodie wrote:

(#10)

TheUltimateHoodie wrote:

whenclickedforeveriftouchingthing you wanna collide with?thengotox:xy:yelsesetxtoxpositionsetytoyposition
i think this is the easiest
the question was about hitboxes… i don't see hitboxes here?
this script requires no extra work it functions at a hitbox very cool
pythonicKI
Scratcher
100+ posts

How do you add hit boxes.

TheUltimateHoodie wrote:

(#13)

pythonicKI wrote:

TheUltimateHoodie wrote:

(#10)

TheUltimateHoodie wrote:

whenclickedforeveriftouchingthing you wanna collide with?thengotox:xy:yelsesetxtoxpositionsetytoyposition
i think this is the easiest
the question was about hitboxes… i don't see hitboxes here?
this script requires no extra work it functions at a hitbox very cool
but there's no hitbox? or is this script supposed to be in the sprite of the hitbox or something?
what do you mean “it functions at a hitbox”
TheUltimateHoodie
Scratcher
1000+ posts

How do you add hit boxes.

pythonicKI wrote:

TheUltimateHoodie wrote:

(#13)

pythonicKI wrote:

TheUltimateHoodie wrote:

(#10)

TheUltimateHoodie wrote:

whenclickedforeveriftouchingthing you wanna collide with?thengotox:xy:yelsesetxtoxpositionsetytoyposition
i think this is the easiest
the question was about hitboxes… i don't see hitboxes here?
this script requires no extra work it functions at a hitbox very cool
but there's no hitbox? or is this script supposed to be in the sprite of the hitbox or something?
what do you mean “it functions at a hitbox”
just insert the script at the bottom of any script and it functions at a collision (hitbox) script

Powered by DjangoBB