The Daily Click ::. Forums ::. Klik Coding Help ::. Mouse Trouble
 

Post Reply  Post Oekaki 
 

Posted By Message

C.J Workshop.



Registered
  10/09/2004
Points
  255
3rd June, 2007 at 12:12:43 -

Im currently making a game where you need to click on an object several times so that the animation changes. The problem is when it has been clicked once it goes straight to the last animation. I want it so that you have to click 4 times to reach the last animation. Anyone know how i can stop it from doing this ?

 
C.J

BROO



Registered
  31/10/2002
Points
  595
3rd June, 2007 at 12:20:16 -

Add "blocking flag" to every condition and action and reset this blocking flag after that clicking events:

1. Clicked on AO
+ anim=0
+ AO flag =0
-> change anim to 1
-> AO flag 0 set ON

2. Clicked on AO
+ anim=1
+ AO flag =0
-> change anim to 2
-> AO flag 0 set ON

3. Clicked on AO
+ anim=2
+ AO flag =0
-> change anim to 3
-> AO flag 0 set ON

4. Clicked on AO
+ anim=3
+ AO flag =0
-> change anim to 0
-> AO flag 0 set ON

5. Always
-> AO flag 0 set OFF

Like this.

If I think good, you are going to do some change-on-every-click block with 4 modes so it turns 0,1,2,3,0,1,2,3,0,1... You can also do it another way. Let's say you have anims 0,1,2,3 (stopped, walking, running, appearing(oops!) )... then you can do like this:
1. Clicked on AO
-> change anim to (anim+1) mod 4


 
n/a

C.J Workshop.



Registered
  10/09/2004
Points
  255
3rd June, 2007 at 12:28:36 -

Thanks for that. Its working fine now

Image Edited by the Author.

 
C.J

Joe.H

Evil Faker

Registered
  19/08/2002
Points
  3305
3rd June, 2007 at 13:35:13 -

Alternatively, I think a simple inclusion of "only one action when event loops" event would suffice.

 
My signature is never too big!!!

Knudde (Shab)

Administrator
Crazy?

Registered
  31/01/2003
Points
  5125

Has Donated, Thank You!Clickzine StaffKlikCast StarVIP MemberGhostbuster!Dos Rules!I donated an open source project
3rd June, 2007 at 14:19:41 -

Uh, alterable values would be a hell of alot easier than flags.

 
Craps, I'm an old man!

nim



Registered
  17/05/2002
Points
  7234
3rd June, 2007 at 15:45:17 -

Yup, what Joe said. Using "Only one action while event loops" can save you a lot of time.

 
//

DaVince

This fool just HAD to have a custom rating

Registered
  04/09/2004
Points
  7998

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
4th June, 2007 at 07:09:56 -

Using flags is a big inefficient workaround. Just add 1 to a value when you click an object, and set the frame to that value if it isn't already.

 
Old member (~2004-2007).

Klikmaster

Master of all things Klik

Registered
  08/07/2002
Points
  2599

Has Donated, Thank You!You've Been Circy'd!VIP MemberPS3 Owner
6th June, 2007 at 12:38:33 -

I beat you all (With a stick)
Why set the value of a counter when you can retrieve and set the animation frame?

user clicks object
- Set frame number to "frame number + 1"

Image Edited by the Author.

 
n/a

BROO



Registered
  31/10/2002
Points
  595
6th June, 2007 at 13:51:09 -

Set frame's the best :---) (so bad TGF doesn't have this option :---( ).
"One action when event loops" doesn't work (in TGF for sure) with 1/0 switch like this:

1. Upon pressing "1"
+ anim "stopped" played
+ one action when event loops
-> set anim to "walking"

2. Upon pressing "1"
+ anim "walking" played
+ one action when event loops
-> set anim to "stopped"

 
n/a

Joe.H

Evil Faker

Registered
  19/08/2002
Points
  3305
6th June, 2007 at 14:33:27 -

I was referring to the adding to a counter.

 
My signature is never too big!!!
   

Post Reply



 



Advertisement

Worth A Click