Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Slasher on Wed 24/12/2014 18:41:34

Title: SOLVED: mouse over button and thed click button problem
Post by: Slasher on Wed 24/12/2014 18:41:34
Hi,

I have a mouse over buttons script that works except the buttons won't take mouse clicks. I'm expecting a bool change before clicking  button to run events can you lend a hand please  (roll) I need it to stop repeating when the button is clicked and to start running events before repeating mouse over again.


Code (ags) Select
}
  //Rep Exec

//Example:

if(gHealth.Visible==true)
if(played==false){
if((mouse.x >Button15.X+gHealth.X)&&(mouse.x <Button15.X+Button15.Width+gHealth.X)){
if((mouse.y >Button15.Y+gHealth.Y)&&(mouse.y <Button15.Y+Button15.Height+gHealth.Y)){
Display("Thump him");
}
}
}


cheers

EDIT: It seems I overlooked.

This seems to do the trick for buttons on gui:

Code (ags) Select
}
if(gHealth.Visible==true) {
if((mouse.x >Button15.X+gHealth.X)&&(mouse.x <Button15.X+Button15.Width+gHealth.X)){
if((mouse.y >Button15.Y+gHealth.Y)&&(mouse.y <Button15.Y+Button15.Height+gHealth.Y)){
cChar1.SayBackground("You could thump him!");
played=true;
}
}


if((mouse.x >Button42.X+gHealth.X)&&(mouse.x <Button42.X+Button42.Width+gHealth.X)){
if((mouse.y >Button42.Y+gHealth.Y)&&(mouse.y <Button42.Y+Button42.Height+gHealth.Y)){
cChar1.SayBackground("You could jump on him!");
played=true;
}
}

// etc etc


Happy days  (laugh)