C
Cmi
Guest
So when ever I click on my keyboard letter like 'A' it is delayed and I have to click it multiple times. I have tried it with release and pressed. I think my problem may be that I am spawning to many objects. How can I fix that.
My code for my spawner:
My code for objects that I want to spawn (This code is in all the objects I spawn only thing is the letter changes):
I have tried changing the pressed to release but nothing is being solved.
My code for my spawner:
Code:
Create Event:
execute code:
/** Wait 1 seconds and than trigger the alarm * As the room speed is 30
a second = 30 in the alarm code. 30 = 1s
*/
// Call alarm 0 every 1 second
alarm [0] = 30;
// Global boolean expression to control the letters from spawning each other
global.letterSpawn = true;
Alarm Event for alarm 0:
execute code:
// Call alarm 1
//alarm [1] = 30;
// Change was made nov 22 2016
// Goal make it spawn faster
alarm [1] = 20;
Alarm Event for alarm 1:
execute code:
// Randomize the spawn
randomize();
// Global variable to pick which spawns
global.spawn = irandom_range(1, 10);
// Spawn the letters if global.spawn equals there number
if (global.spawn == 1){
instance_create(32 + irandom(544), 64 + irandom(352),obj_a);
// Randomize the spawn
randomize();
} else if (global.spawn == 2){
instance_create(32 + irandom(544), 64 + irandom(352),obj_b);
// Randomize the spawn
randomize();
} else if (global.spawn == 3){
instance_create(32 + irandom(544), 64 + irandom(352),obj_c);
// Randomize the spawn
randomize();
}else if (global.spawn == 4){
instance_create(32 + irandom(544), 64 + irandom(352),obj_d);
// Randomize the spawn
randomize();
}else if (global.spawn == 5){
instance_create(32 + irandom(544), 64 + irandom(352),obj_e);
// Randomize the spawn
randomize();
}else if (global.spawn == 6){
instance_create(32 + irandom(544), 64 + irandom(352),obj_f);
// Randomize the spawn
randomize();
}else if (global.spawn == 7){
instance_create(32 + irandom(544), 64 + irandom(352),obj_h);
// Randomize the spawn
randomize();
}else if (global.spawn == 8){
instance_create(32 + irandom(544), 64 + irandom(352),obj_i);
// Randomize the spawn
randomize();
}else if (global.spawn == 9){
instance_create(32 + irandom(544), 64 + irandom(352),obj_j);
// Randomize the spawn
randomize();
}
scr_spawn();
// Call alarm 0 to repeat it's self
alarm [0] = 1;
Code:
Create Event:
execute code:
// Set image speed to 0
image_speed = 2;
//total = 0;
// This will add anywhere between 1 and 5, an integer value, to the total.
total = irandom_range(1, 5);
// Check if total is equal to 1
if (total = 1){
// Change the image index to 1
image_index = 1;
// Set the image speed to 0
image_speed = 0;
} else if (total = 2){
// Change the image index to 2
image_index = 2;
// Set the image speed to 0
image_speed = 0;
} else if (total = 3){
// Change the image index to 3
image_index = 3;
// Set the image speed to 0
image_speed = 0;
}else if (total = 4){
// Change the image index to 4
image_index = 4;
// Set the image speed to 0
image_speed = 0;
}else if (total = 5){
// Change the image index to 5
image_index = 5;
// Set the image speed to 0
image_speed = 0;
}
Step Event:
execute code:
// If 'D' is pressed
if keyboard_check_pressed(ord('D')) {
// Add 1 to the score
global.score_1 ++;
//It clears the keyboard entres
io_clear();
// Destroy the object
instance_destroy();
}
// Set global.letterSpawn equal false
if (global.letterSpawn == false){
// Destory the object
instance_destroy();
// Add 1 to the left score
global.left ++;
}