Discuss Scratch

Uusratcher
Scratcher
14 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.

when gf clicked
forever
switch costume to (hitbox v)
movement :: custom
switch costume to (player v)
end

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


hello
this is my signature, it pops up under every post i make :)


Masterscratch1117
Scratcher
100+ 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.

Like dungeons and challenges? Take a look at The Techno Dungeon! beat as many floors as you can before you run out of health!
Look at me, DO NOT NECROPOST ON THESE:

Only link a tutorial on hws if it exactly matches their problem. This is a good example of one to suggest a tutorial to:
https://scratch.mit.edu/discuss/topic/761109/

This is a bad one:
https://scratch.mit.edu/discuss/topic/761126/

100th post! https://scratch.mit.edu/discuss/topic/734419/
Generation XI (11): the first time you see this copy and paste it on top of your sig in the scratch forums and increase generation by 1. Social experiment.
TheUltimateHoodie
Scratcher
1000+ posts

How do you add hit boxes.

when green flag clicked
forever
if <touching [thing you wanna collide with v] ?> then
go to x: (x) y: (y)


else
set [x v] to (x position)
set [y v] to (y position)
end
end

can somebody give me something to put in my signature
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:

when gf clicked
hide
forever
go to [player v]
end

Scratcher since 2020

forumer, scratcher, programmer
highlight+ctrl+shift+down to see the rest of my siggy

Trek to 1000 Posts:
408/1000 posts | 40.8% | 162 days on scratch | at this rate, it will take me 237 more days to reach 1000.

however, I've recently been a lot more active on the forums, and I estimate that I'll get to 1000 in two weeks ;)


I'm active on:
  • Help with Scripts
  • Questions about Scratch
  • Suggestions

I make cool, polished projects :D


250th post (Show & Tell):
https://scratch.mit.edu/discuss/posts/7823802

100th post (Project Save & Level Codes):
https://scratch.mit.edu/discuss/posts/7761802

Fiftieth post (Help with Scripts):
https://scratch.mit.edu/discuss/post/7754776

Twenty-fifth post (Help with Scripts):
https://scratch.mit.edu/discuss/7752757

First post (Project Save & Level Codes):
https://scratch.mit.edu/discuss/post/7535938/


Help with Scripts Februrary 26, 2024:


I posted 100+ times today - I don't think I ever want to do that again.

End of siggy.
Uusratcher
Scratcher
14 posts

How do you add hit boxes.

Ok
Jupitorspaceman
Scratcher
19 posts

How do you add hit boxes.

I just do
when green flag clicked
forever
repeat until <touching ground>
change y by (-10)
end
end
PotatoManthetrue
Scratcher
19 posts

How do you add hit boxes.

Just do this

when green flag clicked
forever
switch costume to [ Hitbox]
move (doesn't have to be the move, im just using this to show movemnet) steps
if <touching [ level ] then
move (-whatever) steps
end
switch costume to [ Player]
end


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)


I AM POTATOMAN, THE TRUE POTATOMAN! POTATOMANTHETRUE!!!!!!!!!!!!!

<[potatos] = [good]>
pythonicKI
Scratcher
100+ posts

How do you add hit boxes.

@potatomanthetrue's script, but better

when green flag clicked
forever
switch costume to [Hitbox v]
move (doesn't have to be the move, im just using this to show movemnet) steps
if <touching [level v]> then
move (-whatever) steps
end
switch costume to [Player v]
end

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


Scratcher since 2020

forumer, scratcher, programmer
highlight+ctrl+shift+down to see the rest of my siggy

Trek to 1000 Posts:
408/1000 posts | 40.8% | 162 days on scratch | at this rate, it will take me 237 more days to reach 1000.

however, I've recently been a lot more active on the forums, and I estimate that I'll get to 1000 in two weeks ;)


I'm active on:
  • Help with Scripts
  • Questions about Scratch
  • Suggestions

I make cool, polished projects :D


250th post (Show & Tell):
https://scratch.mit.edu/discuss/posts/7823802

100th post (Project Save & Level Codes):
https://scratch.mit.edu/discuss/posts/7761802

Fiftieth post (Help with Scripts):
https://scratch.mit.edu/discuss/post/7754776

Twenty-fifth post (Help with Scripts):
https://scratch.mit.edu/discuss/7752757

First post (Project Save & Level Codes):
https://scratch.mit.edu/discuss/post/7535938/


Help with Scripts Februrary 26, 2024:


I posted 100+ times today - I don't think I ever want to do that again.

End of siggy.
TheUltimateHoodie
Scratcher
1000+ posts

How do you add hit boxes.

