Is adding a tag to an object possible?

I’m making a game with pretty basic rpg like movement.
And im having some trouble with wall collision.

I have it to where their is always a ball in front of the player checking for a wall.
If it sees one then it stops the player from moving in that direction.

The issue is that I don’t know how to get it to desern normal objects from walls.
I could add each individual wall into the code by hand but that feels redundant and way too time consuming.
So I was wondering if their is any way to give the object a kind of classification that can be checked to tell that it’s a wall.

Like a
if (this.hits(var.wall)) [xdirectionavalible=false]
Where the object can hold that variable to be checked.

Sorry if this dosent make sense. I’m not entirely sure how to explain it

are you looking for something called a variable?

var name = {your object here};

The main issue is that I’m trying to make something have collision. But I want to do it by simply adding a small line into it rather then writing the whole collision system on every single object.

A function ig

Here is the wik file.

My Project12-20-2024_6-58-31PM.wick (4.5 KB)

I’m not sure if the send worked.
It has WASD controls.
The blue box is the main player location, the pink box is where the sprite will be, the black orbs are collision detectors to stop the player from running into walls, and the orange box is the wall.
I want to make multiple of the walls without having to redo the code for every individual wall.

Their is a test variable in the frame. Turn that on to see the collision stuff

Btw. The collision detection that’s red is bugged. Idk why. I’m just not gonna touch it for now

if you create a global array, like project.walls = [];, you can then have each wall’s default script say project.walls.push(this); to add itself to the array.

then, you can use your collision code on everything that is in project.walls.