PDA

View Full Version : easy enemy AI help


alphabet_monster
08-11-2006, 08:50 PM
I have a frog called greenfrog. I have a main character called bubMC. the frogs movieclip has a period when he's jumping. On the jumping frame I mad greenfrogjump = true and when he's not jumping I made greenfrogjump = false. Shouldn't this code work?

function frog_move
if (greenfrogjump = true) {
if ((bubMC._x - greenfrog._x) > 0) {
greenfrog._xscale = -100;
greenfrog.xmov = 5;
} else if ((bubMC._x - greenfrog._x) < 0) {
greenfrog._xscale = 100;
greenfrog.xmov = -5;
}
} else if (greenfrogjump = false) {
greenfrog.xmov = 0;
}
greenfrog._x = xmov + greenfrog._x
}

Thanks for any help!

jharmon
08-11-2006, 09:47 PM
need == instead of = in your if stmts

if (greenfrogjump == true)

alphabet_monster
08-11-2006, 10:49 PM
thanks, I'll try it.

alphabet_monster
08-11-2006, 10:51 PM
it says '(' expected on 'if (greenfrogjump = true) {' for some reason

jharmon
08-11-2006, 10:54 PM
can you post that whole chunk of code from before with the changes made?

its just a simple syntax error, a curly brace or something not matching...

alphabet_monster
08-11-2006, 11:07 PM
nevermind. I figured it out. Thanks for helping though, I didn't know about that doiuble equals sign. That'll definetly help me in the future.