Page 1 of 2

quick question

PostPosted: Thu Dec 22, 2011 12:12 am
by NightOfHorror
why is my 2 going to 0 when I click on an actor to make it change
the code was
actorsName.textNumber=actorsName.textNumber-1;

Re: quick question

PostPosted: Thu Dec 22, 2011 12:13 am
by Hblade
Are you using 2 cloned actors? I had a similar issue, both actors take the 1 actors event, causing it to double the variable change.

Re: quick question

PostPosted: Thu Dec 22, 2011 12:18 am
by NightOfHorror
no.

Re: quick question

PostPosted: Thu Dec 22, 2011 12:22 am
by Hblade
hmm, strange then o-o I know your pain though, having a problem you can't figure out. it's aggravating huh?

Re: quick question

PostPosted: Thu Dec 22, 2011 12:23 am
by SuperSonic
Could you upload your ged? :D

Re: quick question

PostPosted: Thu Dec 22, 2011 12:29 am
by NightOfHorror
here you go. I will only wait five minutes and then I will delete the file


DELETED FILE

Re: quick question

PostPosted: Thu Dec 22, 2011 12:29 am
by Hblade
Lol night is mad. poor guy, I know how he feels T.T

Re: quick question

PostPosted: Thu Dec 22, 2011 12:39 am
by NightOfHorror
HBlade, can you delete this topic now

Re: quick question

PostPosted: Thu Dec 22, 2011 12:43 am
by SuperSonic
Ok, I fixed it! :mrgreen:

First, you have to create an integer in your global code like this:
Code: Select all
int PunchNumber = 2;

Next, on punch, edit the mouse button down event and put:
Code: Select all
PunchNumber -= 2;

And finally, add a draw actor event to M_punch_number and put:
Code: Select all
textNumber = PunchNumber;


And it will work :D

Re: quick question

PostPosted: Thu Dec 22, 2011 12:54 am
by Hblade
NightOfHorror wrote:why is my 2 going to 0 when I click on an actor to make it change
the code was
actorsName.textNumber=actorsName.textNumber-1;

Try changing 1 to .5. It's doubling for some reason, double of .5 is 1, so you should get your 1 result. Otherwise add a double and use that as .5 and then yeah xD

Re: quick question

PostPosted: Thu Dec 22, 2011 1:02 am
by NightOfHorror
well sonic, and H thanks. +1s

Re: quick question

PostPosted: Thu Dec 22, 2011 1:14 am
by NightOfHorror
H, your code made the number be .5, and supersonic, each time I put in int M_punch_number=2;, it says "redeclaration of parameter "M_punch_number"".

Re: quick question

PostPosted: Thu Dec 22, 2011 1:23 am
by Hblade
Weeeird o-o

try .25

Re: quick question

PostPosted: Thu Dec 22, 2011 1:24 am
by skydereign
This is why you shouldn't do math with textNumers. Only use textNumber as a means of displaying, like in SuperSonic's fix.

Re: quick question

PostPosted: Thu Dec 22, 2011 2:45 am
by NightOfHorror
why does it work so well with pong. Also, why does the message in Sonic's code appear when I try to do it.