Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// Drag Icon
- visible = oInventoryBox.visible;
- if(position_meeting(mouse_x,mouse_y,oInventoryIconParent)){
- if(mouse_check_button_pressed(mb_left)){ // grab the item //
- global.heldIcon = id;
- }
- }
- if(global.heldIcon == id){
- box = instance_nearest(mouse_x,mouse_y,oInventoryBox);
- if(mouse_check_button(mb_left)){ // drag the item //
- x = mouse_x;
- y = mouse_y;
- }
- if(mouse_check_button_released(mb_left)){ // release the item //
- if(instance_exists(box)){
- global.boxes[boxNumber].item = box.item; // give the old box the new boxes item
- global.boxes[boxNumber].item.boxNumber = boxNumber;// give the new boxes item it's new box number
- box.item = id; // put the item in the new box
- boxNumber = box.boxID; // give this item it's new box number
- }
- box = -1; // reset box and the item being dragged.
- global.heldIcon = -1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement