Sabtu, 13 Juni 2015

Cara membuat Inventory (Tahap 2)

Hai sob, kepingin tau cara membuat inventory (Tahap 2) sekarang saya akan berbagi ide untuk kalian :D.



Persiapan
1) Sprite dan backgrndnya dapat didownload disini.
2) Game makernya.
3) Kopi dan cemilan.

1) Sprite 
Buatlah sprite yang bernama

- spr_box                                                                                           -spr_bow         
- spr_sword                                                                                       -spr_knife 
2) Background
Buatlah bakground yang bernama
- back1
3) Object
Buatlah object yang bernama
1. obj_controller

Sprite: <no sprite>
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event >> control >> set variable
set variable global.holding to 0
Create Event >> control >> set variable
set variable global.box1oc to 0
Create Event >> control >> set variable
set variable global.box2oc to 0
Create Event >> control >> set variable
set variable global.box3oc to 0
Create Event >> control >> set variable
set variable global.box4oc to 0
Create Event >> control >> set variable
set variable global.box5oc to 0
Create Event >> control >> set variable
set variable global.box6oc to 0
Create Event >> control >> set variable
set variable global.box7oc to 0
Create Event >> control >> set variable
set variable global.box8oc to 0
Create Event >> control >> set variable
set variable global.box9oc to 0
Create Event >> control >> set variable
set variable global.box10oc to 0
Emang banyak sih, tapi kalau bisa di duplikat saja biar praktis

2.obj_box_basic

Sprite: <no sprite>
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

3. obj_box_1

Sprite: spr_box
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: obj_box_basic
Mask: <same as sprite>

 Create event >> Step event >> Step >> Control >> execute script
isi script dengan kode dibawah ini

x = view_xview+16
y = view_yview+16


Create event >> Mouse >> Leftpressed >> control >> execute code
isi script dengan kode dibawah ini

if global.box1oc = 1 {global.box1oc = 0}

create event >> draw >> control >>execute code
isi script dengan kode dibawah ini

draw_sprite(spr_box,global.box1oc,view_xview+16,view_yview+16)

4. obj_box_2

Sprite: spr_box
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: obj_box_basic
Mask: <same as sprite>

 Create event >> Step event >> Step >> Control >> execute script
isi script dengan kode dibawah ini

x = view_xview+16
y = view_yview+16


Create event >> Mouse >> Leftpressed >> control >> execute code
isi script dengan kode dibawah ini

if global.box2oc = 1 {global.box2oc = 0}

create event >> draw >> control >>execute code
isi script dengan kode dibawah ini

draw_sprite(spr_box,global.box1oc,view_xview+16,view_yview+16)

5. obj_box_3

Sprite: spr_box
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: obj_box_basic
Mask: <same as sprite>

 Create event >> Step event >> Step >> Control >> execute script
isi script dengan kode dibawah ini

x = view_xview+16
y = view_yview+16


Create event >> Mouse >> Leftpressed >> control >> execute code
isi script dengan kode dibawah ini

if global.box3oc = 1 {global.box3oc = 0}

create event >> draw >> control >>execute code
isi script dengan kode dibawah ini

draw_sprite(spr_box,global.box1oc,view_xview+16,view_yview+16)

6. obj_box_4

Sprite: spr_box
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: obj_box_basic
Mask: <same as sprite>

 Create event >> Step event >> Step >> Control >> execute script
isi script dengan kode dibawah ini

x = view_xview+16
y = view_yview+16


Create event >> Mouse >> Leftpressed >> control >> execute code
isi script dengan kode dibawah ini

if global.box4oc = 1 {global.box4oc = 0}

create event >> draw >> control >>execute code
isi script dengan kode dibawah ini

draw_sprite(spr_box,global.box1oc,view_xview+16,view_yview+16)

7. obj_box_5

Sprite: spr_box
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: obj_box_basic
Mask: <same as sprite>

 Create event >> Step event >> Step >> Control >> execute script
isi script dengan kode dibawah ini

