Tuesday, October 28, 2008

Source Code "Lorong" :D

Lampiran 1
Source Code untuk object pada game Lorong:


Information about object: wall_corner

Sprite: sprite_wall_corner
Solid: true
Visible: true
Depth: 0
Persistent: false
Parent:
Mask:


Information about object: wall_horizontal

Sprite: sprite_wall_horizontal
Solid: true
Visible: true
Depth: 0
Persistent: false
Parent: wall_corner
Mask:


Information about object: wall_vertical

Sprite: sprite_wall_vertical
Solid: true
Visible: true
Depth: 0
Persistent: false
Parent: wall_corner
Mask:


Information about object: obj_goal

Sprite: sprite_goal
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Mask:

Collision Event with object obj_person:
set the score relative to 40
play sound sound_goal; looping: false
sleep 1000 milliseconds; redrawing the screen: true
if next room exists
go to next room with transition effect
else
display message: Selamat anda telah menyelesaikan game Lorong ini! Terima kasih, pesan, kritik, saran dan kesan kirim ke email wiwienph@plasa.com
set the score relative to 250
show the highscore table
background: background_main
show the border
new color: 255, other color: 0
Font: Arial,12,0,1,0,0,0
restart the game



Information about object: obj_person

Sprite: sprite_person
Solid: false
Visible: true
Depth: -5
Persistent: false
Parent:
Mask:
Create Event:
set the sprite to sprite_person with subimage 0 and speed 0

Step Event:
if object is aligned with grid with cells of 32 by 8 pixels
if at relative position (0,0) there is object move_up
start moving in directions 000000010 with speed set to 8
if object is aligned with grid with cells of 32 by 8 pixels
if at relative position (0,0) there is object move_down
start moving in directions 010000000 with speed set to 8
if object is aligned with grid with cells of 8 by 32 pixels
if at relative position (0,0) there is object move_left
start moving in directions 000100000 with speed set to 8
if object is aligned with grid with cells of 8 by 32 pixels
if at relative position (0,0) there is object move_right
start moving in directions 000001000 with speed set to 8

Collision Event with object wall_corner:
start moving in directions 000010000 with speed set to 8

Collision Event with object monster_lr:
play sound sound_dead; looping: false
sleep 1000 milliseconds; redrawing the screen: true
set the number of lives relative to -1
restart the current room with transition effect

Collision Event with object monster_ud:
play sound sound_dead; looping: false
sleep 1000 milliseconds; redrawing the screen: true
set the number of lives relative to -1
restart the current room with transition effect

Collision Event with object monster_all:
if afraid is equal to 1
play sound sound_monster; looping: false
set the score relative to 50
for other object: jump to the start position
for other object: set Alarm 0 to 1
else
play sound sound_dead; looping: false
sleep 1000 milliseconds; redrawing the screen: true
set the number of lives relative to -1
restart the current room with transition effect

Collision Event with object block:
COMMENT: Do nothing, but notify it

Keyboard Event for Key:
if object is aligned with grid with cells of 32 by 32 pixels
start moving in directions 000010000 with speed set to 8

Keyboard Event for Key:
if object is aligned with grid with cells of 32 by 32 pixels
start moving in directions 000100000 with speed set to 4
set the sprite to sprite_person with subimage 3 and speed 0

Keyboard Event for Key:
if object is aligned with grid with cells of 32 by 32 pixels
start moving in directions 000000010 with speed set to 4
set the sprite to sprite_person with subimage 1 and speed 0

Keyboard Event for Key:
if object is aligned with grid with cells of 32 by 32 pixels
start moving in directions 000001000 with speed set to 4
set the sprite to sprite_person with subimage 2 and speed 0

Keyboard Event for Key:
if object is aligned with grid with cells of 32 by 32 pixels
start moving in directions 010000000 with speed set to 4
set the sprite to sprite_person with subimage 0 and speed 0



Information about object: obj_door

Sprite: sprite_door
Solid: true
Visible: true
Depth: 0
Persistent: false
Parent: wall_corner
Mask:

Step Event:
if number of objects obj_diamond is Equal to 0
play sound sound_door; looping: false
destroy the instance



Information about object: obj_diamond

Sprite: sprite_diamond
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Mask:

Destroy Event:
set the score relative to 5
play sound sound_diamond; looping: false

Collision Event with object obj_person:
destroy the instance



Information about object: controller_start

Sprite:
Solid: false
Visible: false
Depth: 0
Persistent: false
Parent:
Mask:

Create Event:
set the score to 0
set the information in the window caption:
don't show score with caption score:
don't show lives with caption lives:
don't show health with caption health:
set the number of lives to 3
play sound sound_background; looping: true

Keyboard Event for Key:
go to next room with transition effect




Information about object: controller_main

Sprite:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Mask:

Keyboard Event for N-key Key:
go to next room with transition effect

Keyboard Event for P-key Key:
go to previous room with transition effect

Keyboard Event for R-key Key:
play sound sound_dead; looping: false
set the number of lives relative to -1
restart the current room with transition effect

Other Event: No More Lives:
show the highscore table
background: background_main
show the border
new color: 255, other color: 0
Font: Arial,12,0,1,0,0,0
restart the game

