RetroChallenge #3, part 4, The Aliens are done.
OK! This was fun!.
Then, yeah, I made it so that only one alien will move in each loop. This, of course speed up the game.
And then I realized that there was a lot of speed being wasted somewhere else.
You see, the aliens and the player are 8×8 sprites. And every time an alien moves, the H and V positions change by 8
350 IF Y*8V(A) AND PPOINT(H(A)+4,V(A)+12)=1 THEN V(A)=V(A)+8
370 IF X*8H(A) AND PPOINT(H(A)+12,V(A)+4)=1 THEN H(A)=H(A)+8
But, for whatever reason, the player’s X and Y change by one, and then the sprite is PUT in X*8, Y*8
140 IF PEEK(341)255 AND Y>0 THEN IF PPOINT(X*8+2,Y*8-6)=1 THEN Y=Y-1
150 IF PEEK(342)255 AND Y0 THEN IF PPOINT(X*8-6,Y*8+2)=1 THEN X=X-1
170 IF PEEK(344)255 AND X<31 THEN IF PPOINT(X*8+10,Y*8+2)=1 THEN X=X+1
….
260 PUT(X*8,Y*8)-(X*8+7,Y*8+7),J,PSET
This means that every time I PUT, and check for collision, slow multiplication has to be used.
By changing it to work as the aliens already did, everything is again a bit faster.
One of the changes I made caused the aliens not to be drawn until they move. It actually seemed kind of cool, so I left it like that.
And I think that the final change is that the difficulty level now influences how far away from the start is the victim going to be.
Wanting to see how much faster or slower the game was, I used the TIMER variable, which “tics” 60 times in a second. By setting it to 0 at the start of the loop, and printing it at the end, I could get a fairly decent idea of the game’s “framerate”.
The original took from 13 to 20 tics, while the new one took… between 8 and 20!
Success! Not only the game looks and plays a bit better, but it is also faster!
Let’s take a look at the remixed “Aliens”
I hope you like it, at least a bit.
And, in case you are curious, here is the source code for the Remix and for the Original versions.
Pingback: RetroChallenge #3, part 5. Roulette | Diego Barizo