ChangeAnimation Not Working with loadvars

Non-platform specific questions.

ChangeAnimation Not Working with loadvars

Postby Hblade » Fri Mar 11, 2011 4:28 pm

Guys now I fixed the load crashing, but THERES A NEW PROBLEM >.> for some reason, it wont change the animation of the stupid background >:[

The code for the background is:
Code: Select all
if (DOLOAD==1) {
 
switch(BG) {
        case 0:
        ChangeAnimation("Event Actor", "SCREEN", FORWARD);
        break;
        case 1:
        ChangeAnimation("Event Actor", "Grass", FORWARD);
        break;
        case 2:
        ChangeAnimation("Event Actor", "water", FORWARD);
        break;
        case 3:
        ChangeAnimation("Event Actor", "clouds", FORWARD);
        break;
        case 4:
        ChangeAnimation("Event Actor", "rock", FORWARD);
        break;
        case 5:
        ChangeAnimation("Event Actor", "space", FORWARD);
        break;
        case 6:
        ChangeAnimation("Event Actor", "dark", FORWARD);
        break;
           }
           DOLOAD=0;
               }


And I made an actor to tell me what "BG" number is when the load starts, so WHY THE CRAP IS IT NOT WORKING >.>

it says it's "2" like it should be, but it doesnt change animation. Even if I have on the code, a simple "if (BG==2) { change animation... }" that doesnt even work!! :( WHY
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: ChangeAnimation Not Working with loadvars

Postby Kodo » Fri Mar 11, 2011 4:47 pm

Is there any chance that you are loading the variables after the switch(BG) code has executed? If that was the case BG would always be 0 when this code is run, that would also explain why it doesnt change but your debug text actor does.
Inogames: http://www.inogames.com iOS gaming
Firetop Adventure (app store): http://itunes.apple.com/us/app/firetop- ... ?mt=8&ls=1
User avatar
Kodo
 
Posts: 449
Joined: Thu Oct 20, 2005 8:20 pm
Location: UK
Score: 23 Give a positive score

Re: ChangeAnimation Not Working with loadvars

Postby Hblade » Fri Mar 11, 2011 4:50 pm

Nope, its afterwords O-o
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: ChangeAnimation Not Working with loadvars

Postby Kodo » Fri Mar 11, 2011 4:54 pm

Okay, then assuming that the various animations exist okay there are only a couple of possibilities. When this code is run, either DOLOAD is not equal to 1, or BG is 0. Try looking back through your code to see why either of those variables might not be as you expected.
Inogames: http://www.inogames.com iOS gaming
Firetop Adventure (app store): http://itunes.apple.com/us/app/firetop- ... ?mt=8&ls=1
User avatar
Kodo
 
Posts: 449
Joined: Thu Oct 20, 2005 8:20 pm
Location: UK
Score: 23 Give a positive score

Re: ChangeAnimation Not Working with loadvars

Postby Hblade » Fri Mar 11, 2011 5:03 pm

I tried erasing the if part for DOLOAD, to see if it works anyways, in draw actor even. And still it failed. I made a text actor to tell me the value of BG, and sure enough it was 2 after loading. However the background remained the same for some reason.
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: ChangeAnimation Not Working with loadvars

Postby Game A Gogo » Fri Mar 11, 2011 5:14 pm

and what about DOLOAD?
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: ChangeAnimation Not Working with loadvars

Postby Kodo » Fri Mar 11, 2011 5:14 pm

just before the switch code try setting BG to 2 and see if that works, if it does then it means that when the case is hit BG isn't set correctly, if it doesn't work it may be that the animation(s) isn't set up right.

Code: Select all
BG = 2; // forcing BG to a value to confirm that animations are set up
switch(BG){...
Inogames: http://www.inogames.com iOS gaming
Firetop Adventure (app store): http://itunes.apple.com/us/app/firetop- ... ?mt=8&ls=1
User avatar
Kodo
 
Posts: 449
Joined: Thu Oct 20, 2005 8:20 pm
Location: UK
Score: 23 Give a positive score

Re: ChangeAnimation Not Working with loadvars

Postby Hblade » Fri Mar 11, 2011 5:15 pm

Ill try that now :)
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: ChangeAnimation Not Working with loadvars

Postby Hblade » Fri Mar 11, 2011 5:18 pm

LOL DUDE!!

"water" needs to be changed to "wateranim" OMG LOL
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: ChangeAnimation Not Working with loadvars

Postby Kodo » Fri Mar 11, 2011 5:21 pm

You've got it working?
Inogames: http://www.inogames.com iOS gaming
Firetop Adventure (app store): http://itunes.apple.com/us/app/firetop- ... ?mt=8&ls=1
User avatar
Kodo
 
Posts: 449
Joined: Thu Oct 20, 2005 8:20 pm
Location: UK
Score: 23 Give a positive score

Re: ChangeAnimation Not Working with loadvars

Postby Hblade » Fri Mar 11, 2011 5:30 pm

Yep, it was the animation name O.o
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: ChangeAnimation Not Working with loadvars

Postby Kodo » Fri Mar 11, 2011 6:06 pm

It's often the way, something silly that takes forever to spot. I've done it plenty of times m8 :)
Inogames: http://www.inogames.com iOS gaming
Firetop Adventure (app store): http://itunes.apple.com/us/app/firetop- ... ?mt=8&ls=1
User avatar
Kodo
 
Posts: 449
Joined: Thu Oct 20, 2005 8:20 pm
Location: UK
Score: 23 Give a positive score

Re: ChangeAnimation Not Working with loadvars

Postby Hblade » Fri Mar 11, 2011 6:35 pm

I guess this is caused by being in such a rush and all, you tend to overlook things.
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: ChangeAnimation Not Working with loadvars

Postby lcl » Fri Mar 11, 2011 8:11 pm

:lol:
That happens to me also..
With "Runners" I had problems and I didn't find the reason why player2s' animation didn't work.
Then I found out that I had wrong animation name, just like you.. xD
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: ChangeAnimation Not Working with loadvars

Postby Hblade » Fri Mar 11, 2011 8:13 pm

lol its so frustrating xD
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Next

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest