Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Need help with making hitboxes and hurtboxes. :|
- United_Snakes53
-
Scratcher
6 posts
Need help with making hitboxes and hurtboxes. :|
Hello. I am making a game that has a Robot Sprite, also known as a Vulture Droid, that is blasting a continuous laser beam. on the ground in front of it. I want to make a hitbox for only the tip of the laser, but not the middle of the beam. Is there any possible way to do this?
http://imgur.com/a/L8raQ
Also, I want to make a hurtbox specific for this sprite. I want to place a hurtbox on the head that causes double the amount of damage. is this also possible? And if so, how?
http://imgur.com/a/ltTzW
http://imgur.com/a/L8raQ
Also, I want to make a hurtbox specific for this sprite. I want to place a hurtbox on the head that causes double the amount of damage. is this also possible? And if so, how?
http://imgur.com/a/ltTzW
Last edited by United_Snakes53 (Aug. 30, 2016 01:23:08)
- asivi
-
Scratcher
1000+ posts
Need help with making hitboxes and hurtboxes. :|
Hello. I am making a game that has a Robot Sprite, also known as a Vulture Droid, that is blasting a continuous laser beam. on the ground in front of it. I want to make a hitbox for only the tip of the laser, but not the middle of the beam. Is there any possible way to do this?
http://imgur.com/a/L8raQ
Also, I want to make a hurtbox specific for this sprite. I want to place a hurtbox on the head that causes double the amount of damage. is this also possible? And if so, how?
http://imgur.com/a/ltTzW
Better if you share your project instead of showing us scripts' pictures.
- asivi
-
Scratcher
1000+ posts
Need help with making hitboxes and hurtboxes. :|
BTW, Scratch has banned the IMGUR site.Hello. I am making a game that has a Robot Sprite, also known as a Vulture Droid, that is blasting a continuous laser beam. on the ground in front of it. I want to make a hitbox for only the tip of the laser, but not the middle of the beam. Is there any possible way to do this?
http://imgur.com/a/L8raQ
Also, I want to make a hurtbox specific for this sprite. I want to place a hurtbox on the head that causes double the amount of damage. is this also possible? And if so, how?
http://imgur.com/a/ltTzW
Better if you share your project instead of showing us scripts' pictures.
- gtoal
-
Scratcher
1000+ posts
Need help with making hitboxes and hurtboxes. :|
An easy trick. Create a second sprite for any sprite that you want to shoot.
Draw an outline on that sprite that corresponds to where you want to detect hits. This is a hitbox sprite. The line where hits can be detected doesn't have to match the original visible sprite. For instance it might only detect hits at the top of the sprite but not the sides.
Create a loop where the hitbox sprite moves to the same coords as the target sprite.
Have the hitbox sprite detect the hit, and broadcast when it does.
The original more detailed version of the sprite doesn't care about hits, but it does act on the broadcast when the hitbox detects the hit.
You may need to set the visibility of the hitbox to 1% so that it is present but not visible. (I'm not 100% sure if this is necessary - test for yourself if an object can receive “is touching” tests when it is hidden…)
Draw an outline on that sprite that corresponds to where you want to detect hits. This is a hitbox sprite. The line where hits can be detected doesn't have to match the original visible sprite. For instance it might only detect hits at the top of the sprite but not the sides.
Create a loop where the hitbox sprite moves to the same coords as the target sprite.
Have the hitbox sprite detect the hit, and broadcast when it does.
The original more detailed version of the sprite doesn't care about hits, but it does act on the broadcast when the hitbox detects the hit.
You may need to set the visibility of the hitbox to 1% so that it is present but not visible. (I'm not 100% sure if this is necessary - test for yourself if an object can receive “is touching” tests when it is hidden…)
- United_Snakes53
-
Scratcher
6 posts
Need help with making hitboxes and hurtboxes. :|
An easy trick. Create a second sprite for any sprite that you want to shoot.Thank you so much!!
Draw an outline on that sprite that corresponds to where you want to detect hits. This is a hitbox sprite. The line where hits can be detected doesn't have to match the original visible sprite. For instance it might only detect hits at the top of the sprite but not the sides.
Create a loop where the hitbox sprite moves to the same coords as the target sprite.
Have the hitbox sprite detect the hit, and broadcast when it does.
The original more detailed version of the sprite doesn't care about hits, but it does act on the broadcast when the hitbox detects the hit.
You may need to set the visibility of the hitbox to 1% so that it is present but not visible. (I'm not 100% sure if this is necessary - test for yourself if an object can receive “is touching” tests when it is hidden…)
This helped me alot!- Nightybear
-
Scratcher
1 post
Need help with making hitboxes and hurtboxes. :|
can you help me out i cant get this to work im making a shooter game and i need the player to take damage but its not working out.it should be easy and im just messing stuff…. can you help?
- PhoenixEntropy
-
Scratcher
100+ posts
Need help with making hitboxes and hurtboxes. :|
can you help me out i cant get this to work im making a shooter game and i need the player to take damage but its not working out.it should be easy and im just messing stuff…. can you help?do not necropost
make a new topic
- Discussion Forums
- » Help with Scripts
-
» Need help with making hitboxes and hurtboxes. :|