Author Topic: Map bitwise and octagonal movements (N NE E SE S SW W NW) @Bplus  (Read 3504 times)

0 Members and 1 Guest are viewing this topic.

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Map bitwise and octagonal movements (N NE E SE S SW W NW) @Bplus
« on: September 01, 2018, 08:11:12 pm »
Hi Bplus

your thinking about map and movement have brougth me to combine square cell to octagonal movements....
Quote
I have just realized a problem with bitwise walls, it is incompatible to diagonal movements and thusly the Pathfinder problem that was part of what got me going with maps.

Maybe walls:
north = 1
northeast = 2
east = 4
southeast = 8
south = 16
southwest = 32
west = 64
north west = 128
 

so see this code....
Code: QB64: [Select]
  1. _TITLE "B+ Flying Hero Mod of TempodiBasic Trap Mod of Terri Ritchie Simple Map Demo, 2018-08-21"
  2.  
  3. '*
  4. '* Bitwise math demonstration
  5. '*
  6. '* Draws a simple map and allows player to move circle within map
  7. '* rapresentation using a clockwise power of 2 for each segment first the 4 basilar
  8. '*   and then the 4 diagonal   for optional directions
  9. '* as       picture      power of 2 (2^n)         result of 2^n
  10. '*            __            0                          1                     N
  11. '*           /  \          7 4                      128  16               NE   NW
  12. '*           |  |         3   1                    8       2             E       W
  13. '*           \  /          6 5                      64   32               SE   SW
  14. '*            --            2                          4                     S
  15.  
  16. '* example of how the value of cell in the map changes using octagonal movement controls
  17.  
  18. '*  a closed box    squared wall scoring        octagonal wall scoring
  19. '*      --          1+2+4+8= 15                  1+2+4+8+ 16+32+64+128=255
  20. '*     |  |
  21. '*      --
  22. '*  a U box    squared wall scoring        octagonal wall scoring
  23. '*                 2+4+8= 14                  2+4+8+ 32+64+128+16=
  24. '*     |  |        or 15 - 1 = 14               14 +  oblique directions forbidden
  25. '*      --
  26. '*  a C box    squared wall scoring        octagonal wall scoring
  27. '*      --          1+4+8= 13                  1+4+8+ 64+128=205 moving NW W SW
  28. '*     |            or 15-2 =13
  29. '*      --
  30. '*
  31. '* squared wall      15  14   13  12  11 10   9   8  7  6  5  4  3  2  1 0
  32. '*
  33.  
  34. '--------------------------------
  35. '- Variable Declaration Section -
  36. '--------------------------------
  37. DEFSNG A-Z
  38. 'Window
  39. CONST WW = 800 'Width
  40. CONST WH = 600 'Height
  41.  
  42. 'Map active arena
  43. CONST MAPW = 5 'Width
  44. CONST MAPH = 5 'Height
  45. CONST SQ = 50 'Tile size
  46.  
  47. 'special powers
  48. CONST ONN = 1, OFFF = 0
  49.  
  50. 'key codes
  51. CONST UP = 18432
  52. CONST DOWN = 20480
  53. CONST LEFT = 19200
  54. CONST RIGHT = 19712
  55. CONST ESC = 27
  56. CONST SPACE = 32
  57.  
  58. TYPE MAP '             set up map cell structure
  59.     x AS INTEGER '     upper left x coordinate of cell
  60.     y AS INTEGER '     upper left y coordinate of cell
  61.     walls AS INTEGER ' identifies cell walls
  62.  
  63. TYPE HeroType
  64.     X AS INTEGER
  65.     Y AS INTEGER
  66.     DX AS INTEGER
  67.     DY AS INTEGER
  68.  
  69. DIM SHARED MAP(-100 TO MAPW + 100, -100 TO MAPH + 100) AS MAP
  70. DIM SHARED XOFF, YOFF, FLAP, H AS HeroType
  71.  
  72. 'get ready
  73. XOFF = (WW - MAPW * SQ) / 2 - SQ
  74. YOFF = (WH - MAPH * SQ) / 2 - SQ
  75. H.X = 1: H.Y = 1
  76.  
  77. DIM SHARED RAT AS HeroType
  78. RAT.X = 1: RAT.Y = 1
  79. RAT.DX = 0: RAT.DY = 1 'moving right need these for heading calulations for drawing
  80.  
  81. DIM KH& '        player key presses
  82. DIM MagicKey '        Magic Key to across the walls
  83.  
  84.  
  85. '----------------------------
  86. '- Main Program Begins Here -
  87. '----------------------------
  88.  
  89. SCREEN _NEWIMAGE(WW, WH, 32) '                                  create 250x250 32bit screen
  90. CLS '                                                             clear the screen
  91. DRAWMAP '
  92.  
  93. DO '                                                              MAIN LOOP begins here
  94.     PCOPY 1, 0 '                                                  copy page 1 to current screen
  95.     DrawHero MagicKey
  96.     'diagonal movements are managed here
  97.     IF _KEYDOWN(LEFT) AND _KEYDOWN(DOWN) THEN
  98.         LOCATE 1, 1: COLOR _RGB(255, 0, 0): PRINT "DOWN+LEFT":
  99.         IF (NOT MAP(RAT.X, RAT.Y).walls AND 64) OR MagicKey THEN RAT.X = RAT.X - 1: RAT.Y = RAT.Y + 1: RAT.DX = -1: RAT.DY = 1
  100.     END IF
  101.     IF _KEYDOWN(UP) AND _KEYDOWN(LEFT) THEN
  102.         LOCATE 1, 1: COLOR _RGB(255, 0, 0): PRINT "UP+LEFT":
  103.         IF (NOT MAP(RAT.X, RAT.Y).walls AND 128) OR MagicKey THEN RAT.X = RAT.X - 1: RAT.Y = RAT.Y - 1: RAT.DX = -1: RAT.DY = -1
  104.     END IF
  105.  
  106.     IF _KEYDOWN(RIGHT) AND _KEYDOWN(DOWN) THEN
  107.         LOCATE 1, 1: COLOR _RGB(255, 0, 0): PRINT "DOWN+RIGHT":
  108.         IF (NOT MAP(RAT.X, RAT.Y).walls AND 32) OR MagicKey THEN RAT.X = RAT.X + 1: RAT.Y = RAT.Y + 1: RAT.DX = 1: RAT.DY = 1
  109.     END IF
  110.  
  111.     IF _KEYDOWN(UP) AND _KEYDOWN(RIGHT) THEN
  112.         LOCATE 1, 1: COLOR _RGB(255, 0, 0): PRINT "UP+RIGHT"
  113.         IF (NOT MAP(RAT.X, RAT.Y).walls AND 16) OR MagicKey THEN RAT.X = RAT.X + 1: RAT.Y = RAT.Y - 1: RAT.DX = 1: RAT.DY = -1
  114.     END IF
  115.  
  116.  
  117.     'previous key's commands are managed here
  118.     IF _KEYDOWN(ESC) THEN SYSTEM
  119.     IF _KEYDOWN(SPACE) THEN IF MagicKey = OFFF THEN MagicKey = ONN ELSE MagicKey = OFFF
  120.     IF _KEYDOWN(UP) THEN IF (NOT MAP(RAT.X, RAT.Y).walls AND 1) OR MagicKey THEN RAT.Y = RAT.Y - 1: RAT.DX = 0: RAT.DY = -1
  121.     IF _KEYDOWN(RIGHT) THEN IF (NOT MAP(RAT.X, RAT.Y).walls AND 2) OR MagicKey THEN RAT.X = RAT.X + 1: RAT.DX = 1: RAT.DY = 0
  122.     IF _KEYDOWN(DOWN) THEN IF (NOT MAP(RAT.X, RAT.Y).walls AND 4) OR MagicKey THEN RAT.Y = RAT.Y + 1: RAT.DX = 0: RAT.DY = 1
  123.     IF _KEYDOWN(LEFT) THEN IF (NOT MAP(RAT.X, RAT.Y).walls AND 8) OR MagicKey THEN RAT.X = RAT.X - 1: RAT.DX = -1: RAT.DY = 0
  124.  
  125.     _DISPLAY '                                                    update the screen without flicker
  126.  
  127.     DO: LOOP UNTIL _KEYHIT = 0 ' clear buffer of keyboard
  128.     FLAP = FLAP + 1 MOD 60
  129.     _LIMIT 10 'save the fan!
  130. LOOP '                                                            MAIN LOOP back
  131.  
  132. '-----------------------------------
  133. '- Function and Subroutine section -
  134. '-----------------------------------
  135. SUB DrawHero (Status)
  136.     DIM heading AS SINGLE
  137.     rx = RAT.X * SQ + .5 * SQ + XOFF
  138.     ry = RAT.Y * SQ + .5 * SQ + YOFF
  139.     rr = .2 * SQ
  140.     IF Status THEN rc& = _RGB32(50, 100, 200) ELSE rc& = _RGB32(200, 100, 50)
  141.     heading = _ATAN2(RAT.DY, RAT.DX)
  142.     noseX = rx + 2 * rr * COS(heading)
  143.     noseY = ry + 2 * rr * SIN(heading)
  144.     neckX = rx + .75 * rr * COS(heading)
  145.     neckY = ry + .75 * rr * SIN(heading)
  146.     tailX = rx + 2 * rr * COS(heading + _PI)
  147.     tailY = ry + 2 * rr * SIN(heading + _PI)
  148.     earLX = rx + rr * COS(heading - _PI(1 / 12))
  149.     earLY = ry + rr * SIN(heading - _PI(1 / 12))
  150.     earRX = rx + rr * COS(heading + _PI(1 / 12))
  151.     earRY = ry + rr * SIN(heading + _PI(1 / 12))
  152.     fcirc rx, ry, .65 * rr, rc&
  153.     fcirc neckX, neckY, rr * .3, rc&
  154.     ftri noseX, noseY, earLX, earLY, earRX, earRY, rc&
  155.     fcirc earLX, earLY, rr * .3, rc&
  156.     fcirc earRX, earRY, rr * .3, rc&
  157.     wX = .5 * rr * COS(heading - _PI(11 / 18))
  158.     wY = .5 * rr * SIN(heading - _PI(11 / 18))
  159.     LINE (noseX + wX, noseY + wY)-(noseX - wX, noseY - wY), rc&
  160.     wX = .5 * rr * COS(heading - _PI(7 / 18))
  161.     wY = .5 * rr * SIN(heading - _PI(7 / 18))
  162.     LINE (noseX + wX, noseY + wY)-(noseX - wX, noseY - wY), rc&
  163.     LINE (rx, ry)-(tailX, tailY), rc&
  164.     IF Status AND (FLAP MOD 60 > 10) THEN 'how about some wings?
  165.         wingx = rx + .25 * rr * COS(heading)
  166.         wingy = ry + .25 * rr * SIN(heading)
  167.         pieSlice wingx, wingy, 4 * rr, heading + _PI(.5) - _PI(1 / 24), heading + _PI(.5) + _PI(1 / 6), _RGB32(0, 255, 255)
  168.         pieSlice wingx, wingy, 4 * rr, heading - _PI(.5) - _PI(1 / 6), heading - _PI(.5) + _PI(1 / 24), _RGB32(0, 255, 255)
  169.         PAINT (wingx + 2 * rr * COS(heading + _PI(.5)), wingy + 2 * rr * SIN(heading + _PI(.5))), _RGBA32(10, 255, 255, 255), _RGB32(0, 255, 255)
  170.         PAINT (wingx + 2 * rr * COS(heading - _PI(.5)), wingy + 2 * rr * SIN(heading - _PI(.5))), _RGBA32(10, 255, 255, 255), _RGB32(0, 255, 255)
  171.     END IF
  172.  
  173. SUB DRAWMAP ()
  174.  
  175.     '*
  176.     '* draws a map based on the value of each map cell
  177.     '*
  178.  
  179.     DIM x, y '          x,y map coordinates
  180.  
  181.     FOR y = 1 TO MAPH '                                                 cycle through map rows
  182.         FOR x = 1 TO MAPW '                                             cycle through map columns
  183.             READ MAP(x, y).walls '                                  read wall DATA
  184.             MAP(x, y).x = x * SQ + XOFF '                                 compute upper left x coordinate of cell
  185.             MAP(x, y).y = y * SQ + YOFF '                                 compute upper left y coordinate of cell
  186.             IF MAP(x, y).walls AND 1 THEN '                         is NORTH wall present?
  187.                 LINE (MAP(x, y).x, MAP(x, y).y)-STEP(SQ - 1, 0), _RGB32(255, 255, 255) ' yes, draw it
  188.             END IF
  189.             IF MAP(x, y).walls AND 2 THEN '                         is EAST wall present?
  190.                 LINE (MAP(x, y).x + SQ - 1, MAP(x, y).y)-STEP(0, SQ - 1), _RGB32(255, 255, 255) ' yes, draw it
  191.             END IF
  192.             IF MAP(x, y).walls AND 4 THEN '                         is SOUTH wall present?
  193.                 LINE (MAP(x, y).x, MAP(x, y).y + SQ - 1)-STEP(SQ - 1, 0), _RGB32(255, 255, 255) ' yes, draw it
  194.             END IF
  195.             IF MAP(x, y).walls AND 8 THEN '                         is WEST wall present?
  196.                 LINE (MAP(x, y).x, MAP(x, y).y)-STEP(0, SQ - 1), _RGB32(255, 255, 255) ' yes, draw it
  197.             END IF
  198.         NEXT x
  199.     NEXT y
  200.     COLOR _RGB32(0, 255, 255)
  201.     _PRINTSTRING (40, 40), "The Magic Key is the spacebar."
  202.  
  203.     PCOPY 0, 1 '                                                      save a copy of the map
  204.  
  205.  
  206. SUB fcirc (CX AS LONG, CY AS LONG, R AS LONG, K AS LONG)
  207.     DIM subRadius AS LONG, RadiusError AS LONG
  208.     DIM X AS LONG, Y AS LONG
  209.  
  210.     subRadius = ABS(R)
  211.     RadiusError = -subRadius
  212.     X = subRadius
  213.     Y = 0
  214.  
  215.     IF subRadius = 0 THEN PSET (CX, CY), K: EXIT SUB
  216.  
  217.     ' Draw the middle span here so we don't draw it twice in the main loop,
  218.     ' which would be a problem with blending turned on.
  219.     LINE (CX - X, CY)-(CX + X, CY), K, BF
  220.  
  221.     WHILE X > Y
  222.         RadiusError = RadiusError + Y * 2 + 1
  223.         IF RadiusError >= 0 THEN
  224.             IF X <> Y + 1 THEN
  225.                 LINE (CX - Y, CY - X)-(CX + Y, CY - X), K, BF
  226.                 LINE (CX - Y, CY + X)-(CX + Y, CY + X), K, BF
  227.             END IF
  228.             X = X - 1
  229.             RadiusError = RadiusError - X * 2
  230.         END IF
  231.         Y = Y + 1
  232.         LINE (CX - X, CY - Y)-(CX + X, CY - Y), K, BF
  233.         LINE (CX - X, CY + Y)-(CX + X, CY + Y), K, BF
  234.     WEND
  235.  
  236. SUB ftri (x1, y1, x2, y2, x3, y3, K AS _UNSIGNED LONG)
  237.     a& = _NEWIMAGE(1, 1, 32)
  238.     _DEST a&
  239.     PSET (0, 0), K
  240.     _DEST 0
  241.     _MAPTRIANGLE _SEAMLESS(0, 0)-(0, 0)-(0, 0), a& TO(x1, y1)-(x2, y2)-(x3, y3)
  242.     _FREEIMAGE a& '<<< this is important!
  243.  
  244. 'use radians
  245. SUB arc (x, y, r, raStart, raStop, c AS _UNSIGNED LONG)
  246.     'x, y origin, r = radius, c = color
  247.  
  248.     'raStart is first angle clockwise from due East = 0 degrees
  249.     ' arc will start drawing there and clockwise until raStop angle reached
  250.  
  251.     IF raStop < raStart THEN
  252.         arc x, y, r, raStart, _PI(2), c
  253.         arc x, y, r, 0, raStop, c
  254.     ELSE
  255.         ' modified to easier way suggested by Steve
  256.         'Why was the line method not good? I forgot.
  257.         al = _PI * r * r * (raStop - raStart) / _PI(2)
  258.         FOR a = raStart TO raStop STEP 1 / al
  259.             PSET (x + r * COS(a), y + r * SIN(a)), c
  260.         NEXT
  261.     END IF
  262.  
  263. 'draw lines from origin to arc on sides
  264. SUB pieSlice (x, y, r, raStart, raStop, c AS _UNSIGNED LONG)
  265.     arc x, y, r, raStart, raStop, c
  266.     px = x + r * COS(raStart): py = y + r * SIN(raStart)
  267.     LINE (x, y)-(px, py), c
  268.     px = x + r * COS(raStop): py = y + r * SIN(raStop)
  269.     LINE (x, y)-(px, py), c
  270.  
  271. '------------------------
  272. '- Program DATA section -
  273. '------------------------
  274.  
  275. '*
  276. '* Map cell values
  277. '*
  278.  
  279. 'DATA 11,15,15,11,15,12,5,5,4,3,15,15,15,15,10,11,15,9,5,6,12,5,6,15,15
  280.  
  281. ' a different map
  282. ' DATA 11,15,15,11,15,12,5,5,4,3,15,11,15,15,10,9,0,1,5,6,12,4,5,15,15
  283. 'conversion of  the map above with square movement to octagonal movement
  284. DATA 219,255,255,155,255,252,117,229,212,115,255,155,255,255,58,201,144,49,165,246,236,100,119,255,255
  285. '* as       picture      power of 2 (2^n)         result of 2^n
  286. '*            __            0                          1
  287. '*           /  \          7 4                      128 16
  288. '*           |  |         3   1                     8     2
  289. '*           \  /          6 5                       64  32
  290. '*            --            2                          4
  291.  
  292.  

