i wanna make a function that returns (or sets a value to what a sprite is touching) because I can’t find a pre-made variable in the engine that does it, like sprite.x returning the x coordinates.
but if there isn’t, here’s the basic system ive come up with but i can’t figure out the problem.
var item1 = createSprite();
var item2 = createSprite();
var entities = ;
appendItem(entities, item1);
appendItem(entities, item2);
function touchingWhat() {
for(i=0;i<entities.length;i++) {
if(player.isTouching(entities[i]) == true) {
return entities[i];
} else {
return “nothing”;
}
}