Skip to content

Hamster

Dagait edited this page Apr 17, 2022 · 12 revisions

Hamster

This is an overview of all available methods for the hamster class.


AddItem

Method Description
AddItem(string itemName, int amount = 1) Add a specific amount (Default 1) of an item to the hamsters inventory.
AddItem(int itemId, int amount = 1)
AddItem(Item item, int amount = 1)

RemoveItem

The item has to be in the inventory, otherwise, an error will be thrown.

Method Description
RemoveItem(string itemName, int amount = 1) Remove a specific amount (Default 1) of an item from the inventory.
RemoveItem(int itemId, int amount = 1)
RemoveItem(Item item, int amount = 1)

UseItem

The item has to be in the inventory, otherwise, an error will be thrown, and the game is pausing.

Method Description
UseItem(string itemName, int amount = 1) Use a specific amount (Default 1) of an item from the inventory.
UseItem(int itemId, int amount = 1)
UseItem(Item item, int amount = 1)

Action Methods

Method Description
DisplayName(bool b) Decide, if the name of the hamster should be displayed in-game (Above the hamsters' head).
DisplayHealth(bool b) Decide, if the health should be displayed in-game (Above the hamsters' heads, and under the hamsters' names).
DamageHamster(int amount = 1) Deal a specific amount of damage to the hamsters' health (Default 1).
HealHamster(int amount = 1) Heal a specific amount to the hamsters' health (Default 1)
DamageEndurance(int amount = 1) Deal a specific amount of damage to the hamsters' endurance (Default 1).
HealEndurance(int amount = 1) Heal a specific amount to the hamsters' endurance (Default 1)
DisplayInventory() Display the inventory on/off (Depending on the current state).
Trade() Start trading with a hamster, standing in front of this hamster.
Talk() Start a conversation with a hamster, standing in front of this hamster.
Move() Move the hamster one tile further in looking direction of this hamster.
TurnLeft() Hamster rotates to the left, anti-clockwise (North-> West -> South-> East)
PickUpGrain() Pick up a grain.
DropGrain() Drop a grain.

Getter Methods

Method Description
bool FrontIsClear() return true if the front is clear (No hamster nor wall nor water)
bool IsOnGrain() return true if this hamsters stands on a tile which has a grain.
int GetGrainCount() return the amount of grains, the hamster owns.
Vector2 GetHamsterPosition() return Vector2, get the current location of this hamster.

Setter Methods

Method Description
SetName(string name) Set the in-game name of this hamster.
SetX(int x) Set the x-Coordinate for this Hamsters.
SetColumn(int x) Set the x-Coordinate for this Hamsters.
SetY(int y) Set the y-Coordinate for this Hamsters.
SetRow(int y) Set the y-Coordinate for this Hamsters.
SetPosition(int x, int y) Set the position of this hamster.
SetColor(Hamster.HamsterColor) Change the coat color of this hamsters
SetGrainCount(int amount) Change the current grain count, which the hamster owns.
SetPlayerControls(bool playerControl, bool cameraSnap = false) Activate/Deactivate player controls (Player can move around by pressing buttons). cameraSnap is default false, if true, main camera is going to follow the hamster (Not compatible with multiplayer).
SetEquipmentEffects(bool b) Activate/Deactivate the item effects.
SetEnduranceConsumption(bool b) Activate/Deactivate the endurance consumption.