TheUltimateHoodie wrote:

when green flag clicked
forever
if <touching [thing you wanna collide with v] ?> then
go to x: (x) y: (y)


else
set [x v] to (x position)
set [y v] to (y position)
end
end
i think this is the easiest

can somebody give me something to put in my signature
pythonicKI
Scratcher
100+ posts

How do you add hit boxes.

TheUltimateHoodie wrote:

(#10)

TheUltimateHoodie wrote:

when green flag clicked
forever
if <touching [thing you wanna collide with v] ?> then
go to x: (x) y: (y)


else
set [x v] to (x position)
set [y v] to (y position)
end
end
i think this is the easiest
the question was about hitboxes… i don't see hitboxes here?

Scratcher since 2020

forumer, scratcher, programmer
highlight+ctrl+shift+down to see the rest of my siggy

Trek to 1000 Posts:
408/1000 posts | 40.8% | 162 days on scratch | at this rate, it will take me 237 more days to reach 1000.

however, I've recently been a lot more active on the forums, and I estimate that I'll get to 1000 in two weeks ;)


I'm active on:
  • Help with Scripts
  • Questions about Scratch
  • Suggestions

I make cool, polished projects :D


250th post (Show & Tell):
https://scratch.mit.edu/discuss/posts/7823802

100th post (Project Save & Level Codes):
https://scratch.mit.edu/discuss/posts/7761802

Fiftieth post (Help with Scripts):
https://scratch.mit.edu/discuss/post/7754776

Twenty-fifth post (Help with Scripts):
https://scratch.mit.edu/discuss/7752757

First post (Project Save & Level Codes):
https://scratch.mit.edu/discuss/post/7535938/


Help with Scripts Februrary 26, 2024:


I posted 100+ times today - I don't think I ever want to do that again.

End of siggy.
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

(Highlight + Shift + Down To See The Rest Of My Signature!)
Hi! I'm Cosmic-


Stuf
| Scratch Wiki | Empty My Stuff? Click Here! | Ocular | The SCM! | Project Nexus | More On The MyStuff Bug | Advanced Topics |



chaos



e
*digital art noises*
*forum noises*
TheUltimateHoodie
Scratcher
1000+ posts

How do you add hit boxes.

pythonicKI wrote:

TheUltimateHoodie wrote:

(#10)

TheUltimateHoodie wrote:

when green flag clicked
forever
if <touching [thing you wanna collide with v] ?> then
go to x: (x) y: (y)


else
set [x v] to (x position)
set [y v] to (y position)
end
end
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

can somebody give me something to put in my signature
pythonicKI
Scratcher
100+ posts

How do you add hit boxes.

TheUltimateHoodie wrote:

(#13)

pythonicKI wrote:

TheUltimateHoodie wrote:

(#10)

TheUltimateHoodie wrote:

when green flag clicked
forever
if <touching [thing you wanna collide with v] ?> then
go to x: (x) y: (y)


else
set [x v] to (x position)
set [y v] to (y position)
end
end
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”

Scratcher since 2020

forumer, scratcher, programmer
highlight+ctrl+shift+down to see the rest of my siggy

Trek to 1000 Posts:
408/1000 posts | 40.8% | 162 days on scratch | at this rate, it will take me 237 more days to reach 1000.

however, I've recently been a lot more active on the forums, and I estimate that I'll get to 1000 in two weeks ;)


I'm active on:
  • Help with Scripts
  • Questions about Scratch
  • Suggestions

I make cool, polished projects :D


250th post (Show & Tell):
https://scratch.mit.edu/discuss/posts/7823802

100th post (Project Save & Level Codes):
https://scratch.mit.edu/discuss/posts/7761802

Fiftieth post (Help with Scripts):
https://scratch.mit.edu/discuss/post/7754776

Twenty-fifth post (Help with Scripts):
https://scratch.mit.edu/discuss/7752757

First post (Project Save & Level Codes):
https://scratch.mit.edu/discuss/post/7535938/


Help with Scripts Februrary 26, 2024:


I posted 100+ times today - I don't think I ever want to do that again.

End of siggy.
TheUltimateHoodie
Scratcher
1000+ posts

How do you add hit boxes.

pythonicKI wrote:

TheUltimateHoodie wrote:

(#13)

pythonicKI wrote:

TheUltimateHoodie wrote:

(#10)

TheUltimateHoodie wrote:

when green flag clicked
forever
if <touching [thing you wanna collide with v] ?> then
go to x: (x) y: (y)


else
set [x v] to (x position)
set [y v] to (y position)
end
end
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

can somebody give me something to put in my signature

Powered by DjangoBB