Draw Event:
set the font for drawing text to score_font and align left
set the drawing color to 255
at relative position (300,4) draw the value of score with caption Score:
at relative position (8,4) draw text: Lives:
draw the lives relative at (70,4) with sprite sprite_lives




Information about object: monster_lr

Sprite: sprite_monster1
Solid: false
Visible: true
Depth: -10
Persistent: false
Parent:
Mask:

Create Event:
start moving in directions 000101000 with speed set to 32/6

End Step Event:
if hspeed is smaller than 0
set the sprite to sprite_monster1 with subimage 3 and speed 0
else
set the sprite to sprite_monster1 with subimage 2 and speed 0

Collision Event with object wall_corner:
reverse horizontal direction




Information about object: monster_ud

Sprite: sprite_monster2
Solid: false
Visible: true
Depth: -10
Persistent: false
Parent:
Mask:

Create Event:
start moving in directions 010000010 with speed set to 32/6

End Step Event:
if vspeed is smaller than 0
set the sprite to sprite_monster2 with subimage 1 and speed 0
else
set the sprite to sprite_monster2 with subimage 0 and speed 0

Collision Event with object wall_corner:
reverse vertical direction



Information about object: monster_all

Sprite: sprite_monster3
Solid: false
Visible: true
Depth: -10
Persistent: false
Parent:
Mask:

Create Event:
start moving in directions 010101010 with speed set to 32/6
set variable afraid to false
set variable image_speed to 0

Alarm Event for alarm 0:
set variable afraid to false
set the sprite to sprite_monster3 with subimage -1 and speed 0

Step Event:
if object is aligned with grid with cells of 32 by 32 pixels
with a chance of 1 out of 8 do perform the next action
start moving in directions 010101010 with speed set to 32/6

End Step Event:
if hspeed is smaller than -1
set variable image_index to 3
if hspeed is larger than 1
set variable image_index to 2
if vspeed is smaller than -1
set variable image_index to 1
if vspeed is larger than 1
set variable image_index to 0

Collision Event with object wall_corner:
set speed to 32/6 and direction to direction+90
if relative position (hspeed,vspeed) is collision free for Only solid objects
exit this event
set speed to 32/6 and direction to direction+180
if relative position (hspeed,vspeed) is collision free for Only solid objects
exit this event
set speed to 32/6 and direction to direction-90




Information about object: bomb

Sprite: sprite_bomb
Solid: false
Visible: true
Depth: 10
Persistent: false
Parent:
Mask:



Information about object: trigger

Sprite: sprite_trigger
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Mask:

Collision Event with object obj_person:
play sound sound_explode; looping: false
for all bomb: change the instance into object explosion, yes performing events
for all trigger: destroy the instance



Information about object: explosion

Sprite: sprite_explosion
Solid: false
Visible: true
Depth: -10
Persistent: false
Parent:
Mask:

Create Event:
move relative to position (-200,-200)
kill all instances at relative position (200-16,200-16)
kill all instances at relative position (200-16,200+16)
kill all instances at relative position (200-16,200+48)
kill all instances at relative position (200+16,200-16)
kill all instances at relative position (200+16,200+16)
kill all instances at relative position (200+16,200+48)
kill all instances at relative position (200+48,200-16)
kill all instances at relative position (200+48,200+16)
kill all instances at relative position (200+48,200+48)
move relative to position (200,200)

Other Event: Animation End:
destroy the instance




Information about object: block

Sprite: sprite_block
Solid: true
Visible: true
Depth: 0
Persistent: false
Parent: wall_corner
Mask:

Collision Event with object obj_person:
if relative position (8*other.hspeed,8*other.vspeed) is collision free for All objects
play sound sound_push; looping: false
move relative to position (8*other.hspeed,8*other.vspeed)
else
if at relative position (8*other.hspeed,8*other.vspeed) there is object hole
move relative to position (8*other.hspeed,8*other.vspeed)



Information about object: hole

Sprite: sprite_hole
Solid: true
Visible: true
Depth: 0
Persistent: false
Parent: wall_corner
Mask:

Collision Event with object block:
play sound sound_hole; looping: false
destroy the instance
for other object: destroy the instance



Information about object: bonus

Sprite: sprite_bonus
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Mask:

Collision Event with object obj_person:
set the score relative to 100
play sound sound_diamond; looping: false
destroy the instance




Information about object: heart

Sprite: sprite_heart
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Mask:

Collision Event with object obj_person:
set the number of lives relative to 1
play sound sound_life; looping: false
destroy the instance



Information about object: move_up

Sprite: sprite_up
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Mask:



Information about object: move_down

Sprite: sprite_down
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Mask:



Information about object: move_left

Sprite: sprite_left
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Mask:



Information about object: move_right

Sprite: sprite_right
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Mask:



Information about object: ring

Sprite: sprite_ring
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Mask:

Collision Event with object obj_person:
play sound sound_diamond; looping: false
destroy the instance
for all monster_all: set the sprite to sprite_monster_afraid with subimage -1 and speed 0
for all monster_all: set variable afraid to true
for all monster_all: set Alarm 0 to 300
set the score relative to 20

No comments: