1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
|
{
id: "ability",
collide_dimensions: ["~item"],
traction_in_air: 1000,
properties: {
event_name: "'ability_' + vars.kind + '_acquired'",
description: "def() switch(vars.kind,
'firebreath', speech_dialog([~You gained a new ability!~],[~You can now breathe out a\\nshort stream of intense flame.~],[~This has very little range, but is quite damaging.~],description_tail),
'energyshot', speech_dialog([~You gained a new ability!~],[~You can now fire balls of harmful\\nenergy from your fingertips.~],[~This has excellent range,\\nand does decent damage.~],description_tail),
'homingshot', speech_dialog([~You gained a new ability!~],[~You can now fire balls of harmful\\nenergy from your fingertips,\\nwhich home in on your enemies.~],[~These have excellent range and decent damage,\\nbut are somewhat draining to use.~],description_tail))",
description_tail: "[if(IPHONE_SYSTEM,~Tap the upper-left corner of the screen\\nto switch between abilities.~,~Press ${ATTACK_KEY} to switch between abilities.~)]",
do_color_flash: "def() [screen_flash([166,200,255,5],[5,6,0,20],13),
schedule(13,screen_flash([210,255,255,255],[0,0,0,0],2)),
schedule(13+2,screen_flash([166,200,255,255],[5,6,0,-20],5)),
schedule(13+8,screen_flash([166,200,255,155],[5,6,0,20],5)),
schedule(13+13,screen_flash([210,255,255,255],[0,0,0,0],2)),
schedule(13+15,screen_flash([255,255,255,255],[-3,-3,0,-3],250))]
",
},
on_create: "[ if(level.player.vars.stored_events[event_name] = 1, remove_object(me)),
add(variations, [vars.kind]),animation('normal'),add_particles('particles')]",
on_collide_object_item: "if(collide_with.is_player_body_part and vars.time_acquired = 0,[fire_event('acquired')])",
on_end_anim: "animation('normal')",
respawns: false,
on_acquired: "[
set(level.player.control_lock, []),
set(level.player.velocity_x,0),
set(level.player.velocity_y,max(0,level.player.velocity_y)),
schedule(50,set(level.player.animation, 'item_get_begin')),
set(vars.time_acquired,cycle),
set(alpha,0),
map(range(21), schedule(value, set(level.music_volume,1-(1.0*value)/20))),
map(range(21), schedule(180+value, set(level.music_volume, (1.0*value)/20))),
sound('SpecialItem2.ogg'),
set(level.zoom, 2),
schedule(40, fire_event('acquire_float')),
schedule(90, fire_event('force_loot_acquire')),
schedule(2,level.player.store_event(event_name,1)),
level.player.add_ability(self.vars.kind),
schedule(160, set(level.player.animation, 'item_get_end')),
schedule(200, [set(level.player.control_lock, null),set(level.zoom, 1),]),
schedule(210, die()),
schedule(40,description())
]",
on_acquire_float: "[set(alpha,255),set(midpoint_x,level.player.mid_x - 16*level.player.facing),set(midpoint_y,level.player.mid_y-60),set(velocity_y,-30),set(accel_y,00),set(zorder,50)]",
on_force_loot_acquire: "[set(alpha,0),do_color_flash(),spawn('silhouette_star.burst',mid_x,mid_y,1),map([0,0,0,0],spawn('coin_sparkle',midpoint_x + 1d40-20,midpoint_y + 1d40-20,0))]",
editor_info: {
category: "props",
var: [
{
name: "kind",
type: "enum",
value: "'firebreath'",
enum_values: "[firebreath,energyshot,homingshot]",
}],
},
vars: {
time_acquired: 0,
},
no_compile_image: "props/store-items.png",
variations: {
firebreath: "null",
energyshot: "[map(filter(doc.animation, value.rect = [1,196,17,211]), 'anim', set(anim.rect, [1,145,17,160]))]",
homingshot: "[map(filter(doc.animation, value.rect = [1,196,17,211]), 'anim', set(anim.rect, [1,213,17,228]))]",
},
animation: {
id: "normal",
image: "props/store-items.png",
frames: 6,
duration: 6,
rect: [1,196,17,211],
pad: 3,
scale: 3,
//item_area: all,
},
particle_system: {
id: "particles",
type: "simple",
min_y: -10,
max_y: 30,
min_x: -10,
max_x: 30,
spawn_rate: 10,
time_to_live: 18,
animation: [
{
id: "sparkle",
image: "props/items.png",
rect: [139,88,149,98],
frames: 4,
pad: 3,
duration: 6,
},
{
#
#same thing, but skip the first frame
id: "sparkle",
image: "props/items.png",
rect: [153,88,163,98],
frames: 3,
pad: 3,
duration: 4,
},
{
#
#same thing, but skip the first 2 frames
id: "sparkle",
image: "props/items.png",
rect: [167,88,177,98],
frames: 2,
pad: 3,
duration: 6,
},
],
},
}
|