Este es el codigo del objeto principal:
CitarInformation about object: obj_character
Sprite: spr_right
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>
Create Event:
set variable ammo to 0
Step Event:
COMMENT: Check whether in the air
if relative position (0,1) is collision free for Only solid objects
set the gravity to 0.5 in direction 270
else
set the gravity to 0 in direction 270
COMMENT: Limit the vertical speed
if vspeed is larger than 12
set variable vspeed to 12
COMMENT: Check whether on a ladder
if at relative position (0,0) there is object obj_ladder
set the gravity to 0 in direction 270
set variable vspeed to 0
set the sprite to spr_climbing with subimage 0 and speed 1
Collision Event with object obj_block:
move in direction direction at most 12 till a contact with solid objects
set the vertical speed to 0
Collision Event with object obj_monster:
if expression vspeed > 0 && y < other.y+8 is true
COMMENT: Destroy the monster
play sound snd_killmonser; looping: false
set the score relative to 50
for other object: start moving in directions 000010000 with speed set to 0
for other object: change the instance into object obj_monster_dead, yes performing events
else
COMMENT: Destroy the character
play sound snd_killcharacter; looping: false
sleep 1000 milliseconds; redrawing the screen: true
set the number of lives relative to -1
restart the current room with transition effect <no effect>
Collision Event with object obj_flyer:
play sound snd_killcharacter; looping: false
sleep 1000 milliseconds; redrawing the screen: true
set the number of lives relative to -1
restart the current room with transition effect <no effect>
Collision Event with object obj_mushroom:
play sound snd_getmushroom; looping: false
set the score relative to 1
for other object: destroy the instance
Collision Event with object obj_levelexit:
play sound snd_finishlevel; looping: false
sleep 1000 milliseconds; redrawing the screen: true
if next room exists
go to next room with transition effect <no effect>
else
show the highscore table
background: back_sky
show the border
new color: 255, other color: 0
Font: Arial,12,0,1,0,0,0
restart the game
Collision Event with object obj_death:
play sound snd_killcharacter; looping: false
sleep 1000 milliseconds; redrawing the screen: true
set the number of lives relative to -1
restart the current room with transition effect <no effect>
Collision Event with object obj_ammunition:
set variable ammo relative to 10
for other object: destroy the instance
Collision Event with object obj_bonus:
play sound snd_finishlevel; looping: false
set the number of lives relative to 1
for other object: destroy the instance
Keyboard Event for <Left> Key:
set the sprite to spr_left with subimage 0 and speed 1
if relative position (-4,0) is collision free for Only solid objects
jump relative to position (-4,0)
else
if relative position (-4,-8) is collision free for Only solid objects
jump relative to position (-4,-8)
move in direction 270 at most 8 till a contact with solid objects
Keyboard Event for <Up> Key:
if at relative position (0,0) there is object obj_ladder
if relative position (0,-3) is collision free for Only solid objects
jump relative to position (0,-3)
else
if relative position (0,1) gives a collision with Only solid objects
set the vertical speed to -10
Keyboard Event for <Right> Key:
set the sprite to spr_right with subimage 0 and speed 1
if relative position (4,0) is collision free for Only solid objects
jump relative to position (4,0)
else
if relative position (4,-8) is collision free for Only solid objects
jump relative to position (4,-8)
move in direction 270 at most 8 till a contact with solid objects
Keyboard Event for <Down> Key:
if at relative position (0,0) there is object obj_ladder
if relative position (0,3) is collision free for Only solid objects
jump relative to position (0,3)
Other Event: Outside Room:
if y is larger than room_height
play sound snd_killcharacter; looping: false
sleep 1000 milliseconds; redrawing the screen: true
restart the current room with transition effect <no effect>
Key Press Event for <Space> Key:
if ammo is larger than 0
if sprite_index is equal to spr_left
create instance of object obj_bullet at relative position (0,0) with speed 12 in direction 180
if sprite_index is equal to spr_right
create instance of object obj_bullet at relative position (0,0) with speed 12 in direction 0
set variable ammo relative to -1