Jump to content
  • entries
    312
  • comments
    862
  • views
    245,366

Leprechaun, player movement musings

Sign in to follow this  
Guest

446 views

So, I've reviewed the source code and re-aquainted myself with it. Since the kernel and the sort routines are working, my next focus is on player movement. From a code perspective this will turn into a bunch of IF statements, but first I need to come up with the truth table to ensure no conditions get missed. I'm doing this in a spreadsheet. Each row is one set of conditions. I take a generic condition (e.g. Grid = open) and break it into two conditions (Grid = open & Grid_Down = {Gold,Open,Hole,Rope} and Grid = open & Grid_Down = {Dirt,Rock,Ladder} ) then assign results to each (falling, & more conditions required).It's going to be interesting to change this into code, but it make sure I don't miss any possibilities and have thought through each "what happens if".Right now my plan is to handle player input/enemy AI & movement on a round-robin basis. So each frame only one sprite will move. The only exception to this is falling, which will be handled via a sprite index counter 180 degrees out of sync with the main counter.Now, the main disadvantage of handling it this way is both the player and the enemy will move at the same speed. The alternative is to use fractional positioning and move every sprite every frame. But that may be tough to sync with handling player input & enemy AI only every N frames.The reason for doing the player input & enemy AI only every N frames is to save clock cycles. Since I have to decode the bitmap for a lot of the decisions, that's going to take a lot of processing power.

Sign in to follow this  


2 Comments


Recommended Comments

I'd be interested in knowing you you translate player position to playfield bitmap position for things like chopping through the floor.

 

I have to do something like this in Death Derby.

 

It looks like in my case it's going to have to be table driven.

Share this comment


Link to comment
I'd be interested in knowing you you translate player position to playfield bitmap position for things like chopping through the floor.

I'm working on this chunk of code right now. But here's a preview:

 

; get grid data for position X (A register), Y (Y register)

GETGRID

LSR

LSR ; assume on grid, implicit CLC

TAX

LDA XBANK,X

STA PTR+1

LDA #$08

STA PTR

LDA XFBIT,X

TAX

LDA #$80

STA GGOUT

GGLOOP

TXA

AND (PTR),Y

BEQ GGSKIP

SEC

GGSKIP

ROR

INY

BCC GGLOOP

RTS

Share this comment


Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...