collision with two actors problem
Mayhem_Madness
Member, PRO Posts: 168
I have an actor, a ball. that when collides with another actor,a post, you get one point and the scene resets. And I have another actor, a wall, that when collides with the ball actor I mentioned, the game ends, and the ball falls to the ground. But the problem is when the ball collides with the wall it falls and sometimes it touches the post as well. So the game doesn't end and you end up getting one point and the scene resets.
So do you know how I would do it so when the ball collides with the wall the ball will fall to the ground, and if it collides with the post as well it won't give me one point and it won't reset the scene.
I hope that makes sense
Thankyou
Thor
Comments
@thor Make an attribute: wall.
Make it so if your ball touches the wall then game.wall=1
Make your win condition to include if game.wall=0
Mathtap.com (Android) | Fridgemanager.com (Android) | Breakoutofspace.com (Android)
@tatiang
Thankyou summation, but there is one problem after i hit the wall once, when i replay the game, and when the ball touches the post again noting happens, i don't get a point and the scene doesn't reset. It just goes on to hit the wall and falls to the ground.
Thankyou,
@Braydon_SFX
Hi Braydon, do you have any ideas on what i should do to fix this problem?
Thanks.
It sounds like you need to reset the value of whatever attribute you're using (e.g. game.wall) before replaying the game.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
So would i put change attribute game.wall to 0 in the replay button?
Yes. Right before you Change Scene or Reset Scene or however you're replaying the game.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Thankyou very much for that
I have one more problem with my game, I have a game.touch.count.
That when the screen is pressed my actor jumps, but I also have two arrow buttons for going left and right.
The problem is that when I jump in the air by touching the screen , you can also touch the arrow buttons to move. So once your in mid-air it lets you move left and right.
Which I don't want to happen.
So do you know how I would fix this problem?
Thanks.
Hi, just to let you know, i figured out how to do it, and i thinks its working now.
So for anyone who wants to know how to do this, i just did when attribute self.position.y is greater than a particular position.
Constrain attribute game.moveleft to false.
Constrain attribute game.moveright to false.
And thats it.
Thankyou for the help.