easmith Posted February 13, 2018 Share Posted February 13, 2018 (edited) This was buried in my previous thread , so I thought I would start a new one... One question I never asked was this :Incrementing x or y position of enemy 1 pixel/scanline per frame creates the relatively slow movement in waves 1 and 2 of my game. In wave 3 to 8 , the movement is 2 pixel/scanline per frame ( at least in one direction), and this is quite an abrupt ramp up in speed.I tried moving one pixel , then moving two , then one, or waiting a frame ,but that just created jerky movement .Are there any tricks for more finely controlling speed of movement ? Specifically, something in between my two speeds . With other processors you can just add a delay ( like nops) at the end of the program loop, but here you have to keep up with TV picture.... Surely there are games with AI movements that are between 1 and 2 pixels per frame. I am certainly missing something obvious. Edited February 13, 2018 by easmith Quote Link to comment Share on other sites More sharing options...
+SpiceWare Posted February 13, 2018 Share Posted February 13, 2018 search on fractional or subpixel https://alienbill.com/2600/cookbook/subpixel.html 1 Quote Link to comment Share on other sites More sharing options...
easmith Posted February 15, 2018 Author Share Posted February 15, 2018 (edited) search on fractional or subpixel https://alienbill.com/2600/cookbook/subpixel.html But how does this affect positioning routine? The positioning routine I am using is from Collect I believe, and loops through bytes which are in order xp1, xp0 to position p1 and p0 . now that my p1 x is two bytes , how should I adjust? Is it just using the integer byte for x positioning ? This seems to work for controlling speed a bit , but I have a jitter again now in my enemy movement when they are near the left side of screen .Perhaps it is something else causing the jitter, my cycles must be off . Edited February 15, 2018 by easmith Quote Link to comment Share on other sites More sharing options...
+SpiceWare Posted February 15, 2018 Share Posted February 15, 2018 You don't have to keep the 2 bytes next to each other. Instead of changing ObjectX: ds 5 ; player0, player1, missile0, missile1, ball to this: ObjectX: ds 10 ; player0, player1, missile0, missile1, ball you could change it to this: ObjectXlow: ds 5 ; player0, player1, missile0, missile1, ball - FRACTIONAL part of position ObjectXhigh: ds 5 ; player0, player1, missile0, missile1, ball - INTEGER part of position then your position object routine becomes: PositionObjects: ldx #4 ; position all objects POloop lda ObjectXhigh,x ; get the object X position jsr PosObject ; set coarse X position and fine-tune amount dex ; DEcrement X bpl POloop ; Branch PLus so we position all objects sta WSYNC ; wait for end of scanline sta HMOVE ; use fine-tune values to set final X positions Quote Link to comment Share on other sites More sharing options...
easmith Posted February 15, 2018 Author Share Posted February 15, 2018 ok that did it. Since I am only positioning 2 objects and only one fractional, I was able to define XPosPlayer .byte XPosAhigh .byte XPosAlow . byte in that order and the routine works. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.