I'm interested in creating a ti 84 plus cse game where all you would do(at least for now) would be to move around. I am very much a beginner at all of this and my main difficulty is that i do not know how to set it up so I make a simple sprite (a letter or something, not custom) move around on a screen. I thought maybe I could use the If command or something but I really have no clue. If someone could please help that would be great.

By the way I am using ti basic and I dont really care if my game is in color or not.
DWMelon: Have you taken a look at Chapter 6 of Programming the TI-83 Plus/TI-84 Plus? That walks you through exactly what you're talking about: building a game where you can press arrow keys and move something around the screen. It's written for the monochrome calculators, but the differences needed for the TI-84+CSE are negligible: the only difference is that the homescreen is (26x10) instead of (16x8).
Alright, basically you will need a loop that keeps on repeating itself until the user wants to quit; meaning they will keep playing until they push the quit key.
There are several loops available:
for() , while, repeat, and goto.
The for() loop is generally reserved for things that you want to run a set number of times.
While loop is very similar in structure to the repeat. It will keep running until the expression results in false. Such as While x=1 end will keep on running until x does not equal one.
Repeat is the same as while but will keep running until the expression is true. Such as Repeat x=1 end will run until x=1.
The goto loop is probably something most beginners get stuck on. Don't use it too often. Basically goto lblname will jump to lblname in your code.
I would pick a repeat loop for your game code.
For more about loops and detecting keypresses, see: http://tifreakware.net/tutorials/83p/b/tifw/les6.htm
For Homescreen stuff:
http://tifreakware.net/tutorials/83p/b/tifw/les7.htm
and
http://tifreakware.net/tutorials/83p/b/tifw/les2.htm
I used the tifreakware tutorial and it sort of works, is there anything I can do so there is only one X at a time? Also thanks everyone for helping me.
Could you give us some source code? The tutorial are a good reference Smile I could help out but I need to see the source code
What do you mean by source code?
APotato wrote:
Could you give us some source code? The tutorial are a good reference Smile I could help out but I need to see the source code
He's asking how he can get started with this project; he hasn't actually begun writing any code yet.

DWMelon: Let me let you in on a not-so-secret: Chapter 6 is one of the free downloads available from manning.com while you wait for your library to get my book; just click on Sample Chapter 6:
http://manning.com/mitchell
KermMartian wrote:
APotato wrote:
Could you give us some source code? The tutorial are a good reference Smile I could help out but I need to see the source code
He's asking how he can get started with this project; he hasn't actually begun writing any code yet.

DWMelon: Let me let you in on a not-so-secret: Chapter 6 is one of the free downloads available from manning.com while you wait for your library to get my book; just click on Sample Chapter 6:
http://manning.com/mitchell

