Advertisement
Guest User

Untitled

a guest
Jun 2nd, 2016
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /// Drag Icon
  2. visible = oInventoryBox.visible;
  3.  
  4. if(position_meeting(mouse_x,mouse_y,oInventoryIconParent)){
  5.     if(mouse_check_button_pressed(mb_left)){ // grab the item //
  6.         global.heldIcon = id;
  7.     }
  8. }
  9.  
  10. if(global.heldIcon == id){
  11.     box = instance_nearest(mouse_x,mouse_y,oInventoryBox);
  12.     if(mouse_check_button(mb_left)){ // drag the item //
  13.         x = mouse_x;
  14.         y = mouse_y;
  15.     }
  16.     if(mouse_check_button_released(mb_left)){ // release the item //
  17.         if(instance_exists(box)){
  18.             global.boxes[boxNumber].item = box.item; // give the old box the new boxes item
  19.             global.boxes[boxNumber].item.boxNumber = boxNumber;// give the new boxes item it's new box number
  20.             box.item = id;                           // put the item in the new box
  21.             boxNumber = box.boxID;                             // give this item it's new box number
  22.         }
  23.         box = -1; // reset box and the item being dragged.
  24.         global.heldIcon = -1;
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement