Author Topic: Alis does the jitter bug!(fixed)  (Read 4506 times)

0 Members and 1 Guest are viewing this topic.

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Alis does the jitter bug!(fixed)
« on: July 23, 2020, 04:20:57 pm »
Ok so I am trying to get the movement working in my current Clone Project 'Phantasy Star' from the sega master system c.1987

but the main character Alis, seem to have a jitter bug. its like one of the frames is momentarily getting popped in just enough to affect the look of the movement. I've tried variations on the routine I use to work the animation, but it persists. I even tried moving the sprites around on the sprite sheet to see if something was up there.  the program still has the original data lines from the first sprite setup. before I rearranged them.

Time for another set of eyes to look.(or many sets)

its not pretty code as this isn't the final product its just a proof of concept and R&D program.
Code: QB64: [Select]
  1. TYPE Game
  2.  Status AS _BYTE
  3.  Facing AS _BYTE
  4.  Moving AS _BYTE
  5. TYPE SpriteData
  6.  Lx AS INTEGER 'sprite location
  7.  Ly AS INTEGER
  8.  Sx AS INTEGER 'sprite size
  9.  Sy AS INTEGER
  10.  
  11. CONST standing = 1, walking = 2
  12. CONST down = 0, up = 1, right = 2, left = 3
  13. CONST TRUE = -1, FALSE = NOT TRUE
  14.  
  15. CONST Default_Key_Right = 19712, Default_Key_Left = 19200, Default_Key_Up = 18432, Default_Key_Down = 20480
  16. CONST Default_A_Button = 32, Default_B_Button = 13, Default_Start_Button = 65, Default_Select_Button = 66
  17.  
  18.  
  19. DIM SHARED g AS Game, char&, frame%%, AlisFrames(16) AS SpriteData, AlisAnim(4) AS _BYTE, MIX&
  20. '--------------Alis Character Sprites-----------------
  21. DATA 47,0,17,24,49,27,14,24,50,54,15,24,49,81,14,24: 'Standing Sprites DN\UP\RT\LT
  22. DATA 0,1,15,24,16,1,14,24,31,1,15,24: 'walking down sprites
  23. DATA 0,28,14,24,17,28,13,24,32,28,14,24: 'walking Up sprites
  24. DATA 0,54,16,24,17,54,15,24,34,54,13,24: 'walking Right sprites
  25. DATA 0,81,13,24,15,81,14,24,31,81,16,24: 'walking Left sprites
  26. DATA 0,1,2,1: 'animation frame order
  27. FOR I%% = 0 TO 15
  28.  READ AlisFrames(I%%).Lx, AlisFrames(I%%).Ly, AlisFrames(I%%).Sx, AlisFrames(I%%).Sy
  29.  PRINT AlisFrames(I%%).Lx
  30. NEXT I%%
  31. FOR I%% = 0 TO 3
  32.  READ AlisAnim(I%%)
  33. NEXT I%%
  34.  
  35. 'map& = _LOADIMAGE("PStarTownsALL.bmp", 32) '1760x1600[110x100tiles]
  36. tile& = _LOADIMAGE("TownTileMasterLinear.png", 32) '
  37. char& = _LOADIMAGE("CharacterSheetC.png", 32) '
  38. OPEN "PhantasyStarTowns.dat" FOR BINARY AS #1
  39. DIM SHARED TownMap(256, 256) AS _UNSIGNED _BYTE
  40. _CLEARCOLOR _RGB32(62), char&
  41. 'alis start point 1968x128
  42. GET #1, , TownMap()
  43.  
  44. SCREEN _NEWIMAGE(640, 480, 32)
  45. MIX& = _NEWIMAGE(640, 480, 32)
  46. Townlayer& = _NEWIMAGE(8192, 8192, 32)
  47. 'build a section of the towns map sheet
  48. FOR y%% = 0 TO 99
  49.  FOR x%% = 0 TO 109
  50.   _PUTIMAGE (0 + 32 * x%%, 0 + 32 * y%%)-STEP(31, 31), tile&, Townlayer&, (0 + 17 * TownMap(x%%, y%%), 0)-STEP(15, 15)
  51.  NEXT x%%
  52. NEXT y%%
  53. '_SCREENMOVE 10, 10
  54. 'SLEEP
  55. '---------------------------------------
  56. g.Status = standing
  57. 'g.Status = walking
  58. g.Facing = down
  59. Px% = 0: Py% = 0
  60.  
  61. Mx% = 69 'players position within map array X
  62. My% = 10 ' players position within map array Y
  63.  
  64. 'FOR I%% = 0 TO 15
  65. '_PUTIMAGE (0 + 32 * I%%, 10)-STEP(-1 + AlisFrames(I%%).Sx * 2, -1 + AlisFrames(I%%).Sy * 2), char&, _DISPLAY, (AlisFrames(I%%).Lx, AlisFrames(I%%).Ly)-STEP(AlisFrames(I%%).Sx - 1, AlisFrames(I%%).Sy - 1)
  66. 'NEXT I%%
  67. 'END
  68.  
  69.  
  70.  _PUTIMAGE (64, 48)-STEP(511, 383), Townlayer&, MIX&, (1968 + Px%, 128 + Py%)-STEP(511, 383)
  71.  Place_Alis
  72.  '---------------debuging-----------------------
  73.  _PRINTSTRING (580, 0), STR$(Px%) + "  "
  74.  _PRINTSTRING (580, 16), STR$(Py%) + "  "
  75.  _PRINTSTRING (580, 32), STR$((ABS(Py%) MOD 32)) + "  "
  76.  _PRINTSTRING (580, 48), STR$((ABS(Px%) MOD 32)) + "  "
  77.  _PRINTSTRING (580, 64), STR$(g.Moving) + "  "
  78.  _PRINTSTRING (580, 80), STR$(Mx%) + "  "
  79.  _PRINTSTRING (580, 96), STR$(My%) + "  "
  80.  _PRINTSTRING (580, 112), STR$(Collision(Mx%, My%)) + "  "
  81.  _PRINTSTRING (580, 128), STR$(TownMap(Mx%, My%)) + "  "
  82.  _PRINTSTRING (580, 144), STR$(TownMap(Mx%, My% - 1)) + "  "
  83.  _PRINTSTRING (580, 160), STR$(TownMap(Mx% - 1, My%)) + "  "
  84.  _PRINTSTRING (580, 176), STR$(TownMap(Mx% + 1, My%)) + "  "
  85.  _PRINTSTRING (580, 192), STR$(TownMap(Mx%, My% + 1)) + "  "
  86.  _PRINTSTRING (580, 208), STR$(frame%%) + "  "
  87.  _PRINTSTRING (580, 224), STR$(4 + 3 * g.Facing + AlisAnim(frame%%)) + "  "
  88.  '-------------------------------------------
  89.  
  90.  '-----------------Controls------------------
  91.  IF _KEYDOWN(Default_Key_Up) AND (NOT g.Moving) AND (NOT Collision(Mx%, My% - 1)) THEN g.Facing = up: g.Moving = TRUE
  92.  IF _KEYDOWN(Default_Key_Left) AND (NOT g.Moving) AND (NOT Collision(Mx% - 1, My%)) THEN g.Facing = left: g.Moving = TRUE
  93.  IF _KEYDOWN(Default_Key_Right) AND (NOT g.Moving) AND (NOT Collision(Mx% + 1, My%)) THEN g.Facing = right: g.Moving = TRUE
  94.  IF _KEYDOWN(Default_Key_Down) AND (NOT g.Moving) AND (NOT Collision(Mx%, My% + 1)) THEN g.Facing = down: g.Moving = TRUE
  95.  IF _KEYDOWN(27) THEN exitflag%% = -1
  96.  '--------------------------------------------
  97.  
  98.  '----------------Movement--------------------
  99.  IF g.Moving THEN
  100.   SELECT CASE g.Facing
  101.    CASE up
  102.     Py% = Py% - 2
  103.     IF (ABS(Py%) MOD 32) = 0 THEN g.Moving = FALSE: My% = My% - 1
  104.     IF NOT _KEYDOWN(Default_Key_Up) THEN Ft%% = 0: frame%% = 0
  105.    CASE down
  106.     Py% = Py% + 2
  107.     IF (Py% MOD 32) = 0 THEN g.Moving = FALSE: My% = My% + 1
  108.     IF NOT _KEYDOWN(Default_Key_Down) THEN Ft%% = 0: frame%% = 0
  109.    CASE left
  110.     Px% = Px% - 2
  111.     IF (ABS(Px%) MOD 32) = 0 THEN g.Moving = FALSE: Mx% = Mx% - 1
  112.     IF NOT _KEYDOWN(Default_Key_Left) THEN Ft%% = 0: frame%% = 0
  113.    CASE right
  114.     Px% = Px% + 2
  115.     IF (Px% MOD 32) = 0 THEN g.Moving = FALSE: Mx% = Mx% + 1
  116.     IF NOT _KEYDOWN(Default_Key_Right) THEN Ft%% = 0: frame%% = 0
  117.  '---------------------------------------------
  118.  '---------------animated moving---------------
  119.  ' IF g.Moving THEN
  120.  '  Ft%% = Ft%% + 1
  121.  '  IF Ft%% = 8 THEN frame%% = frame%% + 1: Ft%% = 0
  122.  '  IF frame%% = 4 THEN frame%% = 0
  123.  ' END IF
  124.  '-------------Fellippe's suggestion.-------------
  125.  totalFrames = 4
  126.  IF g.Moving AND TIMER - lastFrameUpdate! >= .125 THEN 'adjust .3 to whatever interval you want
  127.   frame%% = (frame%% + 1) MOD totalFrames
  128.   lastFrameUpdate! = TIMER
  129.  
  130.  '---------------------------------------------
  131.  _LIMIT 60
  132. LOOP UNTIL exitflag%%
  133.  
  134.  
  135. SUB Place_Alis
  136.  IF NOT g.Moving THEN
  137.   _PUTIMAGE (304, 226)-STEP(31, 45), char&, MIX&, (0 + 17 * g.Facing, 120)-STEP(15, 22)
  138.   _PUTIMAGE (304, 226)-STEP(31, 45), char&, MIX&, (68 + 51 * g.Facing + AlisAnim(frame%%) * 17, 120)-STEP(15, 22)
  139.  
  140. FUNCTION Collision%% (x%, y%)
  141.  Result%% = FALSE
  142.  SELECT CASE TownMap(x%, y%)
  143.   CASE 6 'stone path (walkable)
  144.   CASE 9 'concrete path(walkable)
  145.   CASE 42, 43, 34, 35 'houses
  146.   CASE 75, 76 'shops
  147.   CASE 77, 78 ' exits
  148.   CASE 68, 69 'church
  149.   CASE 28, 29 'caves
  150.    Result%% = TRUE
  151.  Collision%% = Result%%
CharacterSheetC.png
* CharacterSheetC.png (Filesize: 14.25 KB, Dimensions: 271x204, Views: 210)
TownTileMasterLinear.png
* TownTileMasterLinear.png (Filesize: 13.58 KB, Dimensions: 2516x33, Views: 216)
* PhantasyStarTowns.Dat (Filesize: 64.5 KB, Downloads: 172)
« Last Edit: July 25, 2020, 12:38:00 pm by Cobalt »
Granted after becoming radioactive I only have a half-life!

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Alis does the jitter bug!
« Reply #1 on: July 23, 2020, 04:40:46 pm »
I must be doing something wrong... The only key that seems to work is the escape key. I checked the '_KEYHIT' keyboard scan codes and they appear to be correct. All I get is a sword carrying girl in the center of a grassed area.
Logic is the beginning of wisdom.

FellippeHeitor

  • Guest
Re: Alis does the jitter bug!
« Reply #2 on: July 23, 2020, 04:59:55 pm »
I fixed the jitter bug, but now she goes off road. That's your business now 😂

By the way, the erratic movement was due to setting g.Moving = FALSE every time the landing spot on each tile was reached, even if the arrow keys were still being held down.

Code: QB64: [Select]
  1. TYPE Game
  2.     Status AS _BYTE
  3.     Facing AS _BYTE
  4.     Moving AS _BYTE
  5. TYPE SpriteData
  6.     Lx AS INTEGER 'sprite location
  7.     Ly AS INTEGER
  8.     Sx AS INTEGER 'sprite size
  9.     Sy AS INTEGER
  10.  
  11. CONST standing = 1, walking = 2
  12. CONST down = 0, up = 1, right = 2, left = 3
  13. CONST TRUE = -1, FALSE = NOT TRUE
  14.  
  15. CONST Default_Key_Right = 19712, Default_Key_Left = 19200, Default_Key_Up = 18432, Default_Key_Down = 20480
  16. CONST Default_A_Button = 32, Default_B_Button = 13, Default_Start_Button = 65, Default_Select_Button = 66
  17.  
  18.  
  19. DIM SHARED g AS Game, char&, frame%%, AlisFrames(16) AS SpriteData, AlisAnim(4) AS _BYTE, MIX&
  20. '--------------Alis Character Sprites-----------------
  21. DATA 47,0,17,24,49,27,14,24,50,54,15,24,49,81,14,24: 'Standing Sprites DN\UP\RT\LT
  22. DATA 0,1,15,24,16,1,14,24,31,1,15,24: 'walking down sprites
  23. DATA 0,28,14,24,17,28,13,24,32,28,14,24: 'walking Up sprites
  24. DATA 0,54,16,24,17,54,15,24,34,54,13,24: 'walking Right sprites
  25. DATA 0,81,13,24,15,81,14,24,31,81,16,24: 'walking Left sprites
  26. DATA 0,1,2,1: 'animation frame order
  27. FOR I%% = 0 TO 15
  28.     READ AlisFrames(I%%).Lx, AlisFrames(I%%).Ly, AlisFrames(I%%).Sx, AlisFrames(I%%).Sy
  29.     PRINT AlisFrames(I%%).Lx
  30. NEXT I%%
  31. FOR I%% = 0 TO 3
  32.     READ AlisAnim(I%%)
  33. NEXT I%%
  34.  
  35. 'map& = _LOADIMAGE("PStarTownsALL.bmp", 32) '1760x1600[110x100tiles]
  36. tile& = _LOADIMAGE("TownTileMasterLinear.png", 32) '
  37. char& = _LOADIMAGE("CharacterSheetC.png", 32) '
  38. OPEN "PhantasyStarTowns.dat" FOR BINARY AS #1
  39. DIM SHARED TownMap(256, 256) AS _UNSIGNED _BYTE
  40. _CLEARCOLOR _RGB32(62), char&
  41. 'alis start point 1968x128
  42. GET #1, , TownMap()
  43.  
  44. SCREEN _NEWIMAGE(640, 480, 32)
  45. MIX& = _NEWIMAGE(640, 480, 32)
  46. Townlayer& = _NEWIMAGE(8192, 8192, 32)
  47. 'build a section of the towns map sheet
  48. FOR y%% = 0 TO 99
  49.     FOR x%% = 0 TO 109
  50.         _PUTIMAGE (0 + 32 * x%%, 0 + 32 * y%%)-STEP(31, 31), tile&, Townlayer&, (0 + 17 * TownMap(x%%, y%%), 0)-STEP(15, 15)
  51.     NEXT x%%
  52. NEXT y%%
  53. '_SCREENMOVE 10, 10
  54. 'SLEEP
  55. '---------------------------------------
  56. g.Status = standing
  57. 'g.Status = walking
  58. g.Facing = down
  59. Px% = 0: Py% = 0
  60.  
  61. Mx% = 69 'players position within map array X
  62. My% = 10 ' players position within map array Y
  63.  
  64. 'FOR I%% = 0 TO 15
  65. '_PUTIMAGE (0 + 32 * I%%, 10)-STEP(-1 + AlisFrames(I%%).Sx * 2, -1 + AlisFrames(I%%).Sy * 2), char&, _DISPLAY, (AlisFrames(I%%).Lx, AlisFrames(I%%).Ly)-STEP(AlisFrames(I%%).Sx - 1, AlisFrames(I%%).Sy - 1)
  66. 'NEXT I%%
  67. 'END
  68.  
  69.  
  70.     _PUTIMAGE (64, 48)-STEP(511, 383), Townlayer&, MIX&, (1968 + Px%, 128 + Py%)-STEP(511, 383)
  71.     Place_Alis
  72.     _PUTIMAGE , MIX&, _DISPLAY
  73.     '---------------debuging-----------------------
  74.     _PRINTSTRING (580, 0), STR$(Px%) + "  "
  75.     _PRINTSTRING (580, 16), STR$(Py%) + "  "
  76.     _PRINTSTRING (580, 32), STR$((ABS(Py%) MOD 32)) + "  "
  77.     _PRINTSTRING (580, 48), STR$((ABS(Px%) MOD 32)) + "  "
  78.     _PRINTSTRING (580, 64), STR$(g.Moving) + "  "
  79.     _PRINTSTRING (580, 80), STR$(Mx%) + "  "
  80.     _PRINTSTRING (580, 96), STR$(My%) + "  "
  81.     _PRINTSTRING (580, 112), STR$(Collision(Mx%, My%)) + "  "
  82.     _PRINTSTRING (580, 128), STR$(TownMap(Mx%, My%)) + "  "
  83.     _PRINTSTRING (580, 144), STR$(TownMap(Mx%, My% - 1)) + "  "
  84.     _PRINTSTRING (580, 160), STR$(TownMap(Mx% - 1, My%)) + "  "
  85.     _PRINTSTRING (580, 176), STR$(TownMap(Mx% + 1, My%)) + "  "
  86.     _PRINTSTRING (580, 192), STR$(TownMap(Mx%, My% + 1)) + "  "
  87.     _PRINTSTRING (580, 208), STR$(frame%%) + "  "
  88.     _PRINTSTRING (580, 224), STR$(4 + 3 * g.Facing + AlisAnim(frame%%)) + "  "
  89.     '-------------------------------------------
  90.  
  91.     '-----------------Controls------------------
  92.     IF _KEYDOWN(Default_Key_Up) AND (NOT g.Moving) AND (NOT Collision(Mx%, My% - 1)) THEN g.Facing = up: g.Moving = TRUE
  93.     IF _KEYDOWN(Default_Key_Left) AND (NOT g.Moving) AND (NOT Collision(Mx% - 1, My%)) THEN g.Facing = left: g.Moving = TRUE
  94.     IF _KEYDOWN(Default_Key_Right) AND (NOT g.Moving) AND (NOT Collision(Mx% + 1, My%)) THEN g.Facing = right: g.Moving = TRUE
  95.     IF _KEYDOWN(Default_Key_Down) AND (NOT g.Moving) AND (NOT Collision(Mx%, My% + 1)) THEN g.Facing = down: g.Moving = TRUE
  96.     IF _KEYDOWN(27) THEN exitflag%% = -1
  97.     '--------------------------------------------
  98.  
  99.     '----------------Movement--------------------
  100.     IF g.Moving THEN
  101.         SELECT CASE g.Facing
  102.             CASE up
  103.                 Py% = Py% - 2
  104.                 IF (ABS(Py%) MOD 32) = 0 AND NOT _KEYDOWN(Default_Key_Up) THEN
  105.                     g.Moving = FALSE: My% = My% - 1
  106.                     Ft%% = 0: frame%% = 0
  107.                 END IF
  108.             CASE down
  109.                 Py% = Py% + 2
  110.                 IF (Py% MOD 32) = 0 AND NOT _KEYDOWN(Default_Key_Down) THEN
  111.                     g.Moving = FALSE: My% = My% + 1
  112.                     Ft%% = 0: frame%% = 0
  113.                 END IF
  114.             CASE left
  115.                 Px% = Px% - 2
  116.                 IF (ABS(Px%) MOD 32) = 0 AND NOT _KEYDOWN(Default_Key_Left) THEN
  117.                     g.Moving = FALSE: Mx% = Mx% - 1
  118.                     Ft%% = 0: frame%% = 0
  119.                 END IF
  120.             CASE right
  121.                 Px% = Px% + 2
  122.                 IF (Px% MOD 32) = 0 AND NOT _KEYDOWN(Default_Key_Right) THEN
  123.                     g.Moving = FALSE: Mx% = Mx% + 1
  124.                     Ft%% = 0: frame%% = 0
  125.                 END IF
  126.         END SELECT
  127.     END IF
  128.     '---------------------------------------------
  129.     '---------------animated moving---------------
  130.     ' IF g.Moving THEN
  131.     '  Ft%% = Ft%% + 1
  132.     '  IF Ft%% = 8 THEN frame%% = frame%% + 1: Ft%% = 0
  133.     '  IF frame%% = 4 THEN frame%% = 0
  134.     ' END IF
  135.     '-------------Fellippe's suggestion.-------------
  136.     totalFrames = 4
  137.     IF g.Moving AND TIMER - lastFrameUpdate! >= .125 THEN 'adjust .3 to whatever interval you want
  138.         frame%% = (frame%% + 1) MOD totalFrames
  139.         lastFrameUpdate! = TIMER
  140.     END IF
  141.  
  142.     '---------------------------------------------
  143.     _LIMIT 60
  144. LOOP UNTIL exitflag%%
  145.  
  146.  
  147. SUB Place_Alis
  148.     IF NOT g.Moving THEN
  149.         _PUTIMAGE (304, 226)-STEP(31, 45), char&, MIX&, (0 + 17 * g.Facing, 120)-STEP(15, 22)
  150.     ELSE
  151.         _PUTIMAGE (304, 226)-STEP(31, 45), char&, MIX&, (68 + 51 * g.Facing + AlisAnim(frame%%) * 17, 120)-STEP(15, 22)
  152.     END IF
  153.  
  154. FUNCTION Collision%% (x%, y%)
  155.     Result%% = FALSE
  156.     SELECT CASE TownMap(x%, y%)
  157.         CASE 6 'stone path (walkable)
  158.         CASE 9 'concrete path(walkable)
  159.         CASE 42, 43, 34, 35 'houses
  160.         CASE 75, 76 'shops
  161.         CASE 77, 78 ' exits
  162.         CASE 68, 69 'church
  163.         CASE 28, 29 'caves
  164.         CASE ELSE
  165.             Result%% = TRUE
  166.     END SELECT
  167.     Collision%% = Result%%
  168.  

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: Alis does the jitter bug!
« Reply #3 on: July 23, 2020, 05:15:57 pm »
Jitter is gone, but now it sticks, cant move up or down. or else all the sudden the collision detection completely fails.
Granted after becoming radioactive I only have a half-life!

