Information about object: obj_player
Sprite: sprite0
Solid: false
Visible: true
Depth: -1
Persistent: false
Parent:
Children:
Mask:
Solid: false
Visible: true
Depth: -1
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
set variable global.stock to 0
COMMENT: this is how many slots are being taken in the inventory
Keyboard Event for <any key> Key:
execute code: //simple movement code if keyboard_check(vk_left) && place_free(x-4,y) && x > 0 { x-=4 } if keyboard_check(vk_right) && place_free(x+4,y) && x < room_width-sprite_width { x+=4 } if keyboard_check(vk_up) && place_free(x,y-4) && y > 0 { y-=4 } if keyboard_check(vk_down) && place_free(x,y+4) && y < room_height-sprite_height { y+=4 }
Key Press Event for <Enter> Key:
execute code: global._room_persistent = room_persistent room_persistent = 1 //remember the rooms persistency to return it back global._room = room //remember the current room alarm[0] = 1 //return the room to it's persistency when i come back room_goto(rm_inventory) //go to the inventory room
Information about object: object1Sprite: sprite1
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
ChildrenMask:
object2
object3
object4
object5
object6
object8 No Physics ObjectCreate Event:COMMENT: note how all items have me as their parentexecute code: //move the object to a random, empty space a = random(room_width-sprite_width) b = random(room_height-sprite_height) while !place_empty(a,b) { a = random(room_width-sprite_width) b = random(room_height-sprite_height) } x = a y = bexecute code: blah = real(string_delete(object_get_name(object_index),1,6)) //take the "object" out of it's name, to return the number global.obj[blah] = 0 //initialize the state of the variableCollision Event with object obj_player:execute code: global.obj[blah]+=1 if global.obj[blah] = 1 { global.stock += 1 } instance_destroy()Information about object: object2Sprite: sprite2
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: object1
Children:
Mask: No Physics ObjectInformation about object: object3Sprite: sprite3
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: object1
Children:
Mask: No Physics ObjectInformation about object: object4Sprite: sprite4
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: object1
Children:
Mask: No Physics ObjectInformation about object: object5Sprite: sprite5
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: object1
Children:
Mask: No Physics ObjectInformation about object: object6Sprite: sprite6
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: object1
Children:
Mask: No Physics ObjectInformation about object: object8Sprite: sprite8
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: object1
Children:
Mask: No Physics ObjectInformation about object: obj_inventorySprite: sprite10
Solid: true
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask: No Physics ObjectDraw Event:execute code: i = 25 io = 1 ix = 0 ixmin = 25 //the minimum x coordinate iy = 25 //the minimum y coordinate iincx = 25 //the x separator between the sprites iincy = 100 //the y separator between the sprites maxx = room_width - 25 //the max x coordinate before starting the next line //scroll down for (i=25; i<=(global.stock*25); i+=25) { ix += iincx if (ix > room_width - 25) { ix = ixmin iy += iincy } if global.obj[io]=0 { while global.obj[io]=0 { io += 1 } } draw_sprite(asset_get_index("sprite" + string(io)),-1,ix,iy) draw_text(ix,iy+25,global.obj[io]) //change the ix,iy+25 to where you would like the amount to be drawn io += 1 }Key Press Event for <Enter> Key:execute code: room_goto(global._room) //return to the last room
No comments:
Post a Comment