clicking anywhere else

Started by PsychicHeart, Thu 19/05/2005 08:06:09

Previous topic - Next topic

PsychicHeart

hey guys,
i want to make it so that you have to click a certain target. When you shoot that target you advance to the next level. I want to make it so that if you click on anything other than the target ( barring the GUI ) you go to the gameover screen. Is this possible? Oh, and don't suggest making the background into an object and implementing it becuase for this situation that wouldn't work.
thanks
Formerly known as Flukeblake, Flukezy etc.

Gilbert

There are many ways, and it surely is simple.
One way I can think of, is to make the target an object, all you need to know is the GetObjectAt() function.
Say, the target is object 4, you can code it like this, in on_mouse_click() of the room:

if (GetObjectAt(mouse.x, mouse.y)==4) { //hit
Ã,  //Do whatever you need to go up a level here
} else {//missed
Ã,  //Game Over
}

(note that if your room is a scrolling one,you may need to change those mouse.x and mouse.y to (mouse.x+GetViewportX()) andÃ,  (mouse.y+GetViewportY()) respectively.)

PsychicHeart

Formerly known as Flukeblake, Flukezy etc.

SMF spam blocked by CleanTalk