If Left is #%00000110, what are the other directions?

puppydrum64

Active member
I'm trying to code a new AI Behavior to make a monster move up and right off the screen. I know I've seen a list of binary codes representing the 8 different directions somewhere in the .asm files for one of my projects but I can't find it now. Can someone tell me what the other directions are?
 

Subotai

Active member
I'm using MetroVania module, but I've tried all the combinaison to discover all the direction but, here it is :

Down : 00000000
Down Right : 00000001
Right : 00000010
Up Right : 00000011
Up : 00000100
Up Left : 00000101
Left : 00000110
Down Left : 00000111
 

dale_coop

Moderator
Staff member
You can find all those constant values in your "systemConstants.asm" script

2020-12-29-17-21-16-Project-Settings.png


2020-12-29-17-22-21-Param-tres.png
 

puppydrum64

Active member
You can find all those constant values in your "systemConstants.asm" script

2020-12-29-17-21-16-Project-Settings.png


2020-12-29-17-22-21-Param-tres.png
This is the code I'm working with, this is the Move Left AI Behavior in the Shooter Module:
Code:
    TXA 
    STA tempA
    LDA #%00000110  ;; "left"
    TAY
    LDA DirectionTableOrdered,y
    STA tempB
    LDA FacingTableOrdered,y
    STA tempC
    StartMoving tempA, tempB, #$00
    ChangeFacingDirection tempA, tempC

The picture you showed me has "Left" as #%10000000 and FACE_LEFT as #%00000110. Why is the code loading FACE_LEFT into the accumulator? Shouldn't it be loading #%10000000? And where can I find DirectionTableOrdered and FacingTableOrdered?
 

CutterCross

Active member
The picture you showed me has "Left" as #%10000000 and FACE_LEFT as #%00000110. Why is the code loading FACE_LEFT into the accumulator? Shouldn't it be loading #%10000000? And where can I find DirectionTableOrdered and FacingTableOrdered?
FACE_LEFT is a constant. It gets replaced with the value it represents during compile. (Namely, #%00000110). You can write that code like this and it would make no difference to the compiler.
Code:
    TXA
    STA tempA
    LDA #FACE_LEFT
    TAY
    LDA DirectionTableOrdered,y
    STA tempB
    LDA FacingTableOrdered,y
    STA tempC
    StartMoving tempA, tempB, #$00
    ChangeFacingDirection tempA, tempC


DirectionTableOrdered and FacingTableOrdered are tables that hold the direction and facing direction data for objects. That's why it's using absolute addressing with the facing direction constants (or rather, the values they represent) to grab the specific data from those tables corresponding with that offset.
 
Top Bottom