Ah ok! Wink Hmm, are you planning to edit some of the graph screen stuff in there so there can be a PCSE version? Or does pretty much all of it apply to the PCSE? If so, then I might just be able to convince my parents to let me purchase a copy Smile
use the output function and variables
for example A is your y coordinate and B is your x coordinate
so write something like Output(A,B,"1")
replace the 1 with whatever you want your character to be
then use getkey to detect when someone presses a key
While Z = 0
getkey -> Z
End
then change A and B when someone does press a key
If Z = 24
B-1 -> B
If Z = 25
A-1 -> A
If Z = 26
B+1 -> B
If Z = 34
A+1 -> A
include a loop to repeat this over and over again
and probably an Output (A,B, " ") in there to clear the space where your character was
Yes, there is a more efficient way that goes something like
"A+((Z=24))-((Z=26))->A" or something like that. Razz
That segment is helpful in removing that line of code. Also I would change the while loop to repeat Z=24 or Z=25 or Z=26 or Z=34
Hmm or maybe 23<Z<27 might work along with a Z = 34
Yeah, the boolean logic is like that, slightly optimized as:
A+(Z=24) - (Z=26->A
Least I think that works.
It works because if the K=24 is pressed, it returns a one, thus adding one to A, and if K=26 is pressed it takes 1 away, and if no keys are pressed nothing happens.
I don't really understand all the code you are sending me but I intend to learn:) I do not know if I should use the graph screen or the homescreen, I think whichever is easiest would be best. And Kerm I will download chapter 6 as you recommended. I know I'm not giving very much info, but that is because I don't know much info Razz Thank you all for your help!
This is kind of a whole new different kind of thing but it still does fit the description of this thread I guess. I wish to create a fortune teller using ti basic. I have some of it started but I do not know how to make it so that when the calculator generates a random integer it will show a message that corresponds with that integer.
You can use the sub( command
You can find more info on it with google Smile
APotato wrote:
You can use the sub( command
You can find more info on it with google Smile
The simple answer is:
(1) Generate a random number
(2) Choose a different fortune string for each number
(3) Display that fortune

If you want to optimize further, you can indeed use the sub() command, but that's way premature if DWMelon doesn't know how to structure the program in the first place. DWMelon, do you know how to do each of those three steps I listed?
I don't know how to create a string or display a fortune really. I really don't know much of anything about ti basic, or much of anything for programming for that matter yet. I have made a begging screen sort of with the text command and I understand how to generate a random integer, but that's about it. How would I create/use a string then? and then display the fortune?
Storing a string: "APotato is awesome"->Str1
Displaying a string (in the graph screen): text(-1,1,1,Str1
Using a randint: randit(0,10)->A
Then use an if type thing.
If A=0:"You will eat potatoes"->Str1
If A=1:"You will code a basic program"->Str1
....
And then after all of that:
text(-1,1,1,Str1
I'm pretty sure there is a more efficient way for the If stuff
How about this as a more efficient way: Smile


Code:
"You will code a basic program
If not(A:"You will eat potatoes
Ans -> Str1
APotato wrote:
Storing a string: "APotato is awesome"->Str1
Displaying a string (in the graph screen): text(-1,1,1,Str1
Using a randint: randit(0,10)->A
Then use an if then type thing.
If A=0:Then: "You will eat potatoes"->Str1
Else
If A=1:Then: "You will code a basic program"->Str1
Else
....
And then after all of that:
text(-1,1,1,Str1
I'm pretty sure there is a more efficient way for the If Then stuff
Please proofread your post more carefully and use [ code ] tags; your post is full of misinformation.
  • randInt: randInt(low,high) generates a random number between (and including) low and high. randInt(1,3) will produce 1, 2, or 3. randInt(1,10)->X will store a random number between 1 and 10, inclusive, to the variable X.
  • Strings: In TI-BASIC, strings are surrounded by quote marks ("), so "THIS IS A STRING" and "THIS IS ANOTHER STRING". You can store strings in the string variables Str1 through Str9 and Str0. "SOME FORTUNE"->Str9 will store the string "SOME FORTUNE" to variable Str9 for later use.
  • Displaying text: To start out, Disp is an easy way to display things on the homescreen. Disp 3 will display a 3, as will Disp "3". Disp Str9 will display the contents of the string variable Str9.
The correct and most compact form of that incorrect code you posted would look like this (your code is not the right way to use Then and Else:

Code:
randInt(0,1)->A
If A=0
"You will eat potatoes"->Str1
If A=1
"You will code a basic program"->Str1
Disp Str1

I recommend that you both take a look at this book. Smile
APotato wrote:
Ah ok! Wink Hmm, are you planning to edit some of the graph screen stuff in there so there can be a PCSE version? Or does pretty much all of it apply to the PCSE? If so, then I might just be able to convince my parents to let me purchase a copy Smile
Most of it applies to the color calculator, and I have also written a complete appendix that addresses the differences. I am waiting for my publisher to typeset it in some way; in the meantime I am emailing PDFs to people.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 3
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement