Information about object: obj_head
Sprite: spr_head
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask: spr_body
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask: spr_body
No Physics Object
Create Event:
execute code: x = 240 y = 450 move_snap(16,16) dir = 90 direction = 90 speed = 4 image_single = 1 dsx = ds_list_create() dsy = ds_list_create() dsd = ds_list_create() global.tails = 1 step = 0
Step Event:
execute code:
if y mod 16 = 0 && x mod 16 = 0 {
dir2 = direction + 180
if dir2 >= 360 { dir2 -= 360 }
if dir != direction && dir != dir2 {
direction = dir
image_single = direction / 90
}
ds_list_add(dsd,direction)
ds_list_add(dsx,x)
ds_list_add(dsy,y)
step += 1
}
score = global.tails - 1
Collision Event with object obj_body:
execute code:
eaten = other.step
//show_message(string(step - eaten))
//if eaten <= step - 2 { exit }
with obj_body { if step <= obj_head.eaten { instance_destroy() } }
Collision Event with object obj_wall:
execute code: game_restart()
Other Event: Intersect Boundary:
execute code: game_restart()
Other Event: Game End:
execute code: ds_list_destroy(dsd) ds_list_destroy(dsx) ds_list_destroy(dsy)
Key Press Event for <Enter> Key:
execute code:
show_message("Game Paused. Press ok or hit enter again to resume")
Key Press Event for <Left> Key:
execute code: dir = 180
Key Press Event for <Up> Key:
execute code: dir = 90
Key Press Event for <Right> Key:
execute code: dir = 0
Key Press Event for <Down> Key:
execute code: dir = 270
Information about object: obj_bodySprite: spr_body
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask: No Physics ObjectCreate Event:execute code: global.tails += 1 step = obj_head.step - global.tails x = ds_list_find_value(obj_head.dsx,step) y = ds_list_find_value(obj_head.dsy,step) direction = ds_list_find_value(obj_head.dsd,step) speed = obj_head.speedDestroy Event:execute code: instance_create(x,y,obj_deadtail) global.tails -= 1Step Event:execute code: if place_snapped(16,16) { direction = ds_list_find_value(obj_head.dsd,step) step += 1 }Information about object: obj_wallSprite: spr_wall
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask: No Physics ObjectInformation about object: obj_itemSprite: spr_item
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask: No Physics ObjectCreate Event:execute code: x = 0 y = 0 xx = x yy = y while !place_empty(xx,yy) { xx = floor((random(room_width - 32) + 16) / 16) * 16 yy = floor((random(room_height - 32) + 16) / 16) * 16 } x = xx y = yyCollision Event with object obj_head:execute code: instance_create(x,y,obj_body) xx = x yy = y while !place_empty(xx,yy) { xx = floor((random(room_width - 32) + 16) / 16) * 16 yy = floor((random(room_height - 32) + 16) / 16) * 16 } x = xx y = yyInformation about object: obj_deadtailSprite: spr_deadtail
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask: No Physics ObjectOther Event: Animation End:execute code: instance_destroy()