|
|
keymapping issue?
#272611
06/18/09 22:59
06/18/09 22:59
|
Joined: May 2009
Posts: 19 Oklahoma, USA
Zodiac
OP
Newbie
|
OP
Newbie
Joined: May 2009
Posts: 19
Oklahoma, USA
|
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.
If everything seems to be going well, you have obviously overlooked something.
|
|
|
Re: keymapping issue?
[Re: Zodiac]
#272615
06/18/09 23:32
06/18/09 23:32
|
Joined: Oct 2007
Posts: 5,211 İstanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
|
if(p_blocka.pos_y>1 && p_blocka.pos_y<578 && key_a){ score_keeper();}
3333333333
|
|
|
Re: keymapping issue?
[Re: Quad]
#272634
06/19/09 02:24
06/19/09 02:24
|
Joined: May 2009
Posts: 19 Oklahoma, USA
Zodiac
OP
Newbie
|
OP
Newbie
Joined: May 2009
Posts: 19
Oklahoma, USA
|
Perfect!
Thanks Quadraxas, it works great now.
If everything seems to be going well, you have obviously overlooked something.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|
|
|