player loses 1 life when player moves 1 unit,Player loses life when he moves?

HI guys, im kind of new to unity and mobile game development

So, im trying to make a 2d top down game and I have a question, is there any game that loses 1 life or resource when the player is moving using unity?

e.g if player moves 5 units he loses 5 lives/resource

just want to check the logic/script if you guys know one, or have one.

Sorry for my english

,

Not sure if i understand what you are going for but if i understand correctly then:

Its a far fetched request and it’s easy to just create one yourself. In the movement action or function just decrease your resources with the desired amount.

Think you sould know this though:
int recources = 10;

	void Move()
	{
		//Move action here, Depends on what game and what you are making
		recources -= 5;
	}

Fluxhacks has it right -

It depends on how you are moving.
Unity has “Units” but those aren’t necessarily what all characters in all games move by.

But, if you programmed your movement function, for example, to move exactly 1 unit, or move X variable of units, you would also code, “minus 1 health” or “minus that same X variable of health”.