Discuss Obstacles in the TI 83/84 forum on Dev Hardware. Obstacles Programming forum discussing coding and everything related to the well-known TI-83/83+/84/84+ graphing calculators for math and science. Creative ideas, helpful information and questions regarding applications are welcomed but no homework at all!
ASP Free and Iron Speed Designer are giving away $5,500+ in FREE licenses. Iron Speed's RAD CASE toolset can save up to 80% of your coding time. One free license per week, one perpetual license per month!
Open source technologies have proven to be extremely advantageous to businesses.
This adaptive and highly efficient kind of software is central to the infrastructure of most companies. Since the world of open source technology is constantly changing,
IT professionals need a resource to give them up-to-the-minute information about these enterprise level and open source technologies. Dev Shed is that resource .
The ASP Free website provides in-depth information on the latest developer tools available from Microsoft. Our cadre of writers, highly experienced industry experts, reveals the best ways to use established technologies as well as new and emerging technologies. Our coverage of Microsoft's development and administration technologies is among the most respected in the IT industry today. .
Posts: 330
Time spent in forums: 3 Days 3 h 29 m 28 sec
Reputation Power: 113
Quote:
Originally Posted by YottaFlop
Hello again.
Code:
ClrHome
5->A
5->B
While 1
ClrHome
Output(B,A,"+")
getKey->K
While K=0
getKey->K
End
A+(K=26)-(K=24)->A
B+(K=34)-(K=25)->B
End
This creates a little cross moving around the screen, based on the arrow keys.
How can I create obstacles? I was thinking of entering their coordinates to a list, but I don't think that points (x,y) can go into a list.
So how do I go about this? And how could I have different areas to go into after going past the edge? Thanks.
You can keep it from going off the screen by changing the code below from this...
Code:
A+(K=26)-(K=24)->A
B+(K=34)-(K=25)->B
...to this:
Code:
A+(K=26 and A≠16)-(K=24 and A≠1)->A
B+(K=34 and B≠8)-(K=25 and B≠1)->B
That way it checks to see if it will go off the screen before it ever even does, and it's quicker than any other method I know.
And as for obstacles, this has always been a problem for programming onto the calculator. One known and commonly used method is using matrices.
What you can do is make a matrix size 8 by 16 to represent the homescreen (slightly different for draw/graph screen, but that's another story), then you fill it with zeroes. then you can put a 1 or 2, or really any number you want to represent your character. Then, line the edges with walls, and be sure to use a number that will be exclusive to walls in the matrix. After that, make an obstacle, and it's position an obstacle exclusive value on the matrix. When you try to move, check to see if the space is blank, then if so, move. Else, check to see if an obstacle is in the way. If so, then check to see if something is in the way of the obstacle, if not, move it, then move your own character, If there is something in the way, or if the thing in the way of your character is a wall, then don't move your character. With this method, you can also eliminate the need of added coding for in case you hit the edge of the screen, because you're boxing yourself in already. Try and make this, and then post it. If you do, I'll post how I would do it.
Posts: 13
Time spent in forums: 1 h 49 m
Reputation Power: 0
Re
Alright. I think I've got it. But as I add more (I also have an exit key, a currently static enemy that triggers Game Overs, etc.), it starts to slow down just a small bit.
Code:
ClrHome
5->A
5->B
While 1
ClrHome
#### OUTPUT OBSTACLES ####
Output(B,A,"+")
getKey->K
While K=0
getKey->K
End
A->C
B->D
C+(K=26)-(K=24)->C
D+(K=34)-(K=25)->D
If [A](D,C)!=1
Then
A+(K=26)-(K=24)->A
B+(K=34)-(K=25)->B
End
End
Posts: 330
Time spent in forums: 3 Days 3 h 29 m 28 sec
Reputation Power: 113
Quote:
Originally Posted by YottaFlop
Alright. I think I've got it. But as I add more (I also have an exit key, a currently static enemy that triggers Game Overs, etc.), it starts to slow down just a small bit.
Code:
ClrHome
5->A
5->B
While 1
ClrHome
#### OUTPUT OBSTACLES ####
Output(B,A,"+")
getKey->K
While K=0
getKey->K
End
A->C
B->D
C+(K=26)-(K=24)->C
D+(K=34)-(K=25)->D
If [A](D,C)!=1
Then
A+(K=26)-(K=24)->A
B+(K=34)-(K=25)->B
End
End
Here's a quick little code I made:
(Note: underscores represent space in text)
Code:
ClrHome
{8,16->dim([A]
For(A,1,8
For(B,1,16
(A=1) or (A=8) or (B=1) or (B=16->[A](A,B
End
End
2->[A](2,2
3->[A](4,8
4->[A](7,15
For(A,1,8
For(B,1,16
"_
If 1=[A](A,B
"*
If 2=[A](A,B
"+
If 3=[A](A,B
"O
If 4=[A](A,B
"E
Output(A,B,Ans
If Ans="+
Then
A->C
B->D
End
End
End
C->A
D->B
Repeat A=7 and B=15
Output(C,D,"_
Output(A,B,"+
Repeat Ans
getKey->K
End
If sum(K={24,25,26,34
Then
A->C
B->D
A+(K=34)-(K=25->A
B+(K=26)-(K=24->B
If A=7 and B=15 or not([A](A,B
Then
0->[A](C,D
2->[A](A,B
Else
If 1=[A](A,B
Then
C->A
D->B
Else
C+2(A-C->E
D+2(B-D
If E>0 and E<9 and Ans>0 and Ans<17 and not([A](E,Ans
Then
Output(E,Ans,"O
[A](A,B->[A](E,Ans
0->[A](C,D
2->[A](A,B
Else
C->A
D->B
End
End
End
End
End
Works like a charm.
Quick and to the point.
What it does is it first checks to see if you pressed an arrow key, then if so, stores it's current position into C and D. Then it finds out where it will be according to which arrow you pressed. After that, it checks first and foremost to see if it's empty or if it's the exit (E) tile. If so, it puts 2 into that point on the matrix, and then clears it's old position (on both matrix and graphically). If there is something there (other than the E tile), then it first checks to see if it's a wall. If you want to customize it to your needs, you can have it check to see if it's a tile/object that you don't want your character to move. If it's a immobile object (or wall in this case) then it reverts to it's original position. If it's a mobile object (in this case the "O" or what's supposed to be a rock or something like that), then it finds out where THAT would move, and stores that into E and Ans. If that's empty, it moves both it and your character. If it isn't empty, then again, you revert to your original position. Unlike your character, when it checks to see if the rock's new position, it checks only if it's empty, if there' anything in the new position, it unconditionally, will not move. You can change this so that if you want it to go on a panel to open a door or something like that, but try and make sure that you don't program too many different types of panels, as it will get slightly slower each time you program a new one in.
What do you think?
Last edited by MufinMcFlufin : October 16th, 2009 at 01:17 PM.
Posts: 13
Time spent in forums: 1 h 49 m
Reputation Power: 0
Quote:
Originally Posted by MufinMcFlufin
...
What do you think?
I think it's great! Is there a way to copy it into a desktop application like Notepad and convert it to a calculator program? It would be a lot easier to program in that way.
Posts: 330
Time spent in forums: 3 Days 3 h 29 m 28 sec
Reputation Power: 113
Quote:
Originally Posted by YottaFlop
I think it's great! Is there a way to copy it into a desktop application like Notepad and convert it to a calculator program? It would be a lot easier to program in that way.
If your OS is Vista, then you can use the program editor included in TI Connect, but as far as I know, there's not many other ways. There are online code parsers, but the last one I found didn't work, as it wouldn't do many commands or variables such as matrices correctly. (it would insert question marks instead of what I actually told it to enter)
Either that or just program it straight into the calculator. That can be quicker than trying to find a good, free code parser.
Post a link if you can find a working code parser.
Posts: 330
Time spent in forums: 3 Days 3 h 29 m 28 sec
Reputation Power: 113
Hey, found the old code parser I used to use if anyone wants it.
I wouldn't recommend it for taking the text and making it into a program file, but if you want to look at your program with a much bigger screen, or with colored syntax, or indents so you know which End goes to which For(, While, Repeat, or Then, it's decent. It does have a optimization thing, but again, I wouldn't recommend that either, as for For( loops, if the start is 1, then it takes away the 1, and that'll get you a syntax error.
Anyways, here's that code parser. You don't need an account at the website to use it, but if you want to save your programs onto the website (which you can so you can view them where ever you have internet access) you'll have to make one. But it's free so no problem.
LOADING INFUSIONSOFTLOADING INFUSIONSOFT 1debug:overlay status: OFF overlay not displayed
overlay cookie defined: TI_CAMPAIGN_1012_D
OVERLAY COOKIE set:
status off