Results 1 to 4 of 4

Thread: Bug? If so can I have some help?

  1. #1
    Join Date
    May 2006
    Location
    Alaska
    Posts
    163
    Thanks
    5
    Thanked 2 Times in 2 Posts

    Default Bug? If so can I have some help?

    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?

  2. #2
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    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.

  3. #3
    Join Date
    Jul 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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.

  4. #4
    Join Date
    May 2006
    Location
    Alaska
    Posts
    163
    Thanks
    5
    Thanked 2 Times in 2 Posts

    Default

    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •