Game Development Reference
In-Depth Information
Create a similar rule with two different conditions:
• The first being
Actor receives event
|
key
|
Y
|
is down
•
The second being
Attribute
|
game.Score
>
500
This will detect if the player presses
Y
to buy, and has enough coins.
Then debit the player's score by dragging in a Change Attribute behavior,
Change
Attribute:
|
game.Score
|
To:
|
game.Score - 500
, and change the
Accepted
attribute to
True
:
You can add a Timer behavior that will display a message from the merchant.
Basically, create a new rule. Let's say if the player accepted it but didn't have
enough money, turn on both,
Accepted
and
Declined
, then in the
Message
rule,
check whether they are both
True
, then add a Timer for
5
or
10
seconds to display
the message: