61
TI-BASIC / Ok, I give. I need help.
« on: March 16, 2010, 01:49:02 am »
So I have been trying to create a walking system that will work for a game I'm creating but I can't get it to work properly and I have tried basically everything I can think of. Basically what I'm trying to do (for the test program) is make it so that it will only move 32 spaces left or right and 24 spaces up and down (basically being restricted to a 24x32 map). I have tried assigning sections of map to not let it move past, I have tried making it so only u can walk over 32 spaces. Nothing has worked. I have gotten close...but not quite.
Within those bounds are what I have been able to achieve. The problem though is that it isn't supposed to go into the rows marked with arrows.
Basically, effect wise, what I'm trying to do is that it will wrap around when it gets to row nine and seventeen but stop once you get to row twenty-four. Same basically in the horizontal just stretched out over two screens and only one wrap around. I can post sample code of what I have come up with that has failed (or I can recreate the one that got close), just ask. Thanks for anything
I also hope this makes sense haha.
Edit: so I decided I would post the code up that I just created (I thought this would work...not so much ).
Note: I realize this is very unoptimized. I also realize that this could potentially contain errors that I just didn't catch. Cut me some slack though, I created this at three in the freaking morning (I really need to sleep better...)
Anywho, thanks again for any input/help/anything.
Code: [Select]
____↓_________________________________________________________________↓
____0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3
→0_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|←
_1_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
_2_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
_3_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
_4_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
_5_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|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_|_|
_20|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
_21|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
_22|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
_23|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
_24|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
→25|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|←
____↑_________________________________________________________________↑
Within those bounds are what I have been able to achieve. The problem though is that it isn't supposed to go into the rows marked with arrows.
Basically, effect wise, what I'm trying to do is that it will wrap around when it gets to row nine and seventeen but stop once you get to row twenty-four. Same basically in the horizontal just stretched out over two screens and only one wrap around. I can post sample code of what I have come up with that has failed (or I can recreate the one that got close), just ask. Thanks for anything
I also hope this makes sense haha.
Edit: so I decided I would post the code up that I just created (I thought this would work...not so much ).
Code: [Select]
ClrHome
DelVar CDelVar DDelVar EDelVar F1→A
1→B
Repeat K=45
Output(A,B,"_
A+D→A
E+(A=9)-not(A→E
If (A=9) and (not(E) or (E=1))
A-8→A
If (A=9) and (E=2)
A-1→A
If not(A) and ((E=2) or (E=1))
A+8→A
If not(A) and not(E
A+1→A
B+C→B
F+(B=17)-not(B→F
If (B=17) and not(F
B-16→B
If (B=17) and (F=1)
B-1→B
If not(B) and (F=1)
B+16→B
If not(B) and not(F)
B+1→B
Output(A,B,"*
Repeat Ans
getKey→K
End
(K=34)-(K=25→D
(K=26)-(K=24→C
End
Note: I realize this is very unoptimized. I also realize that this could potentially contain errors that I just didn't catch. Cut me some slack though, I created this at three in the freaking morning (I really need to sleep better...)
Anywho, thanks again for any input/help/anything.