x = view_xview+16
y = view_yview+16


Create event >> Mouse >> Leftpressed >> control >> execute code
isi script dengan kode dibawah ini

if global.box5oc = 1 {global.box5oc = 0}

create event >> draw >> control >>execute code
isi script dengan kode dibawah ini

draw_sprite(spr_box,global.box1oc,view_xview+16,view_yview+16)

8. obj_box_6

Sprite: spr_box
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: obj_box_basic
Mask: <same as sprite>

 Create event >> Step event >> Step >> Control >> execute script
isi script dengan kode dibawah ini

x = view_xview+16
y = view_yview+16


Create event >> Mouse >> Leftpressed >> control >> execute code
isi script dengan kode dibawah ini

if global.box6oc = 1{global.box6oc = 0}

create event >> draw >> control >>execute code
isi script dengan kode dibawah ini

draw_sprite(spr_box,global.box1oc,view_xview+16,view_yview+16)

9. obj_box_7

Sprite: spr_box
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: obj_box_basic
Mask: <same as sprite>

 Create event >> Step event >> Step >> Control >> execute script
isi script dengan kode dibawah ini

x = view_xview+16
y = view_yview+16


Create event >> Mouse >> Leftpressed >> control >> execute code
isi script dengan kode dibawah ini

if global.box7oc = 1 {global.box7oc = 0}

create event >> draw >> control >>execute code
isi script dengan kode dibawah ini

draw_sprite(spr_box,global.box1oc,view_xview+16,view_yview+16)

10 obj_box_8

Sprite: spr_box
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: obj_box_basic
Mask: <same as sprite>

 Create event >> Step event >> Step >> Control >> execute script
isi script dengan kode dibawah ini

x = view_xview+16
y = view_yview+16


Create event >> Mouse >> Leftpressed >> control >> execute code
isi script dengan kode dibawah ini

if global.box8oc = 1 {global.box8oc = 0}

create event >> draw >> control >>execute code
isi script dengan kode dibawah ini

draw_sprite(spr_box,global.box1oc,view_xview+16,view_yview+16)

11 obj_box_9

Sprite: spr_box
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: obj_box_basic
Mask: <same as sprite>

 Create event >> Step event >> Step >> Control >> execute script
isi script dengan kode dibawah ini

x = view_xview+16
y = view_yview+16


Create event >> Mouse >> Leftpressed >> control >> execute code
isi script dengan kode dibawah ini

if global.box9oc = 1 {global.box9oc = 0}

create event >> draw >> control >>execute code
isi script dengan kode dibawah ini

draw_sprite(spr_box,global.box1oc,view_xview+16,view_yview+16)

12 obj_box_10

Sprite: spr_box
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: obj_box_basic
Mask: <same as sprite>

 Create event >> Step event >> Step >> Control >> execute script
isi script dengan kode dibawah ini

x = view_xview+16
y = view_yview+16


Create event >> Mouse >> Leftpressed >> control >> execute code
isi script dengan kode dibawah ini

if global.box10oc = 1 {global.box10oc = 0}

create event >> draw >> control >>execute code
isi script dengan kode dibawah ini

draw_sprite(spr_box,global.box1oc,view_xview+16,view_yview+16)

13.obj_sword_inventory

Sprite: spr_sword
Solid: false
Visible: true
Depth: -1
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event >> Create >> execute code

