Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Can You Multiply A Variable?

I am using Harlowe to make a game. Basically, part of the game is farming to get food. Every time you go to the farm, the seeds you have collected turn into food, and boost your hunger bar. Here's the code:
(set: $hunger to $hunger + $seeds)(set: $seeds to 0)

But the problem is, is that I would like the player to upgrade their farm. So if I set a variable called '$upgrade', it would times the amount of food you get by the upgrade.
(set: $hunger to $hunger + $seeds)(set: $hunger to $hunger x $upgrade)(set: $seeds to 0)

However, I can't figure out how to multiply. If there is a way, please tell me, but if there isn't, could you suggest improvements?

Comments

  • edited August 2016
    Use the * operator instead of the letter x.
    (set: $hunger to ($hunger * $upgrade))
    

    As you are upgrading the farm I suggest multiplying the $seeds not the $hunger:
    (set: $hunger to 10)
    (set: $seeds to 5)
    
    (set: $upgrade to 1)
    (set: $hunger to $hunger + ($seeds * $upgrade))(set: $seeds to 0)
    
    seeds: $seeds
    hunger: $hunger
    
  • Is it a slash to divide?
    (set: $health to $health - ($attack / $armour))
    
  • Deadshot wrote: »
    Is it a slash to divide?
    (set: $health to $health - ($attack / $armour))
    

    Yes.
  • Deadshot wrote: »
    Is it a slash to divide?
    (set: $health to $health - ($attack / $armour))
    

    Yes.

    Cool, thanks.
Sign In or Register to comment.