1

import code

This commit is contained in:
2024-08-26 22:35:42 +03:00
commit fd45f6aa74
86 changed files with 5578 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
package com.mojang.ld22.item.resource;
import com.mojang.ld22.entity.Player;
import com.mojang.ld22.level.Level;
import com.mojang.ld22.level.tile.Tile;
public class FoodResource extends Resource {
private int heal;
private int staminaCost;
public FoodResource(String name, int sprite, int color, int heal, int staminaCost) {
super(name, sprite, color);
this.heal = heal;
this.staminaCost = staminaCost;
}
public boolean interactOn(Tile tile, Level level, int xt, int yt, Player player, int attackDir) {
if (player.health < player.maxHealth && player.payStamina(staminaCost)) {
player.heal(heal);
return true;
}
return false;
}
}