Page 1 of 1

when exported, code doesnt work

PostPosted: Mon Dec 20, 2010 4:07 am
by Toasterman
One of the enemies in my game is a bat. The bat is asleep until it "detects" you (when you walk close to it).
At this point it "wakes up" and flies into you.
It all works great normally, but when I exported it, the bats don't move as they should. That is to say, they don't move at all!

If it matters, how my bat work is this:
it has two animations- "open" and "fly"
it starts with it's animation stopped on "open", but when it "detects" you, the animation resumes
after the animation ends (in which the bat opens its eyes + spreads wings), it changes animation to "fly"
now the bat's angle is set (via draw actor) to follow the player and it's directional velocity is set to 2

Working properly the bat will fly at the player (recoiling after it hits) and home in; it does this fine in game mode, but when exported they change animations
properly, but don't move at all

I doubt there is anything wrong with my code as it does work normally. Does the exported version of a game work differently in how it uses variables or something?
Is this a bug or did I not set something up right? Anybody experienced something like this? If this doesn't make sense, I can explain better

Re: when exported, code doesnt work

PostPosted: Mon Dec 20, 2010 2:07 pm
by schnellboot
I think it's a bug ..

Re: when exported, code doesnt work

PostPosted: Wed Dec 22, 2010 1:17 am
by DST
There are actually lots of things that can cause this, it would be best for you to show the code that the bat uses.

One thing that happens in editor mode, is that it allows you to run the game without specifying everything - sometimes certain things need to be specified, but you don't realize it till you export the game.

For instance, you can clone actors in editor mode and refer to their cloneindex; but those cloneindexes may not be the same, and not in the same order when you export the game, even though it worked fine in editor mode.

Or perhaps you have actors, one over the other in editor mode, and then you export, and the other one is on top - if you didn't set zdepth in editor mode.....two objects with the same zdepth a prime example of something that will cause unexpected behaviour in exported game but not in the editor.

Re: when exported, code doesnt work

PostPosted: Wed Dec 22, 2010 3:24 am
by Toasterman
Thanks DST (again!) :D

I kinda figured the exported version must differ in how some things work -I had noticed some weird z depth goings on
I wasn't able to identify anything in particular that was wrong, but after basically coding it from the ground up, it seems to work now

I didn't post the code itself because there are maybe 9 or 10 conditions (creator actor, draw actor, etc.), some with a half page of code or so, and I wasn't sure there was a problem with the code anyway.

Incidentally, my project is coming along pretty well-
I hope to post it in about a week or so (he says as he burns the incense, dances around the ashes, and waves an anti jinx baton in the air!)