Author Topic: Basic Efficient Collision Detection Routine  (Read 1836 times)

0 Members and 1 Guest are viewing this topic.

Offline ZbyniuR

  • CPC6128
  • ****
  • Posts: 293
  • Country: pl
  • 6128 A1230 PSX Win7
    • Jedyne polskie forum o CPC. :)
  • Liked: 285
Re: Basic Efficient Collision Detection Routine
« Reply #25 on: 02:03, 01 April 18 »
10 FOR a=1 TO 17:POKE 39999+a,VAL("&"+MID$("DD7E00CDB4BBF5CD60BB320000F1C3B4BB",a*2-1,2)):NEXT
20 LOCATE x,y:CALL 40000,0:PRINT CHR$(PEEK(0)) '  this works as COPYCHR$ in any CPC

I used to found this in some magazine. :)

And remember about TEST command, could be usefull to detect pixel color. :)
TREK is better than WARS.

Offline mr_lou

  • 6128 Plus
  • ******
  • Posts: 2.699
  • Country: dk
    • index.php?action=treasury
    • 8-bit Memoirs - a Blu-ray diskmag-like eBook about the 8-bit era
  • Liked: 917
Re: Basic Efficient Collision Detection Routine
« Reply #26 on: 19:01, 13 October 18 »
10 FOR a=1 TO 17:POKE 39999+a,VAL("&"+MID$("DD7E00CDB4BBF5CD60BB320000F1C3B4BB",a*2-1,2)):NEXT
20 LOCATE x,y:CALL 40000,0:PRINT CHR$(PEEK(0)) '  this works as COPYCHR$ in any CPC
This is great!
Can someone turn this into an RSX command please?  :)
What are the BASIC lines to create a small RSX command like |charCodeAt(x,y)Returns ASCII code for the character at location x,y
Or |code(x,y)

Offline asertus

  • CPC464
  • **
  • Posts: 23
  • Country: es
  • Liked: 17
Re: Basic Efficient Collision Detection Routine
« Reply #27 on: 21:41, 13 October 18 »
Basically all these are already implemented as RSX by 8 bits de poder i.e.:


|COLAY,umbral_ascii, #,@colision detecs collission with layout and returns 1 if true
|COLSP, #,@id returns 1st sprite collision with #
|COLSPALL,@quien%,@conquien% returns "quien" has collided and with whom

Offline mr_lou

  • 6128 Plus
  • ******
  • Posts: 2.699
  • Country: dk
    • index.php?action=treasury
    • 8-bit Memoirs - a Blu-ray diskmag-like eBook about the 8-bit era
  • Liked: 917
Re: Basic Efficient Collision Detection Routine
« Reply #28 on: 07:34, 14 October 18 »
Basically all these are already implemented as RSX by 8 bits de poder i.e.:

|COLAY,umbral_ascii, #,@colision detecs collission with layout and returns 1 if true
|COLSP, #,@id returns 1st sprite collision with #
|COLSPALL,@quien%,@conquien% returns "quien" has collided and with whom

It doesn't look like the same to me. There's a difference between a sprite and an ASCII character.

These are commands that checks for collision. That's not what I'm asking for. I just want to be able to get the ASCII code for the character on a certain location on the screen. The above BASIC code does that. All I need now is to turn it into an RSX command - and include the LOCATE command in the RSX as well. so I can call |charCodeAt,x,y  :)