The Daily Click ::. Forums ::. Klik Coding Help ::. Problem with animation Directions
 

Post Reply  Post Oekaki 
 

Posted By Message

lembi2001



Registered
  01/04/2005
Points
  608

VIP MemberIt's-a me, Mario!Wii OwnerI like Aliens!Has Donated, Thank You!PS3 OwnerI am an April Fool
26th April, 2010 at 11:00:22 -

I am making a game where a block disappears off screen only to be recreated elsewhere.

I use an alterable value (movement value) to determine the controlled state of the block, there is a second alt. value (anim dir) used to control the animation direction.

When the block is destroyed and recreated it only sets itself to the first direction. the code is as follows:

collision between Puzzle Block and Level Block
+anim dir (Puzzle Block) = anim dir (Level Block)

Destroy Puzzle Block
Destroy Level Block
Create Puzzle Block
Set Movement Value to 0
Set anim dir to Random(5)

i have got an Always event in there so that the Animation Direction is set to the value of anim dir all the time.

this always sets the animation direction to 0 for some reason. it's basically the same code for if the tested values do not match however i set it a second movement (pinball) to take it off screen. once it is destroyed it is set back to the normal movement (static).

Can anyone work out why this is happening from the snippet of code i have or do you need more.

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
26th April, 2010 at 12:27:05 -

It might be having trouble picking out the created instance. Try doing something like:

Puzzle Block Value A = 0
>>Set Value A to 1 + Set anim dir to Random(5)

Though now I reread your post, I'm a bit confused by the end. If that doesn't work, could you clarify what you did with the pinball movement?

Edited by OMC

 

  		
  		

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
26th April, 2010 at 12:39:35 -

This is just a guess, and might be completely wrong...

Perhaps when you say "Set anim_dir" to Random(5), it is only affecting the instance of "PuzzleBlock" which was involved in the collision - ie. The one that was just destroyed. The newly created block would remain at it's default value of 0.

If that were the case, you could try splitting the event in two:

+ Collision PBlock and LBlock
-> destroy PBlock
-> destroy LBlock
-> create PBlock

+ PBlock: flag0 is OFF
-> set anim_dir to random(5)
-> set flag0 ON
// since flags are OFF by default, this will only target a newly created instance.


EDIT: Looks like OMC beat me to it

Edited by Sketchy

 
n/a

lembi2001



Registered
  01/04/2005
Points
  608

VIP MemberIt's-a me, Mario!Wii OwnerI like Aliens!Has Donated, Thank You!PS3 OwnerI am an April Fool
26th April, 2010 at 13:53:33 -

I think your solution might work Sketchy.

@OMC: i'm using the pinball movement to make it bounce off screen on a diagonal.

Yep Sketchy's idea works. I'll be posting a project page for this soon when it's got some substance to it.

Edited by lembi2001

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
26th April, 2010 at 15:03:52 -

Apparently my suggestion was skipped over, since it's the same thing. >_>

Can't wait to find out what the project is.

 

  		
  		

lembi2001



Registered
  01/04/2005
Points
  608

VIP MemberIt's-a me, Mario!Wii OwnerI like Aliens!Has Donated, Thank You!PS3 OwnerI am an April Fool
26th April, 2010 at 15:13:30 -

Sorry OMC - I didn't skip over your suggestion it's just that i am already using the alt vals to control another aspect of the blocks. That's the only reason i used sketchy's idea as it used the flag option.

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
26th April, 2010 at 16:16:41 -

All the same, all the same, old bean. Keep us apprised!

 

  		
  		
   

Post Reply



 



Advertisement

Worth A Click