Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » how to make hitboxes for clones.
- miaelizabethsantos
-
Scratcher
43 posts
how to make hitboxes for clones.
I`m making this zombie infection game which is now gonna use hitboxes. i did manage to make the system, but the clones keep going through the walls through some sort of glitch. does someone know who can fix this?
- KaaBEL_sk
-
Scratcher
100+ posts
how to make hitboxes for clones.
Is it this yours one: https://scratch.mit.edu/projects/703706995/ so we can check what is causing it?
- miaelizabethsantos
-
Scratcher
43 posts
how to make hitboxes for clones.
yes
define
switch costume to [ hitbox]
if <<touching [ sprite 2] ?>> then
move ( -2) steps
end
Last edited by miaelizabethsantos (June 25, 2022 11:55:02)
- KaaBEL_sk
-
Scratcher
100+ posts
how to make hitboxes for clones.
Found it! The enemy movement function needs to be used everytime right after it takes a step and not be in the animation loop:
...
if <(Walk 2) = (1)> then
move (1) steps
enemy movement
end
...
define enemy movement
...
- miaelizabethsantos
-
Scratcher
43 posts
how to make hitboxes for clones.
its still not showing the animation loop tho. plus, it sometimes goes straight through the walls.
- KaaBEL_sk
-
Scratcher
100+ posts
how to make hitboxes for clones.
its still not showing the animation loop tho. plus, it sometimes goes straight through the walls.I didn't make it very clear, the script is a bit long, but it the enemy movement function needs to be removed from there:
Define (enemy movementsteps :: stack #e35) :: hat #e57
switch costume to [hitbox v]
if <touching [Sprite 2nv] ?> then
move (-2) steps
end
when I start as a clone
hide
forever
enemy movement :: #e35 // needs to be removed
switch costume to [costume 10 v]
wait (0.05) secs
enemy movement :: #e35 // needs to be removed
switch costume to [costume 5 v]
wait (0.05) secs
enemy movement :: #e35 // needs to be removed
switch costume to [costume 6 v]
wait (0.05) secs
enemy movement :: #e35 // needs to be removed
switch costume to [costume 7 v]
wait (0.05) secs
enemy movement :: #e35 // needs to be removed
switch costume to [costume 8v]
wait (0.05) secs
end
Last edited by KaaBEL_sk (June 25, 2022 16:21:45)
- miaelizabethsantos
-
Scratcher
43 posts
how to make hitboxes for clones.
well i tried it but, when theyanimate, they flas from the hitbox to the animation loop
- KaaBEL_sk
-
Scratcher
100+ posts
how to make hitboxes for clones.
well i tried it but, when theyanimate, they flas from the hitbox to the animation loopI see. When I tested it I was only in civilian sprite and now I found also first one being zombie sprite.
They are flashing because the hitbox costume didn't set back to normal, which can be done just editing my block in both sprites:
enemy movement (costume [name v] :: looks) :: #e35
Define (enemy movement (costume :: #e57) :: stack #e35) :: hat #e57
switch costume to [hitbox v]
if <touching [Sprite2 v]> then
move (-2) steps
end
switch costume to (costume :: #e57)
- miaelizabethsantos
-
Scratcher
43 posts
how to make hitboxes for clones.
the hitbox worked. they just sometimes clip through the wall now. thx by the way.
- KaaBEL_sk
-
Scratcher
100+ posts
how to make hitboxes for clones.
the hitbox worked. they just sometimes clip through the wall now. thx by the way.Aaah sorry I forgot to also memtion that it's important for the hitbox as costume to be centered horizontaly, because when they turn other side to go away thier hitbox will appear inside building and they will be stepping back, but into the building.
- monkey_BOI234
-
Scratcher
6 posts
how to make hitboxes for clones.
when I start as a clonethats how you break scratch
create clone of [ v]
delete this clone
- Discussion Forums
- » Help with Scripts
-
» how to make hitboxes for clones.


