when exported, code doesnt work

Non-platform specific questions.

when exported, code doesnt work

Postby Toasterman » Mon Dec 20, 2010 4:07 am

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
"If there are no stupid questions, what kind of questions do stupid people ask? Do they get smart just in time to ask a question? -Scott Adams

Hey! I've got okayish internet now! Now I can try all those cool demos I've seen!
User avatar
Toasterman
 
Posts: 75
Joined: Thu Jul 22, 2010 4:22 am
Location: Drowning in Dial-Up Ocean
Score: 7 Give a positive score

Re: when exported, code doesnt work

Postby schnellboot » Mon Dec 20, 2010 2:07 pm

I think it's a bug ..
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

Re: when exported, code doesnt work

Postby DST » Wed Dec 22, 2010 1:17 am

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.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: when exported, code doesnt work

Postby Toasterman » Wed Dec 22, 2010 3:24 am

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!)
"If there are no stupid questions, what kind of questions do stupid people ask? Do they get smart just in time to ask a question? -Scott Adams

Hey! I've got okayish internet now! Now I can try all those cool demos I've seen!
User avatar
Toasterman
 
Posts: 75
Joined: Thu Jul 22, 2010 4:22 am
Location: Drowning in Dial-Up Ocean
Score: 7 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest