Peter_wadley
New Member
Hello y'all,
I get so much great help from the members of this forum I would just like to take the time to say.. THANKS!!
I just started programming the Snake game for my PIC16F84a game module (see signature)
I need a bit of help understanding variable use of PICs.
Such as:
Cblock variables..
and EQU variables..
I need to make variables which act as boolean variables.. kind of like digital variables as the PORTS do on the PIC.
What registers of the PIC16F84a can I use as variables?
This is what I want to do:
The snake can either go RIGHT - LEFT - UP or DOWN
There are two buttons one turns the snake LEFT and the other RIGHT
Lets say the snake is moving RIGHT and I press RIGHT ( the snake will move down)
I want to use 4 variables (one for each direction)
The PIC will check these variables to see which way the snake is moving and then change to the next appriopriate postion..
Making sense?
So if its moving RIGHT..
Right_Boolean = 1
Left_Boolean = 0
Up_Boolean = 0
Down_Boolean = 0
I want to be able to say:
Btfsc Right_Boolean
Call Move_Down ; IT IS WAS MOVING Right NOW MOVE Down
Btfsc Left_Boolean
Call Move_Up ; IT IS WAS MOVING Left NOW MOVE UP
Btfsc Down_Boolean
Call Move_Left ; IT IS WAS MOVING Down NOW MOVE Left
Btfsc Up_Boolean
Call Move_Right ; IT IS WAS MOVING Up NOW MOVE Right
Is it possible to do this?
Take Care,
PW
I get so much great help from the members of this forum I would just like to take the time to say.. THANKS!!
I just started programming the Snake game for my PIC16F84a game module (see signature)
I need a bit of help understanding variable use of PICs.
Such as:
Cblock variables..
and EQU variables..
I need to make variables which act as boolean variables.. kind of like digital variables as the PORTS do on the PIC.
What registers of the PIC16F84a can I use as variables?
This is what I want to do:
The snake can either go RIGHT - LEFT - UP or DOWN
There are two buttons one turns the snake LEFT and the other RIGHT
Lets say the snake is moving RIGHT and I press RIGHT ( the snake will move down)
I want to use 4 variables (one for each direction)
The PIC will check these variables to see which way the snake is moving and then change to the next appriopriate postion..
Making sense?
So if its moving RIGHT..
Right_Boolean = 1
Left_Boolean = 0
Up_Boolean = 0
Down_Boolean = 0
I want to be able to say:
Btfsc Right_Boolean
Call Move_Down ; IT IS WAS MOVING Right NOW MOVE Down
Btfsc Left_Boolean
Call Move_Up ; IT IS WAS MOVING Left NOW MOVE UP
Btfsc Down_Boolean
Call Move_Left ; IT IS WAS MOVING Down NOW MOVE Left
Btfsc Up_Boolean
Call Move_Right ; IT IS WAS MOVING Up NOW MOVE Right
Is it possible to do this?
Take Care,
PW