3D Rad - Free 3D game maker - Forum

This forum is now archived!

This forum is locked, and is a read-only version. A new community-ran forum can be found at classdev.net

News:

The 3DRad community can be found at classdev.net.

Pages: [1]

Author Topic: 1 score at contact  (Read 741 times)

« on: September 05, 2010, 01:52:53 PM »
Hello

i am trying to get 1 score at a contact
with the sample script you keep getting scores when you touch a object
but i want it that if you touch a object you get 1 score and not that it loops it

a timer should help i think
but i can't figure out how it works  :P
i was thinking that when you hit a object a timer start for three seconds en than you can get a another score
i totally failed with this
Code: [Select]
float Score = 0;
void Main()
{
   if (IN_22 > 0)
   {
      iObjectStop(OBJ_22);
      Score = Score + 1;
      iObjectStart(OBJ_44);
   }
   if (IN_44 == 180)
   {
      iObjectStart(OBJ_22);
      iObjectReset(OBJ_22);
      iObjectStop(OBJ_44);
      iObjectReset(OBJ_44);
   }
   OUT_0 = Score;
   
}
the score on top of the screen walks up to 179  :P

can someone help me?

gr. Ron

sorry for my bad english :P
« Reply #1 on: September 05, 2010, 02:20:11 PM »
is hard to say just saying the handles and not knowing what objects are...

I guess...

IN_22 eventOnContact
OBJ_44 timer
OUT_0 valuePrint

to begin with, timer count seconds, not frames... 180 would be 180 seconds.
the way you did it, you well could count frames using a var like Score but Time and get rid of the timer object.

asuming IN_22 is eventOnContact, you could do something like this:
Code: [Select]
float Score = 0,Time=0;
void Main()
{
   if (IN_22 > 0 && time==0)
   {
      Score = Score + 1;
      Time = 180;
   }
   if (Time>0)
   {
      Time--;
   }
   OUT_0 = Score;
   
}

do you understand what I did there?
Crashing Boxes - winner of the 3d games category at the 5th Uruguayan video game contest
get a copy for your iPad/iPhone!
« Reply #2 on: September 05, 2010, 02:40:16 PM »
yes it works great now :D
thank you very much

i was thinking to difficult :P
« Reply #3 on: September 05, 2010, 04:45:14 PM »
Are you after a maximum of 1 point or are you setting a window of time in which you can score points?
Either way, this little project does that without any scripting, just change the EventTimer - EventOnContact to the range of time you would like.

Mr Merrick
Pages: [1]