Drag and drop gui button

Started by Blano, Thu 12/09/2024 17:38:48

Previous topic - Next topic

Blano

I promised myself I wouldn't write anymore but here I am, I present to you the problem, I'm trying to build a jigsaw puzzle, I can get the piece in the cursor but I can't drop it, where do you think I'm going wrong?? here is the code


script on puzzle piece (as a Gui button)
Code: ags
function pP1_OnClick(GUIControl *control, MouseButton button)
{
if (puzzle1_pezzo_selezionato == 0){
  mouse.ChangeModeGraphic((mouse.Mode),134);
  pP1.Visible= false;
  puzzle1_pezzo_selezionato= 1;
}
}



and the left click script below (just the puzzle part)

Code: ags

   if (puzzle1_pezzo_selezionato != 0 && gPuzzle1.Visible == true) {
    
    int mousex = mouse.x;
    int mousey = mouse.y;
    
    if (puzzle1_pezzo_selezionato == 1) {
        
        pP1.SetPosition(mousex, mousey);
        pP1.Visible = true;
        
       
        mouse.ChangeModeGraphic(eModePointer, 0);  // Assicurati che '0' sia il graphic ID del puntatore standard
        
        puzzle1_pezzo_selezionato = 0;
    }
}



Thank you for your help

Dam


edit:

puzzle1_pezzoselezionato means puzzle 1 selected piece
 wich i ha ve defined with starting value 0

SMF spam blocked by CleanTalk