Tratto da: Treasure – Written by Mark Overmars – Graphics by Matt Sandford – Sounds and music by Jacob Habgood.
Un clone di PACMAN presente nella cartella Examples di GameMaker 8.
Sviluppato ulteriormente nel libro ufficiale.
Se sei un principiante studia prima il tutorial DIAMONDS.
Se hai già un po’ d’esperienza crea le risorse elencate di seguito con le caratteristiche specificate
TIPO | NOME | FILE | |
---|---|---|---|
Sprites | spr_wall | wall_strip2.png | |
spr_treasure | treasure.png | ||
spr_expl_left | expl_left_strip4.png | ||
spr_expl_left | expl_right_strip4.png | ||
spr_expl_left | expl_up_strip4.png | ||
spr_expl_down | expl_down_strip4.png | ||
spr_monster | monster_strip4.png | ||
spr_scared | afraid_strip4.png | ||
spr_special | special.png | ||
spr_bonus | bonus.png | ||
Sounds | snd_beep | beep.wav | |
snd_dead | dead.wav | ||
snd_bonus | bonus.wav | ||
snd_won | won.wav | ||
snd_catch | catch.wav | ||
snd_music | music.mid | ||
Backgrounds | back_game | background.png | vedi dopo |
Scripts | script_direction | … | |
Objects | obj_wall | spr_wall | |
obj_point | spr_treasure | ||
obj_explorer | spr_expl_up | ||
obj_monster | spr_monster | ||
obj_scared | spr_scared | ||
obj_pil | spr_special | ||
obj_bonus | spr_bonus | ||
Room | room_0 room_1 … |
Imposta le proprietà dei livelli
obj_point
obj_pil
obj_wall
- Solid: on
Create
With chance 1 out of 20 perform next (sides: 20)
Change sprite into spr_wall (subimage: 1)
End of block
obj_explorer
- Depth: -1
Create
Game Start
Set the score to 0 (new score: 0)
Set the score caption info (show score: show, show lives: show)
Play sound snd_music (sound: snd_music, loop: true)
<Left>
Start moving in a direction (speed: 4)
Change sprite into spr_expl_left (sprite: spr_expl_left, subimage: -1, speed: 0.5)
End of block
<Up>
(x: 0, y: -4, sprite: spr_expl_up)
<Right>
(x: 4, y: 0, sprite: spr_expl_right)
<Down>
(x: 0, y: 4, sprite: spr_expl_down)
obj_wall
Set variable image_speed to 0 (variable: image_speed, value: 0)
Outside Room
obj_point
Play sound snd_beep (sound: snd_beep, loop: false)
Set the score relative to 10 (new score: 10, Relative: true)
Step
Play sound snd_won (sound: snd_won, loop: false)
Sleep 2000 milliseconds (milliseconds: 2000, redraw: true)
If next room exists
Go to next room
End of block
Else
Show the highscore table
Restart the game
End of block
End of block
obj_monster
Sleep 1500 milliseconds (milliseconds: 1500, redraw: true)
Jump to the start position (Object: obj_monster)
Jump to the start position (Object: obj_scared)
Start moving in a direction (speed: 0, Relative: off)
Set variable image_speed to 0 (variable: image_speed, value: 0)
Jump to the start position (Self: on)
Set lives relative to -1 (new lives: -1, Relative: true)
No More Lives
Restart the game
obj_pil
Destroy the instance (Applies to: Other)
Change instance into obj_monster (Object: obj_scared, change into: obj_monster, perform events:not)
Change instance into obj_scared (Object: obj_monster, change into: obj_scared, perform events: not)
Set Alarm 0 to 160 (Object: obj_scared, number of steps: 160, in alarm no: Alarm 0)
obj_scared
Jump to the start position (Other: on)
Change instance into obj_monster (Other: on, change into: obj_monster, perform events: not)
Set the score relative to 100 (new score: 100, Relative: on)
obj_monster
- Depth: -2
Create
Start moving in a direction (speed: 4)
Step
Execute script script_direction: (script: script_direction)
End of block
End Step
Set variable image_index to 2
End of block
Else
If direction is equal to 90
Set variable image_index to 3
End of block
Else
If direction is equal to 180
Set variable image_index to 0
End of block
Else
If direction is equal to 270
Set variable image_index to 1
End of block
obj_wall
Reverse vertical direction
Execute script script_direction: (script: script_direction)
Outside Room
obj_scared
- Parent: obj_monster
Alarm 0
Start moving in a direction (Directions: N-E-S-O, Speed: 4, Relative: off)
obj_bonus
Create
Set Alarm 0 to 500 (Self: on, number of steps: 500, in alarm no: Alarm 0)
Alarm 0
Set Alarm 1 to 200 (Self: on, number of steps: 200, in alarm no: Alarm 1)
Alarm 1
Set Alarm 0 to 500 (Self: on, number of steps: 500, in alarm no: Alarm 0)
explorer
Set the score relative to 200 (new score: 200, Relative: on)
Jump to position (-1000,0) (x: -1000, y: 0)
Set Alarm 0 to 500 (Self: on, number of steps: 500, in alarm no: Alarm 0)
script_direction
// This script adapts the direction of the monster // when it comes at a possible crossing { if (hspeed == 0) { if (random(3)<1 && place_free(x-4,y)) { hspeed = -4; vspeed = 0;} if (random(3)<1 && place_free(x+4,y)) { hspeed = 4; vspeed = 0;} } else { if (random(3)<1 && place_free(x,y-4)) { hspeed = 0; vspeed = -4;} if (random(3)<1 && place_free(x,y+4)) { hspeed = 0; vspeed = 4;} } }