[vcf-midatlantic] Collision detection 101

Dan Roganti ragooman at gmail.com
Sat Apr 8 11:28:14 EDT 2017


On Sat, Apr 8, 2017 at 12:36 AM, Evan Koblentz via vcf-midatlantic <
vcf-midatlantic at lists.vintagecomputerfederation.org> wrote:

> Get rid of the flicker
>>
>
> How?
>
> When I reduced the redrawing speed (for-next delay) then the flicker
> lessens but the point movement is clunky vs. physical joystick movement.
> That's a reality of doing this in BASIC: I've got to keep looping for the
> joystick input and replotting the coordinates.
>
> If you know a trick around this then teach me, Obi-Dan.
>
>
>

​I'm not sure what the latest code you have so far
I'm just going by this you posted a few days ago
10 GR:COLOR=2
20 PLOT 10,10
30 X=PDL(0):Y=PDL(1)
40 X=X/6.4:Y=Y/6.4
50 X=X+0.5:Y=Y+0.5
60 X=INT(X):Y=INT(Y)
70 IF X>39 THEN X=39:IF Y>39 THEN Y=39
80 PLOT X,Y:PRINT INT(X),INT(Y)
90 FOR W=1 TO 50: NEXT W
100 COLOR=0:PLOT X,Y:COLOR=2
110 GOTO 30​

In your code,
you continually refresh the screen by overwriting the "sprite" with another
one,
even if you're at the same coordinates, which produces the flicker.

Basically,
even though the computer has memory, doesn't mean the software knows how to
use it, you have to tell it.
The first method of creating memory is to use a variable, ie. "Remember
what I have"
And that's what every beginning programmer learns to use.

But,
sometimes you need to have a sort of persistent memory, ie. "Remember what
I did"
So you need another level of variables to save the last move, eg, your last
X,Y coordinates
And so you would compare the current coordinates to the previous
coordinates,
If they are equal, that means you didn't move and so you're sitting in the
same spot,
then there is no need to refresh the screen, eg. don't jump to subroutine
'Refresh' <hint>
and the flickering will stop
Dan



More information about the vcf-midatlantic mailing list