#Pacman

1 messages ยท Page 1 of 1 (latest)

slow coral
#

Good morning,
I'm trying to code the Game pacman in Java and I decided to have two windows; one with the maze and one with the buttons to move the pacman. Unfortunately for me, my pacman is not moving so I decided to do a SYSTEM.OUT.PRINTLN inorder to understand why and I observed that I always get back zero. My questions goes thus,

  1. Why am I always having zero.
    2)How can I do to fix this.
    I'm open to all possible solutions and advice
    Thanks in advance
valid driftBOT
#

<@&987246399047479336> please have a look, thanks.

eager tangle
#

Could you share the specific function? Also keep in mind a lot of people here don't know French.

next fern
#

besides some weird coding things that u or your teammate is doing, is the logic in drawPacMan even triggered ?

slow coral
next fern
#

and the button events are triggerd ? ( looks like u had syso's in the events to test )

slow coral
next fern
#

right onto next step then

slow coral
#

What do you mean by syso's in the events to test ??

next fern
#

that gap there is an indication that either a syso was there or a log line ๐Ÿ˜‰

next fern
#

still reading the code, but here's a note that u need to make for yourself

#

why make getters and setters and then make the variable public and not use them ?

#
if (dep.dep_x == -1) {

vs

    public int dep_x;
    public int getDep_x() {
        return dep_x;
    }

valid driftBOT
next fern
#

makes no real sense to do that

#

also ( and im not sure , but this looks like the culprit

#
if ((pac.getPacmand_x() == -1 && pac.getPacmand_y() == 0 && (ch & 1) != 0)
                    || (pac.getPacmand_x() == 1 && pac.getPacmand_y()== 0 && (ch & 4) != 0)
                    || (pac.getPacmand_x() == 0 && pac.getPacmand_y() == -1 && (ch & 2) != 0)
                    || (pac.getPacmand_x() == 0 && pac.getPacmand_y() == 1 && (ch & 8) != 0)) {
                pac.setPacmand_x(0);
                pac.setPacmand_y(0);
            }
valid driftBOT
next fern
#

if u nuke that logic to the difference , your always setting 0

#

if x = -1 or x = 1 or y=-1 or y=1

#

same with the one higher

slow coral
#

I'm really sorry but I got lost in your explanations

next fern
#

well read your logic

#

u check if going left , or going right, or going up or going down