Jump to content
  • entries
    106
  • comments
    796
  • views
    140,758

Looks the same - but oh so different!


vdub_bobby

831 views

OK, NOT THAT DIFFERENT. But I did free up seven bytes of RAM, which is pretty huge. I finally wrapped my mind around supercat's fractional-position replacement - it was a little tricky because, unlike his example (16 speeds between 0 and 2 lines per frame) I wanted 64 speeds between 1/2 and 2 lines per frame (LPF). I ended up going with 64 speeds between 1/2 and 2 1/2 LPF, using a counter which goes from 0 to 32 and a 128-byte table (i.e., thirty-two 32-bit entries). I realized about halfway through coding this that, since my counter tops out at a power of two, I could just use the frame counter (which is a byte of RAM that is decremented every frame, going from 255-0 continuously). So I ended up saving all seven bytes which were being used for fractional elevator position. :)

 

So no apparent changes except that all the elevators except the slowest are a little bit faster: ElevRep20061109.bin

blog-6060-1163107210_thumb.png

8 Comments


Recommended Comments

So do you like the stateless fractional movement trick now that you understand it?

Heck yes I do! :D Saved me some RAM - plus, I've never really liked fractional positioning: it is great when your velocity is < 1 pixel per frame but kind of a pain when your velocity is >= 1 pixel per frame. My fractional positioning code usually looks something like this:

   lda FractionalPosition
  clc
  adc Velocity
  sta FractionalPosition
  lda IntegerPosition
  adc #0
  sta IntegerPosition

All very neat and tidy, but you cannot move faster than 255/256 pixels per frame with this method. ;) Annoying!

 

So I usually end up calling the fractional position routine several times per frame, which works just fine but is a bit of a time waster.

 

With this routine I call it once and it works great. :D Thanks again.

 

 

Too bad it won't work for situations (most of them) where the speed changes in mid-"air."

Link to comment
   lda FractionalPosition
  clc
  adc FractionalVelocity
  sta FractionalPosition
  lda IntegerPosition
  adc IntegerVelocity
  sta IntegerPosition

Link to comment

IMHO, the elevators are moving too fast. I liked the speed they were going before.

 

There fast but I get through fairly often.

Link to comment

   lda FractionalPosition
  clc
  adc FractionalVelocity
  sta FractionalPosition
  lda IntegerPosition
  adc IntegerVelocity
  sta IntegerPosition

Thanks; I'll keep that in mind. ;)

Link to comment

IMHO, the elevators are moving too fast. I liked the speed they were going before.

 

A little faster than before indeed, although not too difficult. The bigger problem is there's no delay between when you get hit and it lets you try running to the side again. In my case, if I got hit by the first elevator, I wouldn't be able to stop pushing to the side fast enough and before I knew it I was missing 5 lives. ;)

 

I'd find it amusing if the maid fell off the screen similar to how mario would when he got hit in Mario Brothers. (It would certainly take care of the needed delay. :D )

Link to comment
I'd find it amusing if the maid fell off the screen similar to how mario would when he got hit in Mario Brothers. (It would certainly take care of the needed delay. :D )

That's not a bad idea...;)

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...