Home Forums Software Development Move only on the X axe

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #3838

    I’m trying to create the game pong and I want to move a paddle only horizontally.
    For now it’s moveing anywere I’m looking on the screen.
    Can someone please give me an idea how can I achive that?

    I have the code here if you want to take a look:www.dropbox.com/s/2afveqo3m2iyww8/joc.rar?dl=0

    I’m working with Visual Studio 2010 and XNA 4.0


    Jenny [Tobii]


    If you only want to change the X value, then only change the X value in your code.
    Hard-code the Y value to the Y position you want your paddle to slide along, and update the X value according to the Gaze Point’s X value.

    You should probably also do some filtering of the Gaze Point’s X value so that the paddle does not jiggle or jump back and forth.

    You can filter the eye-gaze data by calculating a moving average using the last 10 Gaze Points. Here is a simple description of how to calculate a moving average:
    This will make all paddle movements overall slower and smoother.

    A more advanced filtering would be to use an exponentially decaying filter as explained here:
    This would make the paddle steady when the eye-gaze is focused on specific point, but fast when moving the eye-gaze to another part of the screen.


    Thank you a lot for the answer!
    I’ll give it a try.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.