Results 1 to 1 of 1

Thread: [HELP] PacMan Final Project

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2014
    Posts
    3

    [HELP] PacMan Final Project

    I have attached my PacMan Final Project source code below. The reason why I am seeking help is because I have been experiencing minor/major bugs in my program, but I don't know how to handle them.

    1) Wall Glitch:

    -When Pacman turns too early, he hits a wall (perfectly understandable); however, the program is supposed to keep moving Pacman in the same direction until there is no wall. When the program detects no wall present, Pacman can then turn. In other words, if the user holds W to turn upwards (I am using theWASD method) but he is next to a wall, Pacman should not turn upwards into the wall. He should continue going the same direction until he can no longer collide with a wall.

    2) Initial Pause At Game Start:

    -When the program is executed, the game should not start until a direction is pressed (WASD). NOTHING should be active. The way I have it currently setup, when I execute the program, the red ghost starts moving.

    3) Pacman Mouth Movement:

    -I have made many attempts too make his mouth move. When I used a .gif file Pacman flickers violently (frame distortion). Can I use a timer for this as well?

    4) Pacman and Ghosts Location Reset:

    -I'm using EdibleGhost as a Boolean so when Pacman intersects with the 4 bigger foods, EdibleGhost= true and Pacman can then intersect with the Ghost without losing a live and the ghost should be sent back to the point at which it started. If EdibleGhost= false, the game should pause, Pacman should be sent back to the location at which he started and he should lose one life.

    Code:
    Sub DoGhosts()
            For Each ghost In GhostCollection
                Call HideBigFood()
                If EdibleGhost = False Then
                    If ghost.Bounds.IntersectsWith(picPacman.Bounds) Then
                        PacManLives -= 1
                        Console.Beep()
                        System.Threading.Thread.Sleep(1000)
                        picPacman.Location = New Point(647, 392)
                        PacDirection = PacMove.Right
                    End If
                End If
                If EdibleGhost = True Then
                    If ghost.Bounds.IntersectsWith(picPacman.Bounds) Then
                        GhostRed.Location = New Point(647, 260)
                    End If
                End If
            Next
        End Sub
    The problem I face though, is that when EdibleGhost=true and Pacman intersects with the ghost, the ghost doesn't return to the spawning point. It kind of "doubles" when Pacman intersects with it. A ghost appears at the respawn point, but the actual ghost is still at the location of when Pacman intersected with it. And when Pacman crosses over the ghost, the ghost that appeared at the spawn point disappears and the one the Pacman intersected with jut keeps moving like nothing happened.

    A little help with this would be much appreciated as I have spent 3 days on this and I can't seem to fix the above mistakes.

    **I can upload the whole project if anyone needs it
    Attached Files Attached Files

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width