Skip to content

LevelReward ​

Inherits: Resource

Container for rewards granted at a specific level

Properties ​

Stringdescription""
Array[Reward]rewards[]

Methods ​

voidadd_reward( reward: Reward )
boolremove_reward( reward: Reward )
voidclear_rewards()
intget_reward_count()
Rewardget_reward_at_index( index: int )
boolapply_to_player( player: Player )
Stringget_summary()
Array[Dictionary]validate()
boolis_valid()

Property descriptions ​

String description = "" ​

A short description of what this level gives (for the editor)

Array[Reward] rewards = [] ​

The rewards given at this level

Method descriptions ​

void add_reward( reward: Reward ) ​

Adds a reward to the level.

bool remove_reward( reward: Reward ) ​

Removes a reward. False when it was not there.

void clear_rewards() ​

Removes every reward.

int get_reward_count() ​

How many rewards the level gives.

Reward get_reward_at_index( index: int ) ​

The reward at a place of the list, or null.

bool apply_to_player( player: Player ) ​

Applies every reward; true when all of them were applied (an empty level reward has nothing to apply and counts as applied)

String get_summary() ​

A short text about the rewards of the level.

Array[Dictionary] validate() ​

Checks the settings. Gives the problems found (empty when it is fine).

bool is_valid() ​

Is it free of errors?