Author Topic: Math formulas in games and how to use them in PB [Tutorail]  (Read 877 times)

Antikore

  • Developing Mortal Theater at day, developing depression at night.
  • Level 22: Trex
  • *
  • Posts: 2020
  • Enjoying Platform Builder from the very start
    • View Profile
    • PBuilder Resources
Math formulas in games and how to use them in PB [Tutorail]
« on: April 09, 2019, 09:20:43 AM »
You have heard about formulas in videogames?
A good example of this is a Damage Formula. It's the step between someone damages you and the final damage you get is selected. In Platform Builder, mostly all do 1 damage, but here you can refine it.

The most basic damage formula is:
final_damage = (attacker_damage - victim_defense)

You can implement this in Platform Builder in a damage player event in an enemy.
Code: [Select]
health + 1
game var final_damage = (Add here your enemy damage)
game var final_damage - [game var player_defense]
if game var final_damage < 0
{
game var final_damage = 0
}
health - [game var final_damage]

This is the same formula applied to Platform Builder.
I will extend this in the future. Thanks for reading.
Sorry because my English is not very good because I'm Spanish ;) :P