I'm really new to this so try not to get annoyed with me right off the bat.
I'm trying to write a function that runs once when I press the 'a' key, but only once and only if the panel connected to it is between 1 and 578 on the y axis. I tried;
if(p_blocka.pos_y>1<578){on_a = score_keeper;}
but I seem to be way off there since it did nothing. Currently the function will run whenever I hit the 'a' after it has been called once, even if the panel isn't on screen.
What is the correct way to set this up? Here is the complete function as well as the one it calls so you can see if I've made errors there that are messing me up.
function score_keeper()
{
score +=5;
correct+=1;
if(correct==10){level_swap2();}
}
///////////////////////////////////////////////
function dropblock_a()
{
p_blocka.pos_x = random(559);
while (p_blocka.pos_y < 580)
{
p_blocka.pos_y += speed;
wait(5);
on_a = score_keeper;/// ///////Issue
if(key_a==1){break;}
if(p_blocka.pos_y>579){missed_block();}
}
p_blocka.pos_y = -95;
wait (1);
roller =1;
}
Any suggestions are greatly appreciated.