sSwitchPlatfrm
0
-1
-5
0
Wall
<undefined>
1
603
7
0
0
-1
2
self
0
0
1
///Initialize
image_speed = 0;
angle = 0;
sparks = ds_list_create();
moved = false;
1
603
7
0
0
-1
2
self
0
0
1
///Toggle the switch
if(place_meeting(x, y - 1, Player)) {
if(Mobile) {
with(Controller) {
virtual_key_delete(virt_key_down);
virt_key_down = virtual_key_add(other.x - view_xview[0], other.y - view_yview[0], other.sprite_width, other.sprite_height, vk_down);
}
}
if(input_check_pressed(I_ACTION)) {
image_index = !image_index;
audio_play_sound(aSwitch, 0, false);
ds_list_clear(sparks);
state_set(S_ENTERCAVE);
state_set(S_LIFT);
}
} else if(image_index != 0) {
audio_play_sound(aSwitch, 0, false);
image_index = 0;
}
1
603
7
0
0
-1
2
self
0
0
1
///Move
if(Controller.colours[GREEN] && Controller.colours[RED]) {
if(image_index) {
if(y > high) {
while(place_meeting(x, y - 4, Player)) {
var go = false;
with(Player) {
if(!place_meeting(x, y - 1, Wall)) {
go = true;
}
}
if(go) {
Player.y--;
} else {
break;
}
}
if(!place_meeting(x, y - 4, Player)) {
y -= 4;
if(y == high) {
audio_play_sound(aLand, 0, false);
}
} else {
image_index = !image_index;
}
}
} else if(y < ystart) {
if(collision_rectangle(x, y, x + sprite_width, ystart, Player, false, true) == noone) {
y += 4;
if(y == ystart) {
audio_play_sound(aLand, 0, false);
}
if(place_meeting(x, y - 4 - 1, Player)) {
with(Player) {
while(!place_meeting(x, y + 1, Wall)) y++;
}
}
}
}
}
1
603
7
0
0
-1
2
self
0
0
1
///Generate sparks
if(ds_exists(sparks, ds_type_list)) {
ds_list_insert(sparks, 0, irandom_range(0, 64));
if(ds_list_size(sparks) > 8) {
ds_list_delete(sparks, 8);
}
}
1
603
7
0
0
-1
2
self
0
0
1
///Destroy the sparks list
if(ds_exists(sparks, ds_type_list)) {
ds_list_destroy(sparks);
}
1
603
7
0
0
-1
2
self
0
0
1
///Prevent ineritance
1
603
7
0
0
-1
2
self
0
0
1
///Draw controls when touching the player
angle = (angle + 8) % 360;
if(place_meeting(x, y - 1, Player)) {
draw_set_color(image_blend);
draw_set_font(fControls);
draw_set_halign(fa_center);
draw_text(x - view_xview[0] + 32, y - view_yview[0] - 64 + floor(sin(degtorad(angle)) * 5), DOWN_CHAR);
draw_set_halign(fa_left);
}
1
603
7
0
0
-1
2
self
0
0
1
///Blend in with the floor
inst = instance_position(x, ystart + 17, Wall);
if(inst != noone) {
image_blend = inst.image_blend;
}
1
603
7
0
0
-1
2
self
0
0
1
///Draw sparks
if(ds_exists(sparks, ds_type_list)) {
if(Controller.colours[GREEN] && Controller.colours[RED]) {
if(y > high && y < ystart) {
draw_set_color(image_blend);
var dir = 1;
if(image_index == 1) {
dir = -1;
}
for(var i = 0; i < ds_list_size(sparks); i++) {
var yy = y - i * dir * 4 + 16 * image_index;
if(yy == median(yy, high, ystart)) {
draw_point(x + sparks[| i], yy);
}
}
}
}
}
1
603
7
0
0
-1
2
self
0
0
1
///Draw the dot
draw_self();
if(Controller.colours[GREEN]) {
if(image_index) {
draw_set_color(c_green);
} else {
draw_set_color(c_red);
}
} else {
draw_set_color(c_red);
}
if(Controller.colours[RED]) {
draw_circle(x + 32, y, 2, false);
}
0
0
0
0.5
0.100000001490116
0
0.100000001490116
0.100000001490116
0.200000002980232
-1
0
0,16
32,32