+Lewis2907 Posted June 5, 2018 Share Posted June 5, 2018 (edited) Does any one know how to permanently disable diagonal movement even when using gosub, goto, etc.? Below is a part of the code. I just need Left, Right, Up and Down. Any other movements like Up && Down mess up the program and what I am trying to get accomplished. Basically I am bringing PacMan Eat N Run over to Multisprite the hard way. I am calculating the exact spots where I need to move Up, Left, Right, Down etc. As stated before the "Diagonal Movements" throw player0 into the play field. Since we can't get pfpixel, pfread to work properly or fairly easy. I think this is about the best way (for what I can do). Very time consuming and using up space, but I think I can accomplish it since the playfield will help map where I need to make movements. Thanks if anyone can solve this for me. Currently if you just move the controls normally (no diagonals) you have the "smooth collision detection". I only worked up the middle (3rd Floor) and the ones above and below it. ;*************************************************************** ; ; Kernel setup. ; includesfile multisprite_bankswitch.inc include fixed_point_math.asm set tv ntsc set kernel multisprite set romsize 32kSC set optimization speed set smartbranching on set optimization noinlinedata set optimization inlinerand ;**************************************************************** ; ; Player0-4 fixed point variables for more flexibility in ; gameplay mechanics. ; "c" is used in joy0 checks for last movement ; dim _P0_L_R = player0x.a dim _P0_U_D = player0y.b (More Code) ;*************************************************************** ; ; remember joy0 position for making left, right, up, down movement ; if joy0up then c{1}=1:c{2}=0:c{3}=0:c{4}=0:c{5}=0:c{6}=0:c{7}=0:c{0}=0 if joy0down then c{1}=0:c{2}=1:c{3}=0:c{4}=0:c{5}=0:c{6}=0:c{7}=0:c{0}=0 if joy0left then c{1}=0:c{2}=0:c{3}=1:c{4}=0:c{5}=0:c{6}=0:c{7}=0:c{0}=0 if joy0right then c{1}=0:c{2}=0:c{3}=0:c{4}=1:c{5}=0:c{6}=0:c{7}=0:c{0}=0 (More Code) 20180605_Multisprite_Pac_Man.bas.bin 20180605 - PacMan_Eat_N_Run_(Multisprite).txt 20180605_Multisprite_Pac_Man.bas Edited June 5, 2018 by Lewis2907 Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted June 5, 2018 Share Posted June 5, 2018 It seems to be working as-is using the middle holes. Quote Link to comment Share on other sites More sharing options...
+Lewis2907 Posted June 5, 2018 Author Share Posted June 5, 2018 RT, Yes, but if you down or up to the 2nd Floor and while moving press up/right or up/left and the reverse when going down. You will get stuck. It work fine so far when moving to the 4th Floor, but when I added the code I noticed the 2nd Floor would put you in the playfield. I saw a few posts on where people removed the diagonal movements, but didn't post their code to look at. I'm not sure if SWCHA would work as I am not that great at using that method, thanks. Quote Link to comment Share on other sites More sharing options...
ultima Posted June 6, 2018 Share Posted June 6, 2018 (edited) You can add a label after the directional check. Then add a goto label after the first 3 checks. sorta like this: if joy0up then c=%00000010: goto __NextPart if joy0down then c=%00000100: goto __NextPart if joy0left then c=%00001000: goto __NextPart if joy0right then c=%00010000 __NextPart Edited June 7, 2018 by ultima Quote Link to comment Share on other sites More sharing options...
+Lewis2907 Posted June 7, 2018 Author Share Posted June 7, 2018 Ultima, Do you have a sample code that I can look at? If so I should be okay on how to make it fit into the program I have, thanks. Quote Link to comment Share on other sites More sharing options...
+Lewis2907 Posted June 7, 2018 Author Share Posted June 7, 2018 I figured it out on going to the 2nd floor. I had > in stead of a <. Just a simple equation error will have your head banging the desk. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.