Increase Gold cost per DMG increase (Tower Defence)

0 favourites
  • 12 posts
From the Asset Store
C3 Swipe Towers is the game of speed and reflexes by enabling climber reach the top of tower.
  • Hi,

    Im making a Tower Defence

    -Tower does 1dmg

    -When i press (upgrade dmg sprite), Tower increase +1 dmg/-1 Gold

    -When i press (upgrade dmg sprite) again, Tower increase +1 dmg/-2 Gold, and so forth.

    How do i make this possible?

    I will post image of Code later

  • when press (upgrade )

    - Gold Add = -(tower dmg)

    - Tower Damage = Tower Damage + 1

    upgrade 1 = -1gold, dmg=2

    upgrade 2 = -2gold, dmg=3

    upgrade 3 = -3gold, dmg=4

  • when press (upgrade )

    - Gold Add = -(tower dmg)

    - Tower Damage = Tower Damage + 1

    upgrade 1 = -1gold, dmg=2

    upgrade 2 = -2gold, dmg=3

    upgrade 3 = -3gold, dmg=4

    Im not quite sure what you mean here but thanks for the answer. Here is an image of Code

  • You can use another variable i.e. 'cost' to replace the '1' and say Gold greater equal to Cost. Then on the right side actions AFTER you have set the damage and subtracted the gold, you set 'cost' to a value for next time, if the gold taken only increases by 1 for each level then you set 'cost' to self+1. Also remember to subtract 'cost' from Gold on the right side.

  • You can use another variable i.e. 'cost' to replace the '1' and say Gold greater equal to Cost. Then on the right side actions AFTER you have set the damage and subtracted the gold, you set 'cost' to a value for next time, if the gold taken only increases by 1 for each level then you set 'cost' to self+1. Also remember to subtract 'cost' from Gold on the right side.

    Thanks alot i got it to work :)

    Now i want make a diminishing return on the cost increase, anyone knows how to do that?

  • Now i want make a diminishing return on the cost increase, anyone knows how to do that?

    Please explain?

  • Brainless Way

    - USE ARRAY

    when Tower Level = 1 :

    Tower Damage = array_tower.At(0,1)

    Upgrade Cost = array_tower.at(1,1)

    when Tower Level = 2 :

    Tower Damage = array_tower.At(0,2)

    Upgrade Cost = array_tower.at(1,2)

  • Now i want make a diminishing return on the cost increase, anyone knows how to do that?

    Please explain?

    -Tower upgrade cost 1g at start

    -when upgraded it should scale upwards in price but with diminishing returns (so its not just multiplying itself to very high numbers)

    -Im fiddling with formulas like [round((cost*0.95)+1)] but im completely new to coding and construct itself (and math apparently), so what am i doing wrong ?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Brainless Way

    - USE ARRAY

    when Tower Level = 1 :

    Tower Damage = array_tower.At(0,1)

    Upgrade Cost = array_tower.at(1,1)

    when Tower Level = 2 :

    Tower Damage = array_tower.At(0,2)

    Upgrade Cost = array_tower.at(1,2)

    I couldnt understand the brainless way, could you give me the way with brain :)?

  • Well you set cost to a value for next time and it'll be up to you to decide how it scales and what that formula is. I used self+1 so it increases by 1 each time you upgrade, the actual value will be for you to decide.

  • Glennroh, I think you're on the right track there, with your formula like: [round((cost*0.95)+1)]

    I'd make a little table of cost and DMG points you want to hit and then come up with your formula. Test it in a spreadsheet and then code it. Maybe that's an OCD approach, but to me it's good for more complex situations and tuning sets of values.

  • Glennroh, I think you're on the right track there, with your formula like: [round((cost*0.95)+1)]

    I'd make a little table of cost and DMG points you want to hit and then come up with your formula. Test it in a spreadsheet and then code it. Maybe that's an OCD approach, but to me it's good for more complex situations and tuning sets of values.

    Good tip :)

    Btw i have done it right all the way, just did the "set value" instead of "add value". But ye a table is good for balancing

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)