1 Reply Latest reply on Jun 18, 2010 2:31 PM by kglad

    if statement question

    DanBenn

      For a game I am making I want to create an "if" statement that waits for the right arrow key to be pressed and for the global variable "movement" to equal 0. I used the code below:

       

      ...

      if (Key.isDown(Key.RIGHT) && (_global.movement = 0)) {

      ...

       

      When both those statements are true, I wanted the object to move to the left at the variable "speed". the entire code I used is below:

      ...

      if (Key.isDown(Key.RIGHT) && (_global.movement = 0)) {

      _x -= speed;

      }

      ...

       

      When the game is played I know that the "movement" equals 0 through the debugger tool, and when I press the right arrow key, the object does not move.

       

      What can I do to fix it?