void GameLogic::update(float dt) { time_ += dt; createPlayerCharacter(); updateCharacters(dt); world_->Step(dt, 10, 10); }
int main() { //CHARACTER const char roleName1[10] = { 'W','a','r','r','i','o','r' }; const char roleName2[10] = { 'M','a','g','e' }; const char roleName3[10] = { 'A','r','c','h','e','r' }; double playerHealth; double playerAttack; double playerMaxHealth; //CHARACTER STATS double playerMinPhysicalResistance; double playerMaxPhysicalResistance; double playerCritChance; double playerMinCritDamage; double playerMaxCritDamage; //BOSS STATS char bossName[10] = { 'S', 'i', 'l', 'v', 'a' }; double bossHealth; double bossAttack; double bossMinPhysicalResistance; double bossMaxPhysicalResistance; double bossCritChance; double bossMinCritDamage; double bossMaxCritDamage; //FUNCTION int renderOpCode = -1; double *renderArgument1 = NULL; double *renderArgument2 = NULL; renderArgument1 = malloc(sizeof(double)); renderArgument2 = malloc(sizeof(double)); introduction(); createPlayerCharacter(getUserInput(3), &playerHealth, &playerMaxHealth, &playerAttack, &playerMinPhysicalResistance, &playerMaxPhysicalResistance, &playerCritChance, &playerMinCritDamage, &playerMaxCritDamage); createBoss( &bossHealth, &bossAttack, &bossMaxPhysicalResistance, &bossMinPhysicalResistance, &bossMaxCritDamage, &bossMinCritDamage, &bossCritChance); while (1 == 1) { while (bossHealth >= 0) { int temp = playerMove(); if (temp == 1) { double amount = calculateDamageAmount( bossMinPhysicalResistance, bossMaxPhysicalResistance, playerMinCritDamage, playerMaxCritDamage, playerCritChance, playerAttack); printf("Player dealt %d to Boss.\n", (int)amount); bossHealth -= amount; printf("Boss heal is %d.\n", (int)bossHealth); } if (temp == 2) { double amount = calculateHealAmount(playerMinPhysicalResistance, playerMaxPhysicalResistance, playerMinCritDamage, playerMaxCritDamage, playerCritChance, playerAttack); printf("Player heal %d to self HP.\n", (int)amount); playerHealth += amount; printf("Player heal is %d.\n", (int)playerHealth); } double amount = calculateDamageAmount(playerMinPhysicalResistance, playerMaxPhysicalResistance, bossMinCritDamage, bossMaxCritDamage, bossCritChance, bossAttack); printf("<----------------------------------------------------------------------------->\n"); printf("Boss dealt %d to Player.\n", (int)amount); playerHealth -= amount; printf("Player heal is %d.\n", (int)playerHealth); printf("<----------------------------------------------------------------------------->\n"); } } return 0; };