|
-
Feb 21st, 2000, 05:17 AM
#1
Thread Starter
Junior Member
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!!!!!
-
Feb 21st, 2000, 08:34 AM
#2
New Member
try posting this in the games section, they probably have an answer
-
Feb 21st, 2000, 08:48 AM
#3
New Member
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
-
Feb 21st, 2000, 05:33 PM
#4
Fanatic Member
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
-
Feb 21st, 2000, 07:19 PM
#5
Lively Member
-
Feb 22nd, 2000, 12:26 PM
#6
Frenzied Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|