go = 0

  if global.box1oc = 0 {x = obj_box_1.x y = obj_box_1.y global.box1oc = 1 exit}
  if global.box2oc = 0 {x = obj_box_2.x y = obj_box_2.y global.box2oc = 1 exit}
  if global.box3oc = 0 {x = obj_box_3.x y = obj_box_3.y global.box3oc = 1 exit}
  if global.box4oc = 0 {x = obj_box_4.x y = obj_box_4.y global.box4oc = 1 exit}
  if global.box5oc = 0 {x = obj_box_5.x y = obj_box_5.y global.box5oc = 1 exit}
  if global.box6oc = 0 {x = obj_box_6.x y = obj_box_6.y global.box6oc = 1 exit}
  if global.box7oc = 0 {x = obj_box_7.x y = obj_box_7.y global.box7oc = 1 exit}
  if global.box8oc = 0 {x = obj_box_8.x y = obj_box_8.y global.box8oc = 1 exit}
  if global.box9oc = 0 {x = obj_box_9.x y = obj_box_9.y global.box9oc = 1 exit}
  if global.box10oc = 0 {x = obj_box_10.x y = obj_box_10.y global.box10oc = 1 exit}
  if global.box11oc = 0 {x = obj_box_11.x y = obj_box_11.y global.box11oc = 1 exit}
  if global.box12oc = 0 {x = obj_box_12.x y = obj_box_12.y global.box12oc = 1 exit}
  if global.box13oc = 0 {x = obj_box_13.x y = obj_box_13.y global.box13oc = 1 exit}
  if global.box14oc = 0 {x = obj_box_14.x y = obj_box_14.y global.box14oc = 1 exit}
  if global.box15oc = 0 {x = obj_box_15.x y = obj_box_15.y global.box15oc = 1 exit}
  if global.box16oc = 0 {x = obj_box_16.x y = obj_box_16.y global.box16oc = 1 exit}
  if global.box17oc = 0 {x = obj_box_17.x y = obj_box_17.y global.box17oc = 1 exit}
  if global.box18oc = 0 {x = obj_box_18.x y = obj_box_18.y global.box18oc = 1 exit}
  if global.box19oc = 0 {x = obj_box_19.x y = obj_box_19.y global.box19oc = 1 exit}
  if global.box20oc = 0 {x = obj_box_20.x y = obj_box_20.y global.box20oc = 1 exit}


Create event >> destroy >> execute code

if distance_to_object(obj_box_1)<1 {global.box1oc = 0}

if distance_to_object(obj_box_2)<1 {global.box2oc = 0}

if distance_to_object(obj_box_3)<1 {global.box3oc = 0}

if distance_to_object(obj_box_4)<1 {global.box4oc = 0}

if distance_to_object(obj_box_5)<1 {global.box5oc = 0}

if distance_to_object(obj_box_6)<1 {global.box6oc = 0}

if distance_to_object(obj_box_7)<1 {global.box7oc = 0}

if distance_to_object(obj_box_8)<1 {global.box8oc = 0}

if distance_to_object(obj_box_9)<1 {global.box9oc = 0}

if distance_to_object(obj_box_10)<1 {global.box10oc = 0}

if distance_to_object(obj_box_11)<1 {global.box11oc = 0}

if distance_to_object(obj_box_12)<1 {global.box12oc = 0}

if distance_to_object(obj_box_13)<1 {global.box13oc = 0}

if distance_to_object(obj_box_14)<1 {global.box14oc = 0}

if distance_to_object(obj_box_15)<1 {global.box15oc = 0}

if distance_to_object(obj_box_16)<1 {global.box16oc = 0}

if distance_to_object(obj_box_17)<1 {global.box17oc = 0}

if distance_to_object(obj_box_18)<1 {global.box18oc = 0}

if distance_to_object(obj_box_19)<1 {global.box19oc = 0}

if distance_to_object(obj_box_20)<1 {global.box20oc = 0}




Create Event >> Step >> Step >> execute code

if go = 1 {x = mouse_x y = mouse_y} else {exit}


Create Event >> Mouse Event >> Left Pressed >> execute code

go = 1


Create Event >> Mouse Event >> Glob Left Released  >> execute code

if go = 1 if distance_to_object(obj_box_basic)<1
{
if go = 1 {if distance_to_object(obj_box_1)<1 {if global.box1oc = 0 {go = 0 y = obj_box_1.y x = obj_box_1.x global.box1oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_2)<1 {if global.box2oc = 0 {go = 0 y = obj_box_2.y x = obj_box_2.x global.box2oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_3)<1 {if global.box3oc = 0 {go = 0 y = obj_box_3.y x = obj_box_3.x global.box3oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_4)<1 {if global.box4oc = 0 {go = 0 y = obj_box_4.y x = obj_box_4.x global.box4oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_5)<1 {if global.box5oc = 0 {go = 0 y = obj_box_5.y x = obj_box_5.x global.box5oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_6)<1 {if global.box6oc = 0 {go = 0 y = obj_box_6.y x = obj_box_6.x global.box6oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_7)<1 {if global.box7oc = 0 {go = 0 y = obj_box_7.y x = obj_box_7.x global.box7oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_8)<1 {if global.box8oc = 0 {go = 0 y = obj_box_8.y x = obj_box_8.x global.box8oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_9)<1 {if global.box9oc = 0 {go = 0 y = obj_box_9.y x = obj_box_9.x global.box9oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_10)<1 {if global.box10oc = 0 {go = 0 y = obj_box_10.y x = obj_box_10.x global.box10oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_11)<1 {if global.box11oc = 0 {go = 0 y = obj_box_11.y x = obj_box_11.x global.box11oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_12)<1 {if global.box12oc = 0 {go = 0 y = obj_box_12.y x = obj_box_12.x global.box12oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_13)<1 {if global.box13oc = 0 {go = 0 y = obj_box_13.y x = obj_box_13.x global.box13oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_14)<1 {if global.box14oc = 0 {go = 0 y = obj_box_14.y x = obj_box_14.x global.box14oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_15)<1 {if global.box15oc = 0 {go = 0 y = obj_box_15.y x = obj_box_15.x global.box15oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_16)<1 {if global.box16oc = 0 {go = 0 y = obj_box_16.y x = obj_box_16.x global.box16oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_17)<1 {if global.box17oc = 0 {go = 0 y = obj_box_17.y x = obj_box_17.x global.box17oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_18)<1 {if global.box18oc = 0 {go = 0 y = obj_box_18.y x = obj_box_18.x global.box18oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_19)<1 {if global.box19oc = 0 {go = 0 y = obj_box_19.y x = obj_box_19.x global.box19oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_20)<1 {if global.box20oc = 0 {go = 0 y = obj_box_20.y x = obj_box_20.x global.box20oc = 1 exit}}}
}

else
{
go = 0 x = 320 y = 240instance_change(obj_sword_pick_up,1)
}

14. obj_sword_pick_up

Sprite: spr_sword
Solid: false
Visible: true
Depth: -1
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event >> Mouse Event >> Left Pressed >> execute code
execute code:

instance_change(obj_sword_inventory,1) exit

15. obj_bow_inventory

Sprite: spr_sword
Solid: false
Visible: true
Depth: -1
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event >> Create >> execute code

go = 0

  if global.box1oc = 0 {x = obj_box_1.x y = obj_box_1.y global.box1oc = 1 exit}
  if global.box2oc = 0 {x = obj_box_2.x y = obj_box_2.y global.box2oc = 1 exit}
  if global.box3oc = 0 {x = obj_box_3.x y = obj_box_3.y global.box3oc = 1 exit}
  if global.box4oc = 0 {x = obj_box_4.x y = obj_box_4.y global.box4oc = 1 exit}
  if global.box5oc = 0 {x = obj_box_5.x y = obj_box_5.y global.box5oc = 1 exit}
  if global.box6oc = 0 {x = obj_box_6.x y = obj_box_6.y global.box6oc = 1 exit}
  if global.box7oc = 0 {x = obj_box_7.x y = obj_box_7.y global.box7oc = 1 exit}
  if global.box8oc = 0 {x = obj_box_8.x y = obj_box_8.y global.box8oc = 1 exit}
  if global.box9oc = 0 {x = obj_box_9.x y = obj_box_9.y global.box9oc = 1 exit}
  if global.box10oc = 0 {x = obj_box_10.x y = obj_box_10.y global.box10oc = 1 exit}
  if global.box11oc = 0 {x = obj_box_11.x y = obj_box_11.y global.box11oc = 1 exit}
  if global.box12oc = 0 {x = obj_box_12.x y = obj_box_12.y global.box12oc = 1 exit}
  if global.box13oc = 0 {x = obj_box_13.x y = obj_box_13.y global.box13oc = 1 exit}
  if global.box14oc = 0 {x = obj_box_14.x y = obj_box_14.y global.box14oc = 1 exit}
  if global.box15oc = 0 {x = obj_box_15.x y = obj_box_15.y global.box15oc = 1 exit}
  if global.box16oc = 0 {x = obj_box_16.x y = obj_box_16.y global.box16oc = 1 exit}
  if global.box17oc = 0 {x = obj_box_17.x y = obj_box_17.y global.box17oc = 1 exit}
  if global.box18oc = 0 {x = obj_box_18.x y = obj_box_18.y global.box18oc = 1 exit}
  if global.box19oc = 0 {x = obj_box_19.x y = obj_box_19.y global.box19oc = 1 exit}
  if global.box20oc = 0 {x = obj_box_20.x y = obj_box_20.y global.box20oc = 1 exit}


Create event >> destroy >> execute code

if distance_to_object(obj_box_1)<1 {global.box1oc = 0}

if distance_to_object(obj_box_2)<1 {global.box2oc = 0}

if distance_to_object(obj_box_3)<1 {global.box3oc = 0}

if distance_to_object(obj_box_4)<1 {global.box4oc = 0}

if distance_to_object(obj_box_5)<1 {global.box5oc = 0}

if distance_to_object(obj_box_6)<1 {global.box6oc = 0}

if distance_to_object(obj_box_7)<1 {global.box7oc = 0}

if distance_to_object(obj_box_8)<1 {global.box8oc = 0}

if distance_to_object(obj_box_9)<1 {global.box9oc = 0}

if distance_to_object(obj_box_10)<1 {global.box10oc = 0}

if distance_to_object(obj_box_11)<1 {global.box11oc = 0}

if distance_to_object(obj_box_12)<1 {global.box12oc = 0}

if distance_to_object(obj_box_13)<1 {global.box13oc = 0}

if distance_to_object(obj_box_14)<1 {global.box14oc = 0}

if distance_to_object(obj_box_15)<1 {global.box15oc = 0}

if distance_to_object(obj_box_16)<1 {global.box16oc = 0}

if distance_to_object(obj_box_17)<1 {global.box17oc = 0}

if distance_to_object(obj_box_18)<1 {global.box18oc = 0}

if distance_to_object(obj_box_19)<1 {global.box19oc = 0}

if distance_to_object(obj_box_20)<1 {global.box20oc = 0}




Create Event >> Step >> Step >> execute code

if go = 1 {x = mouse_x y = mouse_y} else {exit}


Create Event >> Mouse Event >> Left Pressed >> execute code

go = 1


Create Event >> Mouse Event >> Glob Left Released  >> execute code

if go = 1 if distance_to_object(obj_box_basic)<1
{
if go = 1 {if distance_to_object(obj_box_1)<1 {if global.box1oc = 0 {go = 0 y = obj_box_1.y x = obj_box_1.x global.box1oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_2)<1 {if global.box2oc = 0 {go = 0 y = obj_box_2.y x = obj_box_2.x global.box2oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_3)<1 {if global.box3oc = 0 {go = 0 y = obj_box_3.y x = obj_box_3.x global.box3oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_4)<1 {if global.box4oc = 0 {go = 0 y = obj_box_4.y x = obj_box_4.x global.box4oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_5)<1 {if global.box5oc = 0 {go = 0 y = obj_box_5.y x = obj_box_5.x global.box5oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_6)<1 {if global.box6oc = 0 {go = 0 y = obj_box_6.y x = obj_box_6.x global.box6oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_7)<1 {if global.box7oc = 0 {go = 0 y = obj_box_7.y x = obj_box_7.x global.box7oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_8)<1 {if global.box8oc = 0 {go = 0 y = obj_box_8.y x = obj_box_8.x global.box8oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_9)<1 {if global.box9oc = 0 {go = 0 y = obj_box_9.y x = obj_box_9.x global.box9oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_10)<1 {if global.box10oc = 0 {go = 0 y = obj_box_10.y x = obj_box_10.x global.box10oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_11)<1 {if global.box11oc = 0 {go = 0 y = obj_box_11.y x = obj_box_11.x global.box11oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_12)<1 {if global.box12oc = 0 {go = 0 y = obj_box_12.y x = obj_box_12.x global.box12oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_13)<1 {if global.box13oc = 0 {go = 0 y = obj_box_13.y x = obj_box_13.x global.box13oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_14)<1 {if global.box14oc = 0 {go = 0 y = obj_box_14.y x = obj_box_14.x global.box14oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_15)<1 {if global.box15oc = 0 {go = 0 y = obj_box_15.y x = obj_box_15.x global.box15oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_16)<1 {if global.box16oc = 0 {go = 0 y = obj_box_16.y x = obj_box_16.x global.box16oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_17)<1 {if global.box17oc = 0 {go = 0 y = obj_box_17.y x = obj_box_17.x global.box17oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_18)<1 {if global.box18oc = 0 {go = 0 y = obj_box_18.y x = obj_box_18.x global.box18oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_19)<1 {if global.box19oc = 0 {go = 0 y = obj_box_19.y x = obj_box_19.x global.box19oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_20)<1 {if global.box20oc = 0 {go = 0 y = obj_box_20.y x = obj_box_20.x global.box20oc = 1 exit}}}
}

else
{
go = 0 x = 320 y = 240instance_change(obj_bow_pick_up,1)
}

16. obj_bow_pick_up

Sprite: spr_bow
Solid: false
Visible: true
Depth: -1
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event >> Mouse Event >> Left Pressed >> execute code
execute code:

instance_change(obj_bow_inventory,1) exit

17. obj_knife_inventory

Sprite: spr_knife
Solid: false
Visible: true
Depth: -1
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event >> Create >> execute code

go = 0

  if global.box1oc = 0 {x = obj_box_1.x y = obj_box_1.y global.box1oc = 1 exit}
  if global.box2oc = 0 {x = obj_box_2.x y = obj_box_2.y global.box2oc = 1 exit}
  if global.box3oc = 0 {x = obj_box_3.x y = obj_box_3.y global.box3oc = 1 exit}
  if global.box4oc = 0 {x = obj_box_4.x y = obj_box_4.y global.box4oc = 1 exit}
  if global.box5oc = 0 {x = obj_box_5.x y = obj_box_5.y global.box5oc = 1 exit}
  if global.box6oc = 0 {x = obj_box_6.x y = obj_box_6.y global.box6oc = 1 exit}
  if global.box7oc = 0 {x = obj_box_7.x y = obj_box_7.y global.box7oc = 1 exit}
  if global.box8oc = 0 {x = obj_box_8.x y = obj_box_8.y global.box8oc = 1 exit}
  if global.box9oc = 0 {x = obj_box_9.x y = obj_box_9.y global.box9oc = 1 exit}
  if global.box10oc = 0 {x = obj_box_10.x y = obj_box_10.y global.box10oc = 1 exit}
  if global.box11oc = 0 {x = obj_box_11.x y = obj_box_11.y global.box11oc = 1 exit}
  if global.box12oc = 0 {x = obj_box_12.x y = obj_box_12.y global.box12oc = 1 exit}
  if global.box13oc = 0 {x = obj_box_13.x y = obj_box_13.y global.box13oc = 1 exit}
  if global.box14oc = 0 {x = obj_box_14.x y = obj_box_14.y global.box14oc = 1 exit}
  if global.box15oc = 0 {x = obj_box_15.x y = obj_box_15.y global.box15oc = 1 exit}
  if global.box16oc = 0 {x = obj_box_16.x y = obj_box_16.y global.box16oc = 1 exit}
  if global.box17oc = 0 {x = obj_box_17.x y = obj_box_17.y global.box17oc = 1 exit}
  if global.box18oc = 0 {x = obj_box_18.x y = obj_box_18.y global.box18oc = 1 exit}
  if global.box19oc = 0 {x = obj_box_19.x y = obj_box_19.y global.box19oc = 1 exit}
  if global.box20oc = 0 {x = obj_box_20.x y = obj_box_20.y global.box20oc = 1 exit}



Create Event >> Step >> Step >> execute code

if go = 1 {x = mouse_x y = mouse_y} else {exit}


Create Event >> Mouse Event >> Left Pressed >> execute code

go = 1


Create Event >> Mouse Event >> Glob Left Released  >> execute code

if go = 1 if distance_to_object(obj_box_basic)<1
{
if go = 1 {if distance_to_object(obj_box_1)<1 {if global.box1oc = 0 {go = 0 y = obj_box_1.y x = obj_box_1.x global.box1oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_2)<1 {if global.box2oc = 0 {go = 0 y = obj_box_2.y x = obj_box_2.x global.box2oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_3)<1 {if global.box3oc = 0 {go = 0 y = obj_box_3.y x = obj_box_3.x global.box3oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_4)<1 {if global.box4oc = 0 {go = 0 y = obj_box_4.y x = obj_box_4.x global.box4oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_5)<1 {if global.box5oc = 0 {go = 0 y = obj_box_5.y x = obj_box_5.x global.box5oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_6)<1 {if global.box6oc = 0 {go = 0 y = obj_box_6.y x = obj_box_6.x global.box6oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_7)<1 {if global.box7oc = 0 {go = 0 y = obj_box_7.y x = obj_box_7.x global.box7oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_8)<1 {if global.box8oc = 0 {go = 0 y = obj_box_8.y x = obj_box_8.x global.box8oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_9)<1 {if global.box9oc = 0 {go = 0 y = obj_box_9.y x = obj_box_9.x global.box9oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_10)<1 {if global.box10oc = 0 {go = 0 y = obj_box_10.y x = obj_box_10.x global.box10oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_11)<1 {if global.box11oc = 0 {go = 0 y = obj_box_11.y x = obj_box_11.x global.box11oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_12)<1 {if global.box12oc = 0 {go = 0 y = obj_box_12.y x = obj_box_12.x global.box12oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_13)<1 {if global.box13oc = 0 {go = 0 y = obj_box_13.y x = obj_box_13.x global.box13oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_14)<1 {if global.box14oc = 0 {go = 0 y = obj_box_14.y x = obj_box_14.x global.box14oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_15)<1 {if global.box15oc = 0 {go = 0 y = obj_box_15.y x = obj_box_15.x global.box15oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_16)<1 {if global.box16oc = 0 {go = 0 y = obj_box_16.y x = obj_box_16.x global.box16oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_17)<1 {if global.box17oc = 0 {go = 0 y = obj_box_17.y x = obj_box_17.x global.box17oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_18)<1 {if global.box18oc = 0 {go = 0 y = obj_box_18.y x = obj_box_18.x global.box18oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_19)<1 {if global.box19oc = 0 {go = 0 y = obj_box_19.y x = obj_box_19.x global.box19oc = 1 exit}}}

if go = 1 {if distance_to_object(obj_box_20)<1 {if global.box20oc = 0 {go = 0 y = obj_box_20.y x = obj_box_20.x global.box20oc = 1 exit}}}
}

else
{
go = 0 x = 320 y = 240instance_change(obj_knife_pick_up,1)
}

18. obj_knife_pick_up

Sprite: spr_knife
Solid: false
Visible: true
Depth: -1
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event >> Mouse Event >> Left Pressed >> execute code

instance_change(obj_knife_inventory,1) exit

1) Room
Buatlah room yang bernama rm_1
dan Buatlah objeck dan background di rm_1 sesuai gambar dibawah ini


lalu klik tombol F5 atau F6



Tidak ada komentar :

Posting Komentar