Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// Drop the item
- if (global.item != -1)
- {
- if (instance_position(mouse_x, mouse_y, obj_inventory_box) && global.game_state= 'pause')
- {
- var box = instance_position(mouse_x, mouse_y, obj_inventory_box);
- //slot empty
- if (box.item == -1 && (box.type == scr_get_item_value(global.item, 'type') || box.type == ''))
- {
- //put the item in the box
- box.item = global.item;
- global.item = -1;
- }
- else
- {
- //drop item
- instance_create(obj_player.x, obj_player.y, global.item);
- global.item = -1;
- }
- }
- else
- {
- instance_create(obj_player.x, obj_player.y, global.item);
- global.item = -1;
- }
- }
- //take the item from the inventory box
- if (( item != -1) && global.game_state == 'pause')
- {
- global.item = item;
- item = -1;
- }
- //player Movements
- if ((keyboard_check(ord('S')) || keyboard_check(vk_down)) && place_free(x,y+4))
- {
- y+=4
- }
- if ((keyboard_check(ord('W'))|| keyboard_check(vk_up)) && place_free(x,y-4))
- {
- y-=4
- }
- if ((keyboard_check(ord('A'))|| keyboard_check(vk_left)) && place_free(x-4,y))
- {
- x-=4
- }
- if ((keyboard_check(ord('D'))|| keyboard_check(vk_right)) && place_free(x+4,y))
- {
- x+=4
- }
- ///spawn hp bar and mana bar
- if (instance_exists(obj_player) && room != rm_menu && !instance_exists(obj_hpbar))
- {
- instance_create(view_xview[0]+xstart, view_yview[0]+ystart,obj_hpbar)
- }
- if (instance_exists(obj_player) && room != rm_menu && !instance_exists(obj_manabar))
- {
- instance_create(view_xview[0]+xstart, view_yview[0]+ystart,obj_manabar)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement