Results 1 to 6 of 6

Thread: Rpg help!!

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2000
    Posts
    20

    Post

    how do you make that if the player
    has 100 energy then the enemy attacks
    the player has only 70 energy.

    why doesn't this work
    energy=100
    energy = energy - 30

    if do that then the players energy is -30!

    Help me Please!!!!!


  2. #2
    New Member
    Join Date
    Jul 1999
    Posts
    6

    Post

    try posting this in the games section, they probably have an answer

  3. #3
    New Member
    Join Date
    Jun 1999
    Location
    Pikeville, KY, USA
    Posts
    12

    Post

    One problem - not sure since code isn't posted.

    Is Energy a Global Variable? If it isn't then energy upon entering another Form will be 0 - hence you will end up with -30.

    Just curious. You may want to put something before and after the computation such as:
    MsgBox ("Energy = " & energy + vbCRLF & _
    "Damage = " & damage)
    or you can make damage static... I usually do this to make sure my variables are assigned what I want them to be.

    Hope I could've been help.

    Rob

  4. #4
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840

    Post

    you will need a public variable for Energy.

    Public Energy as Long

    Then in the Subs
    Energy = 100

    and after damage...

    Energy = Energy - 30 ' OK !!!

    If the variable is not public then later in your damage sub (or button click or whatever) a new version of energy is created as a variant of value 0 so...

    e = e - 30
    = -30 ' because e equaled 0 not 100 in this sub


  5. #5
    Lively Member Ishamel's Avatar
    Join Date
    Nov 1999
    Location
    Edinburgh, Scotland
    Posts
    112

    Post

    Maybe the Goblin's sword is bigger than you thought and instead of causing 30 damage, it is in fact causing 130 damage. (Hence the -30)

    Try giving your barbarian a shield.



    ------------------
    Ishamel
    [email protected]

    How can I tell you I love you when you are sitting on my face?

  6. #6
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800

    Post

    Maybe you need quotes in there somewhere


    Steve

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width