Page 2 of 2

Re: quick question

PostPosted: Thu Dec 22, 2011 3:01 am
by skydereign
The redeclaration error means that you have the variable already declared somewhere else. Remove the extra and it should work. And what do you mean by work so well with pong? Pretty much no one but krenisis would suggest using textNumber like that, and the only reason he would was he couldn't figure out variables. textNumber isn't guaranteed to work like that, it is only meant for displaying, therefore it might work if you do math with it, but it also may not. Since there is any chance of it not working, avoid it by doing the right thing.

Re: quick question

PostPosted: Thu Dec 22, 2011 6:45 am
by SuperSonic
@NOH: The reason the error message appears is that you already have an actor named M_punch_number. Try naming the int M_punch_number_var. That should work :D

Oh, and thank you for the point :P

Re: quick question

PostPosted: Thu Dec 22, 2011 4:23 pm
by NightOfHorror
In the code am I supposed to have the variable or the actor in the code.

Re: quick question

PostPosted: Thu Dec 22, 2011 7:56 pm
by SuperSonic
NightOfHorror wrote:In the code am I supposed to have the variable or the actor in the code.

NightOfHorror wrote:and supersonic, each time I put in int M_punch_number=2;, it says "redeclaration of parameter "M_punch_number"".

All you have to do is change "int M_punch_number=2;" to "int M_punch_number_var=2" :wink:

Re: quick question

PostPosted: Fri Dec 23, 2011 1:55 am
by NightOfHorror
I did all of this and when I click nothing happens.

Re: quick question

PostPosted: Fri Dec 23, 2011 2:03 am
by skydereign
This is why you need to understand what the other person is suggesting. If you can't understand what the person is suggesting, or why it should fix your problem, then you won't be able to debug it. But, with things like this, it is much harder for us to figure out what you aren't doing correctly than it would be for you. All the fix is is to create a variable, and use it properly (in your case reduce it by one and also to display it). I believe you have the capacity to figure that out. The error that you were experiencing was due to you declaring a duplicate variable, all you would have to do is remove one of the two decelerations. And, then you have your variable, and can use it properly.

Re: quick question

PostPosted: Fri Dec 23, 2011 5:24 am
by SuperSonic
Make sure that on your click event, you have this:
Code: Select all
M_punch_number_var -= 1;

:D

Re: quick question

PostPosted: Fri Dec 23, 2011 10:58 pm
by NightOfHorror
Guys, you wont care, but to me, its my hugest jump in GE. That is figuring out and correcting the problem by myself. It was the code textNumber=M_punch_number_variable;. I knew I had to somehow had to make the actor=variable, but couldn't do that because it would create error. All I had to do was put M_punch_number.textNumber=M_punch_number_variable.

Thanks Supersonic by the way. :D

Re: quick question

PostPosted: Sat Dec 24, 2011 2:28 am
by SuperSonic
You're welcome. I'm glad I could help you. Keep learning man :wink: