Matching animations ?

Non-platform specific questions.

Matching animations ?

Postby Just4Fun » Sat Mar 20, 2004 4:34 pm

I have 4 actors. 2 actors have the same animation(image). How would I check to see [on Mouse down event ] if the animators match?

Left mouse click actor1.
Left mouse click actor2.
Does the animation image match?
Do something....
Else
Do something...


*jazz_e_bob, glad to see you back(at least briefly). I hope your wife's knee is less painful now.
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score

Postby ingsan » Sat Mar 20, 2004 9:13 pm

if the animators match?


What do you mean by that ?
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

Postby phractus » Sat Mar 20, 2004 9:29 pm

animdex, or whatever its called. I think that basicly assigns each animation a number and then you can use it to test.
phractus
 
Posts: 77
Joined: Mon Mar 08, 2004 1:25 am
Location: Rochester, NY, USA
Score: 0 Give a positive score

Postby Just4Fun » Sat Mar 20, 2004 10:12 pm

phractus & ingsan & other helpful people:

I have a *basic* idea about "animindex", but I don't really know how to set this whole thing up in a conditional statement.

<conditional action>

[if]
actor1.animindex==1
equals
actor2.animindex==1
[then]
action: create actor (or do something else)

* As it runs now with my attempts, I either crash GE or nothing happens...TIA
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score

Postby ingsan » Sat Mar 20, 2004 11:30 pm

i am going to ponder about it, but one last thing : Don't put animindex==1. Use animindex=1, cause animindex is only meant to be read !
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

Postby Just4Fun » Sun Mar 21, 2004 4:38 am

In Visual Basic it would be scripted like this:

'check to see if images are the same then do something if they are the same.
[mouse down event code for both images]

If Image1.picture =Image2.picture then

blah, blah ......

Else

blah, blah .......

end if
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score

Postby phractus » Sun Mar 21, 2004 5:49 am

ingsan wrote:i am going to ponder about it, but one last thing : Don't put animindex==1. Use animindex=1, cause animindex is only meant to be read !


Woa. The scripting is in C right? if you use animindex = blah, you are setting it to blah. == is equivelent to "is equel too" and used for testing the variable.

O, not too sure how animindex works myself but i think the syntax would be along these lines in GE:
note im not sure if its a intiger or a animation name it uses to test, the numbers(animation name) are related to each object.

if (blah.animedex == 2 && other.animedex == 4)
{
//whatever you want to have happen
};


hope this helped. like I said im not sure what animendex uses to test. I will go play with it and respond back.
~peace~
phractus
 
Posts: 77
Joined: Mon Mar 08, 2004 1:25 am
Location: Rochester, NY, USA
Score: 0 Give a positive score

Postby ingsan » Sun Mar 21, 2004 9:46 am

There has been some talks about it before.
http://www.game-editor.com/forum/viewtopic.php?t=222
until we find a solution :wink:
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

Postby jazz_e_bob » Sun Mar 21, 2004 10:30 am

Hmmm....

OK - let's assume that all four actors have fours animations assigned to them.

hearts (animindex == 0)
diamonds (animindex == 1)
clubs (animindex == 2)
spades (animindex == 3)

We'll make a global variable called "animIndexOld".

When the game starts set animIndexOld to 999.

On mouse down for any actor
{
if (animIndexOld == animindex )
"they matched"
else
"they didn't match"
animIndexOld == animindex;
}
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby ingsan » Sun Mar 21, 2004 10:34 am

Ok what i understood is that animindex = 0 refers to the current animation that is running on your Actor.

Let's say your actor hase two animations Walk and Stand. If, in Actor Control, you've selected Walk, then Walk is when animindex = 0. And if, in other way, you've selected Stand (even if Stand has been loaded After Walk animation) Stand IS then animindex = 0. So it depends on what animation is loaded on Runtime ! i think :?

So i think you should do this to test first :

Create 2 actors (Actor1 and TestActor)

on Actor1, put two different animations. TestActor is to test animindex.

on Actor1 > play animation Walk.
Add Event CreateActor
Add Action Script and write :

Code: Select all
animindex=0; //animindex count always starts from 0.


Add Event KeyDown [w]
Add Action Script and write :
Code: Select all
animindex=1;

Add Event Mouse Button Down [LEFT]
Add Action Script and write :

Code: Select all
switch(animindex)
{
 case 0:
          ChangeTransparency of TestActor.
          break;
 case 1:
          Change VisibilityState of TestActor ie make TestActor invisible.
          break;
}


What will happen is that when you'll have animation Walk (animindex=0), on Mouse click, TestActor will be lightly Transparent . Press "w" to Change animindex.Now animindex=1. On Mouse click, TestActor will dissapear.

If you want to test animindex on TWO Actors, repeat this on the Second and just play with the code!

Maybe there is a much more Logic code, but i have exams soon and maybe i'll see you with something better after. :wink:

Cheers
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

Postby ingsan » Sun Mar 21, 2004 10:45 am

hearts (animindex == 0)
diamonds (animindex == 1)
clubs (animindex == 2)
spades (animindex == 3)


How do you define this, jazz-e-bob? Do you have to define that animindex 1 is equal to bla bla.... or is it predefined ?

Read what i've said before.
Ok what i understood is that animindex = 0 refers to the current animation that is running on your Actor.

Let's say your actor hase two animations Walk and Stand. If, in Actor Control, you've selected Walk, then Walk is when animindex = 0. And if, in other way, you've selected Stand (even if Stand has been loaded After Walk animation) Stand IS then animindex = 0. So it depends on what animation is loaded on Runtime ! i think


I'm quite confused :?
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

Postby jazz_e_bob » Sun Mar 21, 2004 10:56 am

Ok what i understood is that animindex = 0 refers to the current animation that is running on your Actor.


nah nah nah

An actor with 3 animations

stand
walk
run

if the actor is standing its animindex will be 0.
if the actor is walking its animindex will be 1.
if the actor is running its animindex will be 2.
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby jazz_e_bob » Sun Mar 21, 2004 10:57 am

So i think you should do this to test first :


OK then... :D
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby ingsan » Sun Mar 21, 2004 11:10 am

Well i tested that.

I have 2 animations :

walk > animindex=0
stand > animindex=1
as you said

My actor is on Walk anim at runtime.

I put a condition :

if(animindex==0) do Action1 ; // on Walk, Action1.
else if(animindex==1) do Action2 ; // on Stand, Action2.

The test works well.

But then i change animation in Actor Control and put it on Stand at Runtime. It then seems that animindex 0 has become Stand and that animindex 1 has become Walk as the conditional actions revert.
Last edited by ingsan on Sun Mar 21, 2004 11:33 am, edited 2 times in total.
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

Postby jazz_e_bob » Sun Mar 21, 2004 11:26 am

Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Next

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest