|
Post by Jonathan Cauldwell on Nov 9, 2020 23:10:47 GMT
I've created a Z80 user routine for rotational controls. To use it, download the attached file and select it as your user routine. You can then move a sprite in any of 256 directions by setting DIRECTION and then using USER S where S is the speed, speeds of 0 - 8 are probably going to be most useful. The routine will not move through wall blocks, but it is a little more forgiving than CANGOUP, CANGODOWN etc because rotational sprites are likely to have gaps around their edges. For something like a slow-moving tank you'd use some code like this in the player event: EVENT PLAYER
IF KEY LEFT SUBTRACT 4 FROM DIRECTION ENDIF
IF KEY RIGHT ADD 4 TO DIRECTION ENDIF
IF KEY UP USER 3 ENDIF
For a little momentum you could write something more like this: EVENT PLAYER
IF KEY LEFT SUBTRACT 4 FROM DIRECTION ENDIF
IF KEY RIGHT ADD 4 TO DIRECTION ENDIF
IF KEY UP IF S < 8 ADD 1 TO T IF T > 4 LET T = 0 ADD 1 TO S ENDIF ENDIF ELSE IF S > 0 IF T = 0 LET T = 5 SUBTRACT 1 FROM S ENDIF SUBTRACT 1 FROM T ENDIF ENDIF
; Move player. USER S
I'll put this new user routine in the next download. Meanwhile, have fun playing with it. Attachments:RotationalMovement.asm (5.62 KB)
|
|
|
Post by oss003 on Nov 10, 2020 8:29:22 GMT
Jonathan, selecting the user routine in v0.7.10 doesn't work any more ...... it works in v0.7.9 BTW nice routine ...
|
|