Detect first collision only [Solved]

I’m trying to make my game so that when object a hits object b it changes score by 1. However, when I try this it keeps adding untill object a is not on object b. I only want it to add 1 on the first time it detects object b.

3 Likes

Bumps, if score < 1 oh whoops hold on

Yeah, so bumps doesn’t really do the trick anymore since it is broken.

Try using a “bumped” variable something like this (must be in this order):

When OBJ1 bumps OBJ2 {
    if (bumped == 0) {
        Set variable bumped = 1
        other actions
    }
}
When 7=7 {
    Set variable bumped = 0
}

@StarCoder

2 Likes

Yeah still doesn’t really work in my case. oh well i guess it will just have a broken scoring system.

1 Like

Shoot, I messed up the code. Lemme edit it & you will get tagged again


I’ll have to write it tomorrow, sorry.

2 Likes

No, it’s fine. I made the scoring system work differently anyway. Try it out for your self if you want:

3 Likes

Cool, is this solved?

1 Like

Well, sort of. I ended up making the score be based on time survived rather than the amount of zombies shot.

1 Like

You could have given us the example. When a zombie transforms, you could have used a variable there to indicate that it is dead already…

with that said, @FearlessPhoenix can close with your confirmation

2 Likes

I’m watching this topic n reaading through new posts as they come in (per usual) and am liking them. No need to tag :wink:

2 Likes

ah oops,,, totally knew that.

1 Like

No, it’s fine. I kind of prefer the time scoring system anyway. After 2 years off hopscotch i just wanted to make a simple game.

3 Likes

That’s fine lol.
I don’t mind

1 Like

Use

When((Object A) bumps (Object B))
instead of
When((Object A) is touching (Object B))

Or set a topic timer for a few days so that more people can help and provide different solutions.

2 Likes

The issue is that sometimes bump behaves like is touching.

2 Likes

Really? That’s strange.
I can’ seem to get it to break. @StarCoder do you have an old version of this project which had 5e broken when bumps?

3 Likes

Sorry, i dont but i tried to do it with bumps. But itwould keep detecting the bump until the object a is completely off.

2 Likes

@FearlessPhoenix please close this topic now that it has been solved.

2 Likes