ludum-dare-42/objects/obj_mola/Step_0.gml

43 lines
1.4 KiB
Plaintext

//actions
if ( ( keyboard_check(vk_up) ) || ( keyboard_check(vk_down) ) || ( keyboard_check(vk_right) ) || ( keyboard_check(vk_left) ) ) {
var mov_x = keyboard_check(vk_right) - keyboard_check(vk_left);
var mov_y = keyboard_check(vk_down) - keyboard_check(vk_up);
if ( ( place_meeting( x+(5*mov_x), y, obj_water) ) && ( !place_meeting( x+(5*mov_x), y, obj_barrier) ) ) {
x += lengthdir_x( 5, point_direction( x, y, x+mov_x, y+mov_y ) );
}
if ( (place_meeting( x, y+(5*mov_y), obj_water) ) && ( !place_meeting( x, y+(5*mov_y), obj_barrier) ) ) {
y += lengthdir_y( 5, point_direction( x, y, x+mov_x, y+mov_y ) );
}
}
if ( keyboard_check(ord("C")) ) {
if (shotwait <= 0) {
for ( i=0; i<7; i++ ) {
var bullet = instance_create(x,y,obj_spray)
with (bullet) {
speed = 35;
direction = 90 - 21 + (other.i * 7);
image_angle = direction;
}
}
shotwait = 3;
if ( obj_water.image_yscale > 1 ) {
with (obj_water) {
image_yscale -= 0.1;
}
if ( !place_meeting( x, y+3.2, obj_barrier) ) {
y += 3.2;
}
}
}
shotwait -= 1;
}
//upkeeps
if ( obj_water.image_yscale < 12 ) {
with (obj_water) {
image_yscale += 0.005;
}
y -= 0.08;
}