1{ 2id: "ct-cursor-map", 3prototype: ["player_input"], 4is_human: true, 5zorder: 5, 6 7properties: { 8 cdim: "list_single_divide(level.camera_position[2:4], 2)", 9 }, 10 11vars: { 12 saved_maps: {}, 13 ff: false, 14 }, 15 16consts: { 17 mapSize: ["@eval 2668/2","@eval 1742/2"], 18 edit_mode: 0, 19 }, 20 21on_load: "[ 22 if(can_load_game() and (not vars.game_started or consts.edit_mode), 23 [load_game('instant'),], //Remember to set vars.game_started to 0 in titlescreen.cfg. 24 [fire_event('enter_level'), 25 if(not consts.edit_mode, set(alpha, 0)), 26 ]), 27 ]", 28 29on_ctrl_tongue: "if(consts.edit_mode, 30 spawn( 'ct-map-marker', 31 midpoint_x, midpoint_y, 1, 32 [set(child.vars.reference_anchor, [midpoint_x,midpoint_y]), 33 set(child.vars.anchorPoint, 5), 34 ]))", 35 36on_process: "[proto_event('player_input', 'process'), 37 if(ctrl_right, set(midpoint_x, constrain(0+margin, midpoint_x+velocity, consts.mapSize[0]-margin))), 38 if(ctrl_left, set(midpoint_x, constrain(0+margin, midpoint_x-velocity, consts.mapSize[0]-margin))), 39 if(ctrl_up, set(midpoint_y, constrain(0+margin, midpoint_y-velocity, consts.mapSize[1]-margin))), 40 if(ctrl_down, set(midpoint_y, constrain(0+margin, midpoint_y+velocity, consts.mapSize[1]-margin))), 41 set(level.lock_screen, [ constrain(0+cdim[0], level.player.midpoint_x, consts.mapSize[0]-cdim[0]), #These 'magic' numbers here are the large bounds of the map object. The map graphic starts at [0,0] and goes to [1334,871].# 42 constrain(0+cdim[1], level.player.midpoint_y, consts.mapSize[1]-cdim[1])]), 43 ] where velocity = 25 44 where margin = img_h+10", 45 46on_enter_level: "[ 47 set(tmp.playing_music, true), 48 if(not tmp.playing_music, music_onetime('TrainSongSlowerTempo.ogg')), 49 transform(level.chars, if(v.vars.is_widget or v.type = 'ct-map-marker.line', remove_object(v))), 50 transform(unique(vars.widgets), transform([v] + v.vars.targets, [add_object(v), fire_event(v, 'enter_level')])), 51 schedule(2, transform(unique(vars.widgets), [fire_event(v, 'enter_level')])), 52 schedule(2, fire_event('done_enter_level')), 53 set(vars.game_started, 1), 54 ]", 55 56on_done_enter_level: "schedule(3, [ 57 save_game(), 58 if(not find(filter(level.chars, value.type = 'ct-map-marker'), value.animation != 'green') or won_game, [ 59 set(won_game, true), 60 fire_event('roll_credits'), 61 ]), 62 ])", 63 64on_ctrl_jump: "fire_event('roll_credits')", 65 66on_roll_credits: "[ 67 map(level.chars, set(value.vars.button_disabled, true)), 68 spawn('ct-credits-whiteness', 0, 0, 1, [ 69 set(child.alpha, 0), 70 set(child.event_handlers.end_credits, 'die()'), 71 set(child.event_handlers.process, 'add(alpha, 5)'), ]), 72 schedule(60, [ 73 spawn('ct-credits-whiteness', 0, 0, 1, [ 74 set(child.animation, 'grey'), 75 set(child.zorder, 21), 76 schedule(ff or blink_time, [ 77 set(child.alpha, 0), 78 schedule((ff or wait_time)+1, remove_object(child)), 79 spawn('ct-credits-ct-logo', level.camera_position[2]/2, level.camera_position[3]/3-17, 1, [ 80 set(child.event_handlers.end_credits, 'die()'), 81 set(child.id_str, 'credits-logo'), 82 ]), 83 schedule(ff or wait_time, [ 84 spawn('ct-credits-whiteness', 0, 0, 1, [ 85 set(child.zorder, 21), 86 set(child.animation, 'grey'), 87 schedule(ff or blink_time, [ 88 set(child.alpha, 0), 89 set(child.event_handlers.end_credits, 'die()'), 90 spawn('text_controller', level.camera_position[2]/2, level.camera_position[3]/3+120, 1, [ 91 set(child.use_absolute_screen_coordinates, true), 92 set(child.id_str, 'byline'), 93 child.set_text({'text':'A David D. Roberts Game', align:'center', size:1})]), 94 schedule(ff or wait_time, [ 95 map(range(size(credit_list)), schedule(ff or 130*value, movingText(credit_list[value]))) // #credit-timing 96 where credit_list = [ ['Music', 'Ryan Reilly (Rain)'], 97 ['Foley', 'Adam Rinsky (ActionJack)'], 98 ['Core Engine Improvement', 'David White (Sirp)'], 99 ['General Engine Improvement', 'Kristina Simpson (Krista^)'], 100 ['Testing + Consulting', 'Richard Kettering (Jetrel)'], 101 ['Anura game engine from', 'Frogatto and Friends'], ], 102 ]), 103 set(child.event_handlers.end_credits, 'die()'), 104 schedule(ff or 830, [ // #credit-timing 105 movingText(['', 'Thanks, everyone!']), 106 schedule(ff or 190, [ // #credit-timing 107 movingText(['And you--', 'Thanks for playing.']), 108 schedule(ff or 160, /* #credit-timing */ ([// eval(q[ //Can't get spawned objects from above here. So, we'll just make a second event... not 'good' programming, but it's not worth the effort to go back and fix things to be the way they should be. 109 fire_event(self, 'roll_more_credits') 110 ])), 111 ]), 112 ]), 113 ]) where movingText = def(texts) [ 114 spawn('text_controller', level.camera_position[2]/2-75, level.camera_position[3]/1.5-10, 1, [ 115 common_commands(child), 116 child.set_text({'text':texts[0], size:1})]), 117 spawn('text_controller', level.camera_position[2]/2-55, level.camera_position[3]/1.5+10, 1, [ 118 common_commands(child), 119 child.set_text({'text':texts[1]})]), 120 ] where common_commands = def(child) [ 121 schedule(display_duration, remove_object(child)), 122 set(child.use_absolute_screen_coordinates, true), 123 map(range(display_duration), 'frame', 124 schedule(frame, [ 125 set(child.text_alpha, 126 constrain(0, 500*sin(tween(0,180, frame/decimal(display_duration))), 255)), 127 set(child.x, (child.x + 128 if(frame < display_duration/2, 129 max(tween_in, middle), 130 min(tween_out, middle)) - domain/2 131 where tween_in = tween(0, domain, sin(frame/decimal(display_duration)*180) ) + 25 132 where tween_out = tween(0, domain, 1-sin(frame/decimal(display_duration)*180) ) - 25 133 where middle = tween(0+15, domain-15, frame/decimal(display_duration) ) 134 )), 135 ])), 136 ] where display_duration = 140 // #credit-timing 137 where domain = 200, 138 ]), 139 ]), 140 ]), 141 ]), 142 ]), 143 ] where 144 blink_time = 9, 145 wait_time = 17, 146 text_display = 40", 147 148on_roll_more_credits: "[ 149 map(range(80), schedule(value, set(obj.y, obj.y-value)) where obj = find(level.chars, value.id_str = 'credits-logo')), 150 map(range(50), schedule(value, set(obj.text_alpha, obj.text_alpha - value*5)) where obj = find(level.chars, value.id_str = 'byline')), 151 schedule(51, [ 152 remove_object(find(level.chars, value.id_str = 'byline')), 153 spawn('text_controller', level.camera_position[2]/2, level.camera_position[3]/2, 1, [ 154 set(child.use_absolute_screen_coordinates, true), 155 set(child.event_handlers.remove_final_score, 'die()'), 156 child.set_text({'text':'Your final score is:', align:'center', size:2})]), 157 schedule(ff or 40, [ 158 spawn('text_controller', level.camera_position[2]/2, level.camera_position[3]/2+30, 1, [ 159 set(child.use_absolute_screen_coordinates, true), 160 set(child.event_handlers.remove_final_score, 'die()'), 161 child.set_text({'text': sum(map(filter(level.chars, value.type = 'ct-map-marker' and not value.vars.level in ['editor', 'player']), value.vars.targetData.score)), align:'center', size:6})]), 162 schedule(40, [ 163 spawn('ct-button-return', level.camera_position[2]/2, level.camera_position[3]-125, 1, [ 164 set(child.event_handlers.remove_final_score, 'die()'), 165 set(child.event_handlers.mouse_over, q([proto_event('ct-button-nav', 'mouse_over'), swallow_event()])), 166 set(child.event_handlers.mouse_not_over, q([proto_event('ct-button-nav', 'mouse_not_over'), swallow_event()])), 167 set(child.vars.action, fire_event(self, 'done_credits')), 168 set(child.event_handlers.create, 'swallow_event()'), 169 set(child.event_handlers.first_cycle, 'swallow_event()'), ]), 170 ]), 171 ]), 172 ]), 173 ]", 174 175on_done_credits: "map(level.chars, [ 176 fire_event(value, 'remove_final_score'), 177 fire_event(value, 'end_credits'), 178 set(value.vars.button_disabled, null), 179 ])", 180 181animation: [ 182 { 183 scale: 1, 184 185 "@base": true, 186 187 188 189 190 }, 191 { 192 "id": "normal", 193 "image": "effects/particles.png", 194 "rect": [23,197,49,224] 195 }, 196], 197}