# Proper Player Movement

Page 1/2
| 2

I have been reading on how to create proper 8 player movement and the following code does cover diagonal movement but at the end of the day I only can test for UP, Down, Left and Right.

How do I extrapolate for a Diagonal animation or firing a weapon?

MOVE_PLAYER:
OUT (\$C0), A
NOP
NOP
NOP
IN A, (\$FC)

LD C, A
BIT 0, C
JP NZ, SOUTH

LD A, (IY+02) ; Y Position
DEC A ; Move NORTH
LD (IY+02), A ; Y Position

SOUTH:
BIT 2, C
JP NZ, EAST

LD A, (IY+02) ; Y Position
INC A ; Move SOUTH
LD (IY+02), A ; Y Position

EAST:
BIT 1, C
JP NZ, WEST

LD A, (IY+03) ; X Position
INC A ; Move EAST
LD (IY+03), A ; X Position

WEST:
BIT 3, C
RET NZ

LD A, (IY+03) ; X Position
DEC A ; Move WEST
LD (IY+03), A ; X Position
RET

I believe I only used the BIOS function, and that automatically gives diagonals.

by checking both North and East, for example.
so in your case, both BIT 0 and bit 1 should be NULL.
or (just as example):
in a,(\$FC)
and 3
jr z,NorthEast

Why don't you use just the BIOS.GTSTCK function ?

Metalion wrote:

Why don't you use just the BIOS.GTSTCK function ?

Then it won't be universal and only be tied to MSX 1.

There is a standard when it comes to these things but ChibiAkumas is too busy to help people on a one to one basis.

Chilly Willy wrote:

Then it won't be universal and only be tied to MSX 1

Absolutely not !!!
That function is part of the MSX standard, and is present in all versions of the MSX.

Chilly Willy wrote:
Metalion wrote:

Why don't you use just the BIOS.GTSTCK function ?

Then it won't be universal and only be tied to MSX 1.
There is a standard when it comes to these things but ChibiAkumas is too busy to help people on a one to one basis.

BIOS is standard.
GTSTCK is universal and will work on any MSX.
And BIOS is much easier to use and understand than any ohter alternative.

P.S.: The OUT/IN sequence at the beginning of your code is similar to BIOS RDPSG... but using the wrong ports and an unnecessary wait. Are you sure you are reading MSX code? It looks like a different system (ZX or CPC maybe)?

Thank you everyone for your insight.

Now back to how this is being coded, aside from the BIOS...

When I use this formula a top, forget the ports, which is STANDARD with 8 directional movement.

How do you decipher the diagonal actions to test for firing a round, animation or other.

Should I use a LUT or test for the for Up then immediately for Left or Right.
How is THIS formula used.

Chilly Willy wrote:

Thank you everyone for your insight.

Now back to how this is being coded, aside from the BIOS...

When I use this formula a top, forget the ports, which is STANDARD with 8 directional movement.

...
ok

Chilly Willy wrote:

Should I use a LUT or test for the for Up then immediately for Left or Right.
How is THIS formula used.

Use a LUT to translate the lower nibble to the usual MSX BIOS GTSTCK/MSX-BASIC STICK() directions (1-7), then use a jump table or whatever you need.

Or use a chain of IF..THEN..ELSEs (in assembly, of course; this is just for readability):

```if U then if L then MOVE_UP_LEFT else if R then MOVE_UP_RIGHT else MOVE_UP
else if D then if L then MOVE_DOWN_LEFT else if R then MOVE_DOWN_RIGHT else MOVE_DOWN
else if L then MOVE_LEFT else if R then MOVE_RIGHT else DO_NOT_MOVE
```

ro gave you the answer, a few messages ago.
Just take the time to read it.

Chilly Willy, I've been reading your posts here and there for a few months. Each time, the same scenario happens : you come with a question, saying that you know what you're doing (but effectively showing that you don't). Whenever someone tries to help you, you either show some degree of rudeness, or you just plain don't answer him. And if you do, more over than not, you don't even take the time to thank them.

Don't be surprised if, after some time, no one will answer you any more.
I know I won't.

Chilly Willy wrote:

There is a standard when it comes to these things but ChibiAkumas is too busy to help people on a one to one basis.

What the hell does that even mean ????

Metalion wrote:

ro gave you the answer, a few messages ago.
Just take the time to read it.

Chilly Willy, I've been reading your posts here and there for a few months. Each time, the same scenario happens : you come with a question, saying that you know what you're doing (but effectively showing that you don't). Whenever someone tries to help you, you either show some degree of rudeness, or you just plain don't answer him. And if you do, more over than not, you don't even take the time to thank them.

Don't be surprised if, after some time, no one will answer you any more.
I know I won't.

Chilly Willy wrote:

There is a standard when it comes to these things but ChibiAkumas is too busy to help people on a one to one basis.

What the hell does that even mean ????

I must apologize then.
I am still learning.
But I showed the outline of a structure which is a legitimate programing format.
Those that want to put their two cents in say why do you want to do that and why not this.
I was very specific on the format because it will be UNIVERSAL code and not specific to the MSX.
I want to avoid BIOS commands, the bit structure is not MSX I know that but it was a reference point.

Every time I get into these back and forth I end up offending the same type of cancel dogs when what should of happened is if you don't know then do not say anything.

How many times do I have to say thank you but that is not what I am looking for.
Then someone like you comes along that has to pile on.

BTW...ChibiAkumas is a member of this board who has a youtube channel which teaches universal assembly language.
He is highly respected but of course you knew that being as you wanted to add to the bon fire.

Page 1/2
| 2