I have just a bug about how many steps the mouse does, but this is why I have not seen in dept how do you use variables rat.dx and rat.dy. I think the bug is there.

The value of each cell is easily calculated  with formula 255 (no direction possible) - direction that you let to do

Code: QB64: [Select]
  1. '* Bitwise math demonstration
  2. '*
  3. '* Draws a simple map and allows player to move circle within map
  4. '* rapresentation using a clockwise power of 2 for each segment first the 4 basilar
  5. '*   and then the 4 diagonal   for optional directions
  6. '* as       picture      power of 2 (2^n)         result of 2^n
  7. '*            __            0                          1                     N
  8. '*           /  \          7 4                      128  16               NE   NW
  9. '*           |  |         3   1                    8       2             E       W
  10. '*           \  /          6 5                      64   32               SE   SW
  11. '*            --            2                          4                     S
  12.  
  13. '* example of how the value of cell in the map changes using octagonal movement controls
  14.  
  15. '*  a closed box    squared wall scoring        octagonal wall scoring
  16. '*      --          1+2+4+8= 15                  1+2+4+8+ 16+32+64+128=255
  17. '*     |  |
  18. '*      --
  19. '*  a U box    squared wall scoring        octagonal wall scoring
  20. '*                 2+4+8= 14                  2+4+8+ 32+64+128+16=
  21. '*     |  |        or 15 - 1 = 14               14 +  oblique directions forbidden
  22. '*      --
  23. '*  a C box    squared wall scoring        octagonal wall scoring
  24. '*      --          1+4+8= 13                  1+4+8+ 64+128=205 moving NW W SW
  25. '*     |            or 15-2 =13
  26. '*      --
  27. '*
  28.  
Programming isn't difficult, only it's  consuming time and coffee

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Map bitwise and octagonal movements (N NE E SE S SW W NW) @Bplus
« Reply #1 on: September 01, 2018, 08:28:50 pm »
That reminds me, I was going to try Octagonal map, but got distracted by one thing and then other...

Yes, I had planned to code walls very like what you have illustrated TempodiBasic, perfect for _Byte Type.

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Map bitwise and octagonal movements (N NE E SE S SW W NW) @Bplus
« Reply #2 on: September 02, 2018, 09:50:04 am »
Hi Bplus
the real difference between the system that you have thought and that I have developed following Terry's map bitwise generator and your goal of 8 direction of movement is that you use a single circle clockwise to set the bitvalue and so in map creator and map evaluator  you want make squared cell you need alternate bitvalue to evaluate N = 1  E = 4  S = 16   W=64; with my method a first circle clockwise gives values to bit for the 4 main directions N=1 E=2 S=4 W=8 and the second circle clockwise gives value to bit of the 4 secondary directions.
Two ways to go in the same direction.

Thanks to read

Programming isn't difficult, only it's  consuming time and coffee

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Map bitwise and octagonal movements (N NE E SE S SW W NW) @Bplus
« Reply #3 on: September 02, 2018, 10:26:59 am »
Checking my notes for a game I was working on in the past, this is my map coordinate system:

N = 2^ 0 = 1
E = 2 ^ 1 = 2
NE = 2 ^ 2 = 4
NW = 2 ^ 3 = 8
SE = 2 ^ 4 = 16
SW = 2 ^ 5 = 32
W = 2 ^ 6 = 64
S = 2 ^ 7 = 128

Why so odd a numbering system??

One word:  Opposites.

2 ^ 0 = North
2 ^ (7 - 0) = South

For each direction, we can find the opposite direction by just subtracting its power from 7.

This was important for some reason that I'd dreamed up and incorporated into the code back then, but I'll be danged now if I can remember WHY...

Just thought I'd offer it as a different coordinate system for you to think about.  Heck, you might even be able to sort out why I thought it was a good idea at the time; I don't have a clue why I did it now, and I'm not always the most faithful of commenting thoughts/reasons in code sometimes...
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Map bitwise and octagonal movements (N NE E SE S SW W NW) @Bplus
« Reply #4 on: September 02, 2018, 12:04:03 pm »
"Why so odd a numbering system??"

Oh hey, I just noticed TempodiBasic number system jumpimg around. Missed that.

Perhaps he has hopes of hacking Terry Ritchie's maze generator? for octagons?

But Steve, your number system has a logic to it.


I am wondering why TempodiBasic posted the mod I made with wings and trap, loosing the trap and the great flapping of wings? The trap is why our hero needed wings to get out! And the flapping, I was so proud to get that working just right! Ruined! ;(   
( I am crying crocodile tears, joking, I hope you all know, I am honored anyone copies and plays with code I post.)

(compare original post this thread to reply #18 https://www.qb64.org/forum/index.php?topic=417.msg3211#msg3211 )

But I do really think this title (in TempodiBasic's mod that starts this thread):
_TITLE "B+ Flying Hero Mod of TempodiBasic Trap Mod of Terri Ritchie Simple Map Demo, 2018-08-21"

Should say:
_TITLE "TempodiBasic Mod of B+ Flying Hero Mod of TempodiBasic Trap Mod of Terri Ritchie Simple Map Demo, (some other date after 2018-08-21)"
so the author of the code isn't confused with another author of some other similar earlier code.

It is a great aim to try for hacking maze generator already working great which is what TempodiBasic's main point was (I am thinking) because I was discouraged we couldn't have an easy maze generator for Octagons. I think TempodiBasic is saying well maybe we can.
« Last Edit: September 02, 2018, 12:37:16 pm by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Map bitwise and octagonal movements (N NE E SE S SW W NW) @Bplus
« Reply #5 on: September 02, 2018, 03:22:25 pm »
Come to think of it, there was another fundamental question left unanswered and having me look around for something else to do.

That was the question of tiling maze generated maps, and imagine how much more difficult an octagonal setup.

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Map bitwise and octagonal movements (N NE E SE S SW W NW) @Bplus
« Reply #6 on: September 02, 2018, 05:45:48 pm »
Hi Bplus

yes you are right
Romans used to say dare Caesari quae Caesaris or in english giving a caesar to what is to be a Caesar...
sorry I must correct _TITLE of demo!
so please subsostitute to the _TITLE line this code
Code: QB64: [Select]
  1. _TITLE "TempodiBasic mod of B+ Flying Hero Mod of TempodiBasic Trap Mod of Terri Ritchie Simple Map Demo, 2018-09-02"
and here there recovered the trap! Put this line at the place of previous or change the third number (119) counting from the last  one on the right side of line with 117
Code: QB64: [Select]
  1. 'conversion of  the map above with square movement to octagonal movement
  2. DATA 219,255,255,155,255,252,117,229,212,115,255,155,255,255,58,201,144,49,165,246,236,100,117,255,255
  3.  
:-)
I hope to give happy to you doing this!

Programming isn't difficult, only it's  consuming time and coffee

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Map bitwise and octagonal movements (N NE E SE S SW W NW) @Bplus
« Reply #7 on: September 02, 2018, 06:02:51 pm »
Hi Steve
yes I find very interesting you odd system to set directions,
the cause of why do you have thought important getting smartly and quickly the opposite direction can be related to collisions

that is the first cause I can imagine.
It remember me an old game for windows 95 Drod https://sillysoft.net/drod/

Thanks
Good Coding
Programming isn't difficult, only it's  consuming time and coffee