FellippeHeitor

  • Guest
Re: Alis does the jitter bug!
« Reply #4 on: July 23, 2020, 05:16:53 pm »
It looks like it's probably not stopping at the proper landing spot sometimes. But at least now you know what was the root of it ;-)

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: Alis does the jitter bug!
« Reply #5 on: July 23, 2020, 05:22:11 pm »
@FellippeHeitor  Yep, and by simply relocating the screen update lines problem solved. Extra eyes are always a big help!

Code: QB64: [Select]
  1. TYPE Game
  2.  Status AS _BYTE
  3.  Facing AS _BYTE
  4.  Moving AS _BYTE
  5. TYPE SpriteData
  6.  Lx AS INTEGER 'sprite location
  7.  Ly AS INTEGER
  8.  Sx AS INTEGER 'sprite size
  9.  Sy AS INTEGER
  10.  
  11. CONST standing = 1, walking = 2
  12. CONST down = 0, up = 1, right = 2, left = 3
  13. CONST TRUE = -1, FALSE = NOT TRUE
  14.  
  15. CONST Default_Key_Right = 19712, Default_Key_Left = 19200, Default_Key_Up = 18432, Default_Key_Down = 20480
  16. CONST Default_A_Button = 32, Default_B_Button = 13, Default_Start_Button = 65, Default_Select_Button = 66
  17.  
  18.  
  19. DIM SHARED g AS Game, char&, frame%%, AlisFrames(16) AS SpriteData, AlisAnim(4) AS _BYTE, MIX&
  20. '--------------Alis Character Sprites-----------------
  21. DATA 47,0,17,24,49,27,14,24,50,54,15,24,49,81,14,24: 'Standing Sprites DN\UP\RT\LT
  22. DATA 0,1,15,24,16,1,14,24,31,1,15,24: 'walking down sprites
  23. DATA 0,28,14,24,17,28,13,24,32,28,14,24: 'walking Up sprites
  24. DATA 0,54,16,24,17,54,15,24,34,54,13,24: 'walking Right sprites
  25. DATA 0,81,13,24,15,81,14,24,31,81,16,24: 'walking Left sprites
  26. DATA 0,1,2,1: 'animation frame order
  27. FOR I%% = 0 TO 15
  28.  READ AlisFrames(I%%).Lx, AlisFrames(I%%).Ly, AlisFrames(I%%).Sx, AlisFrames(I%%).Sy
  29.  PRINT AlisFrames(I%%).Lx
  30. NEXT I%%
  31. FOR I%% = 0 TO 3
  32.  READ AlisAnim(I%%)
  33. NEXT I%%
  34.  
  35. 'map& = _LOADIMAGE("PStarTownsALL.bmp", 32) '1760x1600[110x100tiles]
  36. tile& = _LOADIMAGE("TownTileMasterLinear.png", 32) '
  37. char& = _LOADIMAGE("CharacterSheetC.png", 32) '
  38. OPEN "PhantasyStarTowns.dat" FOR BINARY AS #1
  39. DIM SHARED TownMap(256, 256) AS _UNSIGNED _BYTE
  40. _CLEARCOLOR _RGB32(62), char&
  41. 'alis start point 1968x128
  42. GET #1, , TownMap()
  43.  
  44. SCREEN _NEWIMAGE(640, 480, 32)
  45. MIX& = _NEWIMAGE(640, 480, 32)
  46. Townlayer& = _NEWIMAGE(8192, 8192, 32)
  47. 'build a section of the towns map sheet
  48. FOR y%% = 0 TO 99
  49.  FOR x%% = 0 TO 109
  50.   _PUTIMAGE (0 + 32 * x%%, 0 + 32 * y%%)-STEP(31, 31), tile&, Townlayer&, (0 + 17 * TownMap(x%%, y%%), 0)-STEP(15, 15)
  51.  NEXT x%%
  52. NEXT y%%
  53. '_SCREENMOVE 10, 10
  54. 'SLEEP
  55. '---------------------------------------
  56. g.Status = standing
  57. 'g.Status = walking
  58. g.Facing = down
  59. Px% = 0: Py% = 0
  60.  
  61. Mx% = 69 'players position within map array X
  62. My% = 10 ' players position within map array Y
  63.  
  64. 'FOR I%% = 0 TO 15
  65. '_PUTIMAGE (0 + 32 * I%%, 10)-STEP(-1 + AlisFrames(I%%).Sx * 2, -1 + AlisFrames(I%%).Sy * 2), char&, _DISPLAY, (AlisFrames(I%%).Lx, AlisFrames(I%%).Ly)-STEP(AlisFrames(I%%).Sx - 1, AlisFrames(I%%).Sy - 1)
  66. 'NEXT I%%
  67. 'END
  68.  
  69.  
  70.  
  71.  '-----------------Controls------------------
  72.  IF _KEYDOWN(Default_Key_Up) AND (NOT g.Moving) AND (NOT Collision(Mx%, My% - 1)) THEN g.Facing = up: g.Moving = TRUE
  73.  IF _KEYDOWN(Default_Key_Left) AND (NOT g.Moving) AND (NOT Collision(Mx% - 1, My%)) THEN g.Facing = left: g.Moving = TRUE
  74.  IF _KEYDOWN(Default_Key_Right) AND (NOT g.Moving) AND (NOT Collision(Mx% + 1, My%)) THEN g.Facing = right: g.Moving = TRUE
  75.  IF _KEYDOWN(Default_Key_Down) AND (NOT g.Moving) AND (NOT Collision(Mx%, My% + 1)) THEN g.Facing = down: g.Moving = TRUE
  76.  IF _KEYDOWN(27) THEN exitflag%% = -1
  77.  '--------------------------------------------
  78.  '-------------Screen updating-----------------
  79.  _PUTIMAGE (64, 48)-STEP(511, 383), Townlayer&, MIX&, (1968 + Px%, 128 + Py%)-STEP(511, 383)
  80.  Place_Alis
  81.  '---------------------------------------------
  82.  '---------------debuging-----------------------
  83.  _PRINTSTRING (580, 0), STR$(Px%) + "  "
  84.  _PRINTSTRING (580, 16), STR$(Py%) + "  "
  85.  _PRINTSTRING (580, 32), STR$((ABS(Py%) MOD 32)) + "  "
  86.  _PRINTSTRING (580, 48), STR$((ABS(Px%) MOD 32)) + "  "
  87.  _PRINTSTRING (580, 64), STR$(g.Moving) + "  "
  88.  _PRINTSTRING (580, 80), STR$(Mx%) + "  "
  89.  _PRINTSTRING (580, 96), STR$(My%) + "  "
  90.  _PRINTSTRING (580, 112), STR$(Collision(Mx%, My%)) + "  "
  91.  _PRINTSTRING (580, 128), STR$(TownMap(Mx%, My%)) + "  "
  92.  _PRINTSTRING (580, 144), STR$(TownMap(Mx%, My% - 1)) + "  "
  93.  _PRINTSTRING (580, 160), STR$(TownMap(Mx% - 1, My%)) + "  "
  94.  _PRINTSTRING (580, 176), STR$(TownMap(Mx% + 1, My%)) + "  "
  95.  _PRINTSTRING (580, 192), STR$(TownMap(Mx%, My% + 1)) + "  "
  96.  _PRINTSTRING (580, 208), STR$(frame%%) + "  "
  97.  _PRINTSTRING (580, 224), STR$(4 + 3 * g.Facing + AlisAnim(frame%%)) + "  "
  98.  '-------------------------------------------
  99.  
  100.  '----------------Movement--------------------
  101.  IF g.Moving THEN
  102.   SELECT CASE g.Facing
  103.    CASE up
  104.     Py% = Py% - 2
  105.     IF (ABS(Py%) MOD 32) = 0 THEN g.Moving = FALSE: My% = My% - 1
  106.     IF NOT _KEYDOWN(Default_Key_Up) THEN Ft%% = 0: frame%% = 0
  107.    CASE down
  108.     Py% = Py% + 2
  109.     IF (Py% MOD 32) = 0 THEN g.Moving = FALSE: My% = My% + 1
  110.     IF NOT _KEYDOWN(Default_Key_Down) THEN Ft%% = 0: frame%% = 0
  111.    CASE left
  112.     Px% = Px% - 2
  113.     IF (ABS(Px%) MOD 32) = 0 THEN g.Moving = FALSE: Mx% = Mx% - 1
  114.     IF NOT _KEYDOWN(Default_Key_Left) THEN Ft%% = 0: frame%% = 0
  115.    CASE right
  116.     Px% = Px% + 2
  117.     IF (Px% MOD 32) = 0 THEN g.Moving = FALSE: Mx% = Mx% + 1
  118.     IF NOT _KEYDOWN(Default_Key_Right) THEN Ft%% = 0: frame%% = 0
  119.  '---------------------------------------------
  120.  '---------------animated moving---------------
  121.  IF g.Moving THEN
  122.   Ft%% = Ft%% + 1
  123.   IF Ft%% = 8 THEN frame%% = frame%% + 1: Ft%% = 0
  124.   IF frame%% = 4 THEN frame%% = 0
  125.  '---------------------------------------------
  126.  _LIMIT 60
  127. LOOP UNTIL exitflag%%
  128.  
  129.  
  130. SUB Place_Alis
  131.  IF NOT g.Moving THEN
  132.   _PUTIMAGE (304, 226)-STEP(31, 45), char&, MIX&, (0 + 17 * g.Facing, 120)-STEP(15, 22)
  133.   _PUTIMAGE (304, 226)-STEP(31, 45), char&, MIX&, (68 + 51 * g.Facing + AlisAnim(frame%%) * 17, 120)-STEP(15, 22)
  134.  
  135. FUNCTION Collision%% (x%, y%)
  136.  Result%% = FALSE
  137.  SELECT CASE TownMap(x%, y%)
  138.   CASE 6 'stone path (walkable)
  139.   CASE 9 'concrete path(walkable)
  140.   CASE 42, 43, 34, 35 'houses
  141.   CASE 75, 76 'shops
  142.   CASE 77, 78 ' exits
  143.   CASE 68, 69 'church
  144.   CASE 28, 29 'caves
  145.    Result%% = TRUE
  146.  Collision%% = Result%%

