Discuss Scratch

iron_Dense
New Scratcher
11 posts

How can I make invisible hitboxes?

imfh wrote:

It doesn't have to be complicated. Unmodified, something like this will work:

define Check collision
set [costume v] to (costume #)
switch costume to [hitbox v]
if <touching [something v] ?> then
set [hit v] to [1]
else
set [hit v] to [0]
end
switch costume to (costume)

The problem you are having is that you are putting a wait block between the switch to hitbox and switch to normal costume. If you do that, Scratch will wait a bit before switching back. Without a wait, it should switch back quickly enough that it doesn't show it on the screen.

It might help if you share the project so we can see it. Hitbox code is often better when customized for the project. It's possible we will be able to find a better way for what you are doing.

Well this was one of my ideas https://scratch.mit.edu/projects/291743207/
I thought that by using this i could both animate the sprite by having it change costumes every 0.2 seconds while also rapidly changing to the hitbox. Can you tell me what goes wrong that makes it not work?

Last edited by iron_Dense (March 6, 2019 16:27:27)

iron_Dense
New Scratcher
11 posts

How can I make invisible hitboxes?

StrangeMagic32 wrote:

iron_Dense wrote:

StrangeMagic32 wrote:

StrangeMagic32 wrote:

iron_Dense wrote:

Oh…I kind of get it now. But the problem is that i am already flickering between costumes.
See i don't want to see just a static image floating around. So for my rocketships i have 2 costumes,which have slightly different looking flames that come out of them.
I use a forever loop to switch between the two every 0.2 seconds.

Do you know of any solutions to this? How can i make an invisible hitbox now?
I'll make a project to help show you how
done
https://scratch.mit.edu/projects/291538518/

Yeah,too complex for a simpleton like me.

I tried doing random things myself and am actually kind of able to make something.
The animations work fine and the hitbox is invisible. But when the hitbox code is activated (for example: If color x is touching color y say “I'm hit!” for 2 seconds) then for 2 seconds,the hitbox is shown.
broadcast [hit v]
when I receive [hit v]
say [I'm hit] for (2) secs

Oh,i wish i could remember what I did back then to apply this
OC_528
Scratcher
1 post

How can I make invisible hitboxes?

SpideyPlaysMC
Scratcher
500+ posts

How can I make invisible hitboxes?

Please don't necropost.
hunthunthunt
Scratcher
4 posts

How can I make invisible hitboxes?

Is there any Project to this that I can put in my backpack and happily “barrow”?
gtbackcompteam
Scratcher
1 post

How can I make invisible hitboxes?

After 3 years
MrCloudGame
Scratcher
100+ posts

How can I make invisible hitboxes?

iron_Dense wrote:

Title basically says it all.
I'm trying to make a SHMUP game so i put a hitbox at the very top to make the bullets disappear if they miss enemies. But after a while of trying and messing with the ghosting block I still can't make it disappear without it stopping to work.

set ghoste to 100
YoshiGirl153
Scratcher
500+ posts

How can I make invisible hitboxes?

gtbackcompteam wrote:

After 3 years

MrCloudGame wrote:

iron_Dense wrote:

Title basically says it all.
I'm trying to make a SHMUP game so i put a hitbox at the very top to make the bullets disappear if they miss enemies. But after a while of trying and messing with the ghosting block I still can't make it disappear without it stopping to work.

set ghoste to 100

Please don’t necropost

Powered by DjangoBB