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
|
{
id: "trophy",
on_create: "add_particles('particles')",
collide_dimensions: ["~item"],
traction_in_air: 1000,
properties: {
event_name: "'trophy_' + vars.kind + '_acquired'",
},
on_start_level: "[ if(level.player.vars.stored_events[event_name] = 1, remove_object(me)),
add(variations, [vars.kind]),animation('normal')]",
on_collide_object_item: "if(collide_with.is_player_body_part and vars.time_acquired = 0,[fire_event('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')) ])",
on_end_anim: "animation('normal')",
respawns: false,
on_acquired: "[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)),
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,speech_dialog([~You found a golden trophy!~],[~It has no special use, but hey - it's solid gold.\nThat can't be bad!~]))
]",
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),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: "'ant'",
enum_values: "ant,kitty,bunny,milgramblock,fumper,bat,fish,squirrel",
}],
},
vars: {
time_acquired: 0,
},
variations: {
ant: "null",
kitty: "[map(filter(doc.animation, value.rect = [0,0,31,31]), 'anim', set(anim.rect, [32,0,63,31]))]",
bunny: "[map(filter(doc.animation, value.rect = [0,0,31,31]), 'anim', set(anim.rect, [64,0,95,31]))]",
milgramblock: "[map(filter(doc.animation, value.rect = [0,0,31,31]), 'anim', set(anim.rect, [96,0,127,31]))]",
fumper: "[map(filter(doc.animation, value.rect = [0,0,31,31]), 'anim', set(anim.rect, [0,32,31,63]))]",
bat: "[map(filter(doc.animation, value.rect = [0,0,31,31]), 'anim', set(anim.rect, [32,32,63,63]))]",
fish: "[map(filter(doc.animation, value.rect = [0,0,31,31]), 'anim', set(anim.rect, [64,32,95,63]))]",
squirrel: "[map(filter(doc.animation, value.rect = [0,0,31,31]), 'anim', set(anim.rect, [96,32,127,63]))]",
},
animation: {
id: "normal",
image: "props/trophies.png",
rect: [0,0,31,31],
feet_x:16,
feet_y:32,
frames: 1,
duration: 8,
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,
},
],
},
}
|