@johnno56  try this version and let me know if you still cannot move.
Granted after becoming radioactive I only have a half-life!

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Alis does the jitter bug!(mostly fixed)
« Reply #6 on: July 23, 2020, 05:57:09 pm »
Sorry. No change. A complete Walt Disney. Frozen solid.... Escape still works... That's good, right?
Logic is the beginning of wisdom.

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Alis does the jitter bug!(mostly fixed)
« Reply #7 on: July 23, 2020, 06:04:47 pm »
Update: Modified the key controls to bypass "not g.moving and not collision" and the cursor keys function just fine.

ie: changed: IF _KEYDOWN(Default_Key_Up) AND (NOT g.Moving) AND (NOT Collision(Mx%, My% - 1)) THEN g.Facing = up: g.Moving = TRUE
to: IF _KEYDOWN(Default_Key_Up) THEN g.Facing = up: g.Moving = TRUE
(same for other keys)
Logic is the beginning of wisdom.

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: Alis does the jitter bug!(mostly fixed)
« Reply #8 on: July 23, 2020, 06:50:47 pm »
@johnno56  what version QB64 you running? and OS?
Granted after becoming radioactive I only have a half-life!

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Alis does the jitter bug!(mostly fixed)
« Reply #9 on: July 24, 2020, 06:56:10 am »
Version 1.4 Stable release from git 0f49b2c. Linux Mint 19.3
« Last Edit: July 24, 2020, 06:59:16 am by johnno56 »
Logic is the beginning of wisdom.

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: Alis does the jitter bug!(mostly fixed)
« Reply #10 on: July 24, 2020, 11:09:17 am »
I really don't know then. Unless you can upload a screen shot of when its not working so I can see the numbers at the right side of the screen. All that is debugging information and maybe there is something there but it is just bizarre.

