Is there any way to store continuously changing variables?

Let me explain in detail.

#include <LedControl.h>

int digitPin[4] = {A2, A3, A4, 9}; //segment 위치 정의
int segPin[8] = {2, 4, 7, 6, 5, 3, 8, 13}; //a b c d e f g dp 정의
byte segValue[10][7] = { //숫자 정의
{1,1,1,1,1,1,0}, //0
{0,1,1,0,0,0,0}, //1
{1,1,0,1,1,0,1}, //2
{1,1,1,1,0,0,1}, //3
{0,1,1,0,0,1,1}, //4
{1,0,1,1,0,1,1}, //5
{1,0,1,1,1,1,1}, //6
{1,1,1,0,0,0,0}, //7
{1,1,1,1,1,1,1}, //8
{1,1,1,1,0,1,1}  //9  
};

const int posX = A0; //조이스틱의 X의 값
const int posY = A1; //조이스틱의 Y의 값
LedControl lc = LedControl(12, 11, 10, 1); //8x8보드의 DIN, CLK, CS 설정

unsigned long latime = 0; //지난 시간
unsigned long notime = 0; //현재 시간
unsigned long cotime = 0; //카운트 시간
int t1, t2, t3, t4, t5; //타이머의 자리 설정

int ns; //점수 생성
int s1 = 0; //1의 자리
int s2 = 0; //10의 자리
int s3 = 0; //100의 자리
int s4 = 0; //1000의 자리

void setup() {

Serial.begin(9600); //통신 속도

lc.shutdown(0, false); //8x8보드 절전 해제(0은 첫번째 연결된 lcxlc보드를 의미)
lc.setIntensity(0, 5); //8x8보드 밝기 설정
lc.clearDisplay(0); //8x8보드 화면 초기화

latime = 0; //지난 시간을 0으로 설정

randomSeed(analogRead(5)); //0~1023의 값을 준비

for(int i=0;i<10;i++){
 pinMode(segPin[i], OUTPUT);
}
for(int j=0;j<4;j++){
 pinMode(digitPin[j], OUTPUT);   
 digitalWrite(digitPin[j], HIGH); 
}

ns = 0; //시작 점수
}

void loop() {

int x; //x변수 생성
x = 0; //x변수의 값 지정

int y; //y변수 생성
y = 0; //y변수의 값 지정

lc.setLed(0, x, y, true); //x, y의 위치에 불빛

do {

 long Rx = 0; //Rx의 현재 값 설정
 long Ry = 0; //Ry의 현재 값 설정

 s1 = ns%10; //1의 자리
 s2 = (ns/10)%10; //10의 자리
 s3 = (ns/100)%10; //100의 자리
 s4 = (ns/1000)%10; //1000의 자리

 segOutput(3,s1,0); //1의 자리
 if(ns>=10) segOutput(2,s2,0); //10의 자리
 if(ns>=100) segOutput(1,s3,0); //100의 자리  
 if(ns>=1000) segOutput(0,s4,0); //1000의 자리 
 
 if (analogRead(posX) > 1000) { //조이스틱 오른쪽
   lc.setLed(0, x, y, false);
   ++y;
   if (y > 7) {
     y--;
   }
   lc.setLed(0, x, y, true);
   delay(100);
 }
 if (analogRead(posY) < 100) { //조이스틱 위쪽
   lc.setLed(0, x, y, false);
   x--;
   if (x < 0) {
     ++x;
   }
   lc.setLed(0, x, y, true);
   delay(100);
 }


 if (analogRead(posX) < 100) { //조이스틱 왼쪽
   lc.setLed(0, x, y, false);
   y--;
   if (y < 0) {
     ++y;
   }
   lc.setLed(0, x, y, true);
   delay(100);
 }
 if (analogRead(posY) > 900) { //조이스틱 아래쪽
   lc.setLed(0, x, y, false);
   ++x;
   if (x > 7) {
     x--;
   }
   lc.setLed(0, x, y, true);
   delay(100);
 }



 if (millis() - latime >= 1) { //30초 제한시간 설정
   latime = millis();
   notime = (millis() - cotime) / 1;
   t1 = notime % 10;
   t2 = (notime / 10) % 10;
   t3 = (notime / 100) % 10;
   t4 = (notime / 1000) % 10;
   t5 = (notime / 10000) % 10;

   Serial.print(t5);  //제한시간 확인용(시리얼 모니터)
   Serial.print(" : ");
   Serial.print(t4);
   Serial.print(" : ");
   Serial.print(t3);
   Serial.print(" : ");
   Serial.print(t2);
   Serial.print(" : ");
   Serial.println(t1);
 }


 if (t5 < 3) { //제한시간 30초가 아직 안됬을 경우
   if (t1 > 8) { //0.001자리가 9일 경우
     Rx = random(8); //8이하인 랜덤 Rx 지정
     Ry = random(8); //8이하인 랜덤 Ry 지정

     lc.setLed(0, Rx, Ry, true); //랜덤한 위치에 LED 켜짐

     if (x == Rx && y == Ry) {
       ++ns;
     }
   }
 }
 if (t5 > 2) { //제한시간 30초가 다 됬을 경우

   lc.clearDisplay(0); //8x8 도트 매트릭스 화면 초기화
   lc.shutdown(0, true); //8x8 도트 매트릭스 절전
 }
}
while (515 < analogRead(posX) < 525); //조이스틱이 가운데에 있을 때 까지
while (485 < analogRead(posY) < 515);
}

