[vcf-midatlantic] What's wrong with my program experiment?
Dan Roganti
ragooman at gmail.com
Fri Apr 7 07:01:33 EDT 2017
On Thu, Apr 6, 2017 at 5:38 PM, Evan Koblentz via vcf-midatlantic <
vcf-midatlantic at lists.vintagecomputerfederation.org> wrote:
> some other guy mentioned cross-talk, that's why I posted that link to the
>> 1982 issue which explains how that operates. It also mentions a work
>> around in Assembly code, since adding more delay defeats the purpose of
>> using assembly code. But I'm not sure yet if there's a work around for
>> Basic code, maybe there is, perhaps using the same Kernal Rom Calls. But
>> then your game isn't really time critical as in an assembly program. So
>> you
>> most likely won't suffer any lag.
>>
>
> Yeah I'm happy with how it works now.
>
> Primitive collision detection 101: I added a line that if X=10 and Y=10
> (where I'd made a plot) then switch to text mode and print something. It
> didn't work and I wasn't sure why. Then I remembered the joystick is never
> * exactly * at 10,10, but rather at 10.(lots of decimals). So I put in
> another line saying X=INT(X):Y=INT(Y) to force the whole number. Now when I
> move the joystick to the plot of 10,10 it works.
>
> Per a suggestion at http://www.vcfed.org/forum/sho
> wthread.php?57097-Joystick-problem&p=455221#post455221 I'll probably make
> a version of the game where the plot location is random and if you hit it
> then you found the kitten. :) Non-kitten plot locations could be (gasp)
> educational: you found a minicomputer, you found a tape library, etc., and
> each one would teach you something about that artifact.
>
>
>
yea that's all what collision detection amounted to on the Apple,
just a bunch of IF/THEN's to check the coordinates each time you move
Basically one IF/THEN for each object you place on the grid,
And then if you have walls, that's some more,
but those involve ranges because the wall extends over many pixels, either
for X or Y
So you would use some boolean logic in your IF/THEN's to check these ranges
once you get some practice with that, then you can try using a 2
dimensional array,
this would help you keep track of the objects on the grid,
this will reduce the amount of changes to your code with your IF/THEN's
whenever you change or move the objects
at the beginning of the code you would fill up the array with your objects,
walls, etc
Then you only need one IF/THEN for everything, just compare the current x,y
position to the 2-D array
If the contents of the 2-D array is occupied, ie "not zero", then you hit
the object
This also allows assigning hit values to each object, within the array
eg, if one object has a bigger value, you get a bigger bonus if you hit
that one
Dan
More information about the vcf-midatlantic
mailing list