Re-reading your posts makes me wonder, are you seeing the screen I have attached below?

if not make sure you have downloaded all 3 files from above; the 2 images and the DAT file.
Sample.jpg
* Sample.jpg (Filesize: 152.74 KB, Dimensions: 646x504, Views: 233)
« Last Edit: July 24, 2020, 11:19:04 am by Cobalt »
Granted after becoming radioactive I only have a half-life!

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Alis does the jitter bug!(mostly fixed)
« Reply #11 on: July 24, 2020, 07:26:43 pm »
This is the only  image I see.

ps: All three files were downloaded and placed in the same directory as the ".bas" file.
sample.png
* sample.png (Filesize: 7.29 KB, Dimensions: 640x480, Views: 181)
sample2.png
* sample2.png (Filesize: 34.6 KB, Dimensions: 962x205, Views: 211)
« Last Edit: July 24, 2020, 07:43:03 pm by johnno56 »
Logic is the beginning of wisdom.

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: Alis does the jitter bug!(mostly fixed)
« Reply #12 on: July 24, 2020, 08:56:48 pm »
its a Linux issue, make sure the file name match in case too. It looks like I didn't match case with the town data file when opening.

as you see you have 2 dat files now(one will be roughly 64.5k the other probably 0), So the town data isn't being loaded hence nothing works. Not an issue I have running Windows nor Fellippe running Mac, so it took me a while to pick up on it.

so if you change this line(40):
OPEN "PhantasyStarTowns.dat" FOR BINARY AS #1

to this

OPEN "PhantasyStarTowns.Dat" FOR BINARY AS #1

it should be fixed.

I just didn't catch when you originally said "grassed area". I may add signs in the game that read "Keep off the Grass" cause you can't walk on nearly any the grass areas in towns, only paved areas!

But yeah let me know if changing that line makes the difference.
Granted after becoming radioactive I only have a half-life!

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Alis does the jitter bug!(mostly fixed)
« Reply #13 on: July 24, 2020, 10:59:24 pm »
Changing the file name did the trick. I'm surprised. Linux is painfully critical of filenames. Surprised, in the sense, that I didn't receive an error message... No matter... The display is "normal"... Now. Where are the aliens?
Logic is the beginning of wisdom.