Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Robot Movement

  1. #1
    Newbie Newbie
    Join Date
    Nov 2012
    Posts
    1

    Robot Movement

    Hi,

    I am new to the OpenGL world. I want my robot to move right and left.

    It should move Right I press some key say (R) -->Right
    It should move Left if I press (L)
    I have been trying to do the code but it doesn't work. Have a look at my code and tell me what's wrong with it

    if (Keyboard.isKeyDown(Keyboard.KEY_R)) {
    moveRobotRight += 0.1*getAnimationScale();
    }

    else if (Keyboard.isKeyDown(Keyboard.KEY_L)) {
    moveRobotLeft -= 0.1*getAnimationScale();
    }

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,117
    We need more code - show us how you update the robot's location

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •