Log in

View Full Version : Bug? If so can I have some help?



???
07-05-2007, 11:44 PM
I am trying to get collisions, but IF statements are giving me pain. Only the first 2 work, whichever those are. I've tryed switching them, and I've tried variables, but it doesn't work. Well, here's the mess:
if (pacman.up.hitTest (wall)) {
creatures["Pacman"]["Moving"] = "up";
}
else {
if (pacman.down.hitTest (wall)) {
creatures["Pacman"]["Moving"] = "down";
}
else {
if (pacman.left.hitTest (wall)) {
creatures["Pacman"]["Moving"] = "left";
}
else {
if (pacman.right.hitTest (wall)) {
creatures["Pacman"]["Moving"] = "right";
}
else {
creatures["Pacman"]["Moving"] = "all";
}
}
}
}

I also looked at a thing on switches, but they didn't seem like they would work... Any help?

Medyman
07-06-2007, 02:15 AM
It's hard to know what's happening without more code.

What I would do is add trace functions throuout this piece of code. This way you know which parts are exceuting and which aren't.

From that information, you'll be able to trace which functions are giving you an error.

didlo
07-06-2007, 06:15 AM
there are some good introductory games writing tutorials here http://oos.moxiecode.com/ which should cover what you are trying to do.

Hope this helps.

???
07-21-2007, 08:39 PM
Thanks. Tracing did help, but it wasn't script after all. I had movie clips for the sides of pacman, and it was them. It's fixed now. Also, I think I'll look at the tutorials.