Code Monkey home page Code Monkey logo

Comments (7)

delayel06 avatar delayel06 commented on May 27, 2024

It is. It seems like something I can't fix, although I have tried in many ways to code it differently. I thought what I had done worked.

I'll try to fix it again and I will see.

Did the health go back down after?

from adventureroad.

ChapelR avatar ChapelR commented on May 27, 2024

It's hard to tell. I got attacked pretty much immediately after that, I believe, so I'm not sure if it resolved itself or not. I think you could potentially just insert some logic at the bottom of your damage calculation.

As a suggestion:

(if: $damage < 0)[
    (set: $damage to 0)
]

Or something, I don't know what exactly you're working with. Probably better than testing health to see if it's over the max (which you should still also do, if you are doing so).

Just my two cents. Cool game, though, I quite liked it.

from adventureroad.

delayel06 avatar delayel06 commented on May 27, 2024

I am currently using a variable as an equalizer, here is what it looks like:

`(elseif: $turn is "enemy")[

(link: "Continue")[

(set: $log to "enemy")

(set: $turn to "you")

(if: $dp > $eap)[

(set: $equalizer = $dp - $eap)

(set: $hp to it - $equalizer)

]
(else:)[

(set: $hp to it - $eap)

(set: $hp to it + $dp)]

(goto: "Combat")]]

(if: $ehp > $mhp)[(set: $ehp to $mhp)]

(if: $hp > $maxhp)[(set: $hp to $maxhp)]

(if: $hp <1)[(goto: "lose")]

(if: $ehp <1)[(goto: "Win")]`

It should work, but I don't see why it doesn't.

from adventureroad.

ChapelR avatar ChapelR commented on May 27, 2024

Sorry. Trying to comment on my phone and messed it all up.

from adventureroad.

delayel06 avatar delayel06 commented on May 27, 2024

That's alright. I also checked your profile out and if you need help on your holy land project I'd be happy to help

from adventureroad.

ChapelR avatar ChapelR commented on May 27, 2024
(if: $dp > $eap)[

(set: $equalizer = $dp - $eap)

(set: $hp to it - $equalizer)

]
(else:)[

(set: $hp to it - $eap)

(set: $hp to it + $dp)]

...

This will stop it, but doesn't it also mess up how defense works? If we plug in numbers, assuming player defense is 3 and enemy attack is 2 for sake of ease:

(if: 3 > 2)[

(set: 1 = 3 - 2)

(set: $hp to it - 1)

]

So having HP that is higher than the enemy's attack power actually increases the damage you take. At least that's my read of it, based on this code.

defense enemy attack damage taken
1 2 1
2 2 0
3 2 1
4 2 2

Maybe something like this to replace the whole thing?

(unless: $dp > $eap)[

(set: $hp to it - $eap)

(set: $hp to it + $dp)]

...

Then, no damage is taken if defense is >= to attack power.

Or, if you want to have some type of minimum damage:

(if: $dp > $eap)[
    (set: $hp to it - 1)
](else:)[
    (set: $hp to it - $eap)
    (set: $hp to it + $dp)
]

...

I also checked your profile out and if you need help on your holy land project I'd be happy to help

Awesome, thank you. I'll be needing some testing help sooner rather than later. I saw you filled out the form on my devlog. I'll be in touch. I'm hoping to get a handful of Twine creators together so we can all share the testing load with each other.

from adventureroad.

delayel06 avatar delayel06 commented on May 27, 2024

Thank you a lot, I will be using that code

(unless: $dp > $eap)[

(set: $hp to it - $eap)

(set: $hp to it + $dp)]

The problem with my code is I was supposed to take away the $equalizer after having been healed whatever amount, but the problem was that I closed the bracket and put an else block, therefore removing the normal "healing" and thus removing the equalizer number from the health.

And I can't wait to test your game, seems like you have been working on it for far longer than I have.

I think I can close this now, so I will do so, thanks again.

from adventureroad.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.