Collision and Add 1

If my condition was when my two objects collide and then I add 1 to my number scene variable. If these two objects stay in collision does it add 1 continuously to my variable?

Yes without other conditions like a trigger once.

1 Like

I see, thank you for answering @Lucky-j !

How about in this?

Does this continuously add 1?

Yep it looks like it would if the conditions were met AND the condition block is not set within a beg of scene event.

Oh dear, I really don’t know what to do. I’m feeling quite lost and would deeply appreciate any suggestions you might have to solve this issue. And, if it’s not too much trouble, could it please avoid adding 1 continuously? Thank you ever so much.

Ok I will try to give a suggestion. What is happening?

I have multiple copies of an object and I want to equally divide them on the opposite sides of an oval. Let’s just say a couple of square, circle, and rectangle objects. I want each object to be counted if they are equally divided on the opposite sides so that I can proceed to another, like, level.

So I made this

It kind of detects that there are 4 on each sides. But, when I move one on the other side making it 3:5, it don’t detect it.

Don’t worry too much about making a complex checking system at first. The most important part of any project is its completion. So just do something simple that works. Later if you still have any interest in this project you can finesse it according to the skills you have learned along the way of completing projects…

What about something like this? Just to get started so you can complete the matching sides phase of the project and move on to another part.

Thank you soooooo much :smiling_face_with_tear:

1 Like

Aw you’re welcome, hope it helps you get on to the next phase of your project.

1 Like

Hi again, @Lucky-j !

Thank you so much for your help! I tried your suggestion, and it worked wonderfully. Now, I’m trying to add a little something to the code: when all conditions are met, I’d love to animate a button to the ā€œpressedā€ state, which is shown
here.

I tried inverting the condition so that when the number of objects doesn’t match, the button goes back to the ā€œdefaultā€ animation. But it doesn’t seem to work.

I’m really stuck. Do you have any ideas on how to fix this? I’m really in need of your amazing expertise!

Thank you so much in advance! :blush:

PS. Here’s how I did it

1 Like

Sure thing. In the first instance we need all 3 conditions to be true before we declare our condition to be met, game to be won and change the button animation to the depressed state.

In the second instance, we do not need all 3 conditions to be met to change the button animation back to default. We do not need all of the variable sets to be different from their counterparts at the same time. We only need one variable set to be different from its counterpart to know that the game is incomplete and the sides are now uneven somewhere. Since we only need one condition met to know that the sides are uneven we can drop our 3 conditions into an OR.

By the way your project is looking good.

Thank you so much for the clear explanation! That makes perfect sense now. I really appreciate your help with understanding how these conditions work. Have a great day! Thank you again!

1 Like

Hey @Lucky-j I totally forgot that you answered this post :sweat_smile:

My apologies, I have only noticed something in the preview of this code now.

When I bring the histone object to the left side the button is pressed

this happens too:

This is the code:

Sorry for causing you too much trouble

The events you show look fine and based on those it should be running as intended. Also I hope you put them all as subevents under a condition like ā€œhistone OR dna was just droppedā€, but they should run fine without that, it would just be more optimal to have them as a subevent to a ā€œwas just droppedā€ and then you could remove all the ā€œtrigger onceā€. Anyway let me know if they are a subevent to anything. The possible explanation that leaps to my mind is that the variables are not being updated correctly but are remaining at default 0, which would make the button pressed statement true.

1 Like

Hello again Lucky :rofl: this project is practice/experiment project before I add it to the main project, if I’m making sense. The objects of my main project does not have draggable behavior. The character carries them by changing their position to the character point by pressing on a grab button and releases them when the grab button is released. I only want to have a like detection mechanism to see if the objects are divided equally to the opposite sides of the oval. Btw. in this practice project there are no other events except for the one I sent you.

Here’s the unedited event:

EDIT:
my scene variables

Ok so with no events other than the ones shown in the image you posted, I take it to mean when you ā€œbring the histone object to the left sideā€ means when you put it on the left side in the scene editor and then press preview? Which shouldn’t make a difference. Should still work.

The object anim is a sprite? You have named 2 of its animations, one to ā€˜default’ and one to ā€˜pressed’? In the scene editor can you select DNA and then Histone to show how much invisible space is around the visible part of the sprite?

Yep, the Anim is a sprite with 2 animations: default and pressed.


The button plays pressed animation when only the histone is moved/dragged to the left side when it’s not supposed to (assuming nothing is weird with the code). It should only play Pressed when all objects are equally divided to each opposite sides :sob: :sob: