Need help finishing a joy stick game!

Hi, I’m new to arduino and i have been given this project to complete. I nearly have it figured out but i’m getting a few problems i.e you can not win in this game it just keeps telling me that I lose.

Here is the spec:

Using two linear potentiometers to create a joy stick (one for horizontal movement, one for
vertical movement), you are required to create a digital game. Four LEDs are to be used as
indicators for the player, representing N, S, W, E. Arduino should randomly turn on one of
the LEDs and start timing. The player should react and move the appropriate potentiometer
to the corresponding side (e.g. N, S, W or E) and should be told win or lose in the serial
monitor if it inside a certain time threshold. A green LED should also be activated to indicate
win, red LED for a loss. The game should not reset until the linear potentiometers are
returned to some central position (or position range), incorporate a delay and then restart.

Any help is greatly appreciated!

tims_version_v2.ino (2.94 KB)

Using two linear potentiometers to create a joy stick (one for horizontal movement, one for
vertical movement), you are required to create a digital game.

This sounds suspiciously like a homework assignment. Please give us the instructors e-mail address, so we can get clarification on any missing requirements.

Thats all the information I was given. I'm just looking for someone to point out where I've gone wrong, or what I've done wrong to cause the game to be lost every time.

Thats all the information I was given.

So, it is a homework assignment?

ALL of your code is inside the

 if (xPosition >480 && xPosition <540 && yPosition >480 && yPosition <540)

in spite of the piss-poor indenting that makes it appear otherwise.

Inside that if statement body, it makes no sense to check for the potentiometer values to be outside that range.

I told you, in your other thread, that you needed to remove the useless braces. You STILL do.