Resource centre for ZX Spectrum games
using Manic Miner and Jet Set Willy game engines
Archive of the
Manic Miner & Jet Set Willy Yahoo! Group
messages
| Previous message | Next message | |||
| Previous in thread | ||||
Message: 6008
Author: john_elliott_uk
Date: 31/12/2006
Subject: Re: "Speed" of horizontal guardians
In manicminerandjetsetwilly@yahoogroups.com, equin0x80 wrote:
The JSW Tech Page doesn't mention any flag in the "horizontal
guardian" block indicating the guardian's speed (i.e. movement "step
size" in pixels per cycle).
That's because they all move at one speed (except in JSW128 and
JSW64, where they can move at double or half speed).
I also noticed that the Bathroom dumbbells were sailing along
constantly instead of rolling on the spot and *then* falling
forward, so I changed my four-pixels-per-frame to
16-pixels-per-animation-loop (i.e. animate fully on the spot
and then move), which still didn't look right.
It should work, provided you move the guardian when the correct
frame is reached. Here's the original horizontal guardian movement code:
org #9133
bit 7, (ix+0) ; Direction
jr nz, h_right
ld a, (ix+0) ; Going left
sub #20 ; Decrease frame number
and #7F ; Keep frame in the range 0-3
ld (ix+0), a
cp #60 ; Is the new frame number 3?
jr c, done ; If not, that's it
ld a, (ix+2) ; Get X-coordinate
and #1F
cp (ix+6) ; At left end of travel?
jr z, h_goright
dec (ix+2) ; If not, move left one character
jr done
;
h_goright:
ld (ix+0), #81 ; Now heading right, start on frame 4
jr done
;
h_right:
ld a, (ix+0)
add a, #20 ; Increase frame number
or #80 ; Keep frame in the range 4-7
ld (ix+0), a
cp #A0 ; Is the new frame number 4?
jr nc, done
ld a, (ix+2) ; Get X-coordinate
and #1F
cp (ix+7) ; At right end of travel?
jr z, h_goleft
inc (ix+2) ; If not, move right one character
jr done
;
h_goleft:
ld (ix+0), #61 ; Now heading left, start on frame 3
jr done
You may also find j128guard.cxx in JSWED instructive: that has a C++
version of the above algorithm in among all its other guardian
movement code.
| Previous message | Back to the Yahoo! Archive home page |
Next message | ||
| Previous in thread | ||||
