Advertisement

hold down key>one rotation

Started by April 26, 2002 08:38 PM
1 comment, last by edwinnie 22 years, 8 months ago
still in the tetris clonie making currently, my block seems to rotate many times if a key is pressed down. if there a way that if i hold down the key, the object will only rotate once, and not many times? the is the code i currently use> //global bool rotr = false; //part of rotation code
  
if (!keyboard_state[DIK_PRIOR])       //PAGE UP

    rotr = false;

    if (keyboard_state[DIK_PRIOR] && !rotr)
    {
    Rotate_Right();
  

    if (!keyboard_state[DIK_PRIOR])       //PAGE UP    rotr = false;if (keyboard_state[DIK_PRIOR] && !rotr){    Rotate_Right();    // Set rotr to true within this if statement, so that it will    //  only be executed once until the page up key is released..    rotr = true;}  

Advertisement
thx!!

This topic is closed to new replies.

Advertisement