Collision-Problems on my Game "Carrier-Landing"

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
Post Reply
User avatar
zx81jens
Posts: 201
Joined: Sat May 10, 2008 8:26 am
Location: a Basement in Nienburg / Germany

Collision-Problems on my Game "Carrier-Landing"

Post by zx81jens »

Hello User.

I am trying to program a Game, but my basic knowledge of BASIC is very limited - so I have some Problems with the Collision.

The Goal is to land the Plane (yes, I know, it is just a dot ;) ) on the grey Area


grey.JPG
grey.JPG (9.96 KiB) Viewed 2212 times


If you land on the black area, you´ll crash.

The Collision should be in Line 360 ...

Does anyboy can help me with this?? And of course: If anybody have any Ideas to make the Game better: do it... :lol:


CARRIERE.P
(2.94 KiB) Downloaded 113 times


Greetings and thanx
Jens
eyerything will be okay in the end.
if it´s not okay, it´s not the end.

and: uıɐbɐ ʎɐqǝ uo pɹɐoqʎǝʞ ɐ ʎnq ɹǝʌǝ ɹǝʌǝu ןןıʍ ı
dr beep
Posts: 2060
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: Collision-Problems on my Game "Carrier-Landing"

Post by dr beep »

First
line 330 must be
330 LET P=P+1

rest follows later
dr beep
Posts: 2060
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: Collision-Problems on my Game "Carrier-Landing"

Post by dr beep »

362 LET F=P-X-X-1
363 IF F>0 THEN IF F<7 THEN GOTO WIN

You may solve the error that occurs when you land
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: Collision-Problems on my Game "Carrier-Landing"

Post by XavSnap »

Hi Jens,

There is a particularity with the PLOT command… it's like the PRINT AT command !
Using PRINT AT 10,10 set the DF_CC to the display memory offset.

PLOT set the DF_CC on the right display character, after the "dot" character.

Code: Select all

     10 FOR A=0 TO 18
     20 PRINT TAB 17;"½"
     30 NEXT A
    100 FOR B=0 TO 64
    110 PLOT B,10
    120 IF PEEK (PEEK 16399*256+PEEK 16398)<>0 THEN STOP 
    130 NEXT B
Test the next character after the ploted dot. space or grey char.
The bottom character will be tested on :
120 IF PEEK( (PEEK 16399*256+PEEK 16398)+32)<>0 THEN STOP
Left char:
120 IF PEEK( (PEEK 16399*256+PEEK 16398)-2)<>0 THEN STOP
Up char tested on :
120 IF PEEK( (PEEK 16399*256+PEEK 16398)-34)<>0 THEN STOP

Note: Don't use PRINT AT between the PLOT and the IF test...

Have fun !
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
Post Reply