Help with Code - Collision



As an assignment for class, we are creating a game using GM Studio and for a certain part I am required to figure out something with code but I'm really confused and the teacher won't help. Please if anyone can help The object of the game is to have a ball hit a goal to score and win, but it's only suppose to count if it collides with the top of the goal.A ball is dropped into an enclosed area where you place playing pieces which the ball bounces off of until it hits the top of the goal.. But the ball is suppose to bounce off if it hits any other part of the goal. My problem right now is that as soon as the ball collides with any part of the goal, the game is over.
The code I have with the ball object's collision with goal is:
// increase the score
score = score + 500;
// game over - goto end screen

"Allow the player to win only when the ball hits the top of the goal. Otherwise bounce as normal. Here is some guidance to help.

You will need to adjust the ball object's Collision with goal event to check if the top of the goal was hit. We will have to do some math. Consider:

•An instance's x,y coordinates. •A sprite's width and height. •The relative position of a sprite's origin.

Specifically, you will need to compare the x and y coordinates of the ball and goal, taking into consideration the width, height, and origin of the sprites. "