void segClear(){ //LED 초기화
for(int i=0;i<8;i++){
 digitalWrite(segPin[i], LOW);        
}
}


void segOutput(int d, int Number, int dp){ //LED 출력
segClear();
digitalWrite(digitPin[d], LOW); 
for(int i=0;i<7;i++){
  digitalWrite(segPin[i], segValue[Number][i]);        
}
digitalWrite(segPin[7], dp);
delayMicroseconds(1000);
digitalWrite(digitPin[d], HIGH); 
}

This code, which I started making a few days ago, uses a joystick to move the 8x8 dot-matrix LEDs and use them to catch other LEDs that light up in random locations.
I want to make my score go up when I catch the LED that is on.
So I made a code that raises the score, but it's not how I want it to be.
The way I want to do this is to get higher scores when I catch a "on" LED, but my code is to get higher scores only when my LED is placed in a random "on" LED position first.
I think the solution is to record all the coordinates of the randomly lit LED and then compare them to the current location.
But I don't know how.
If you know how, please let me know.
Please let me know if there is a better way.

I never look at code in italics or with smileys in it

Read this before posting a programming question and follow the instructions on how to post code

I don't know why, but
If (t5 < 3) { //제한시간 30초가 아직 안됬을 경우 if (t1 > 8) { //0.001자리가 9일 경우
Rx = random(8); //8이하인 랜덤 Rx 지정
Ry = random(8); //8이하인 랜덤 Ry 지정
the emoticon of the part is 8.

How can I use IDE...?
...
I do, thank you for advice.

Read and follow the advice in the link I posted. code tags are what you need and Auto formatting in the IDE would be an advantage too

Neither do I, but I can already see a few misunderstandings...

You are picking a new random location every so often (Rx, Ry). However...
a) you set Rx and Ry to zero at the start of your do...while loop every time thus erasing them.
b) your code to check if you have “hit” that random location is inside the if statement that chooses a new random location. Therefore you will only score a point if the new random location chosen matches the players current position.

Try...

  1. moving the reset of Rx and Ry outside the do...while loop
  2. checking for a “hit” on Rx and Ry every time through loop. If you find one increment the score and either chose a new Rx and Ry, or set them to an illegal board position (e.g. -1,-1 so they cannot be hit again)

This is not how do...while loop expressions work...

do {
}
while (515 < analogRead(posX) < 525); //조이스틱이 가운데에 있을 때 까지
while (485 < analogRead(posY) < 515);

Also:
Do your analogRead of posX and posY ONCE, then process them. Do not rely on a second analogRead returning the same value as a previous one.
Why bother incrementing y in the first place if it is 7 or more?

if (analogRead(posX) > 1000) { //조이스틱 오른쪽
     lc.setLed(0, x, y, false);
     ++y;
     if (y > 7) {
       y--;
     }
     lc.setLed(0, x, y, true);
     delay(100);
   }

I appreciate English probably is not your first language, but comments won’t help the majority of us here unless we can also understand them.

I wonder if the solution to this problem requires some backwards thinking.

Instead of checking if your joystick position is at a randomly lit LED try it the other way round, When an LED lights check if it happens to be at the joystick position.

...R