I'm confused. When you use getKey, how do you decide what it equals to? I.e. K=45, K=120, etc. I'm a newer programmer and I'm having some trouble understanding it. I'd appreciate any answers. Thank you.
You don't get to decide what getKey is equal to, you are just checking for the key value you want in K to see if the user pressed a certain button.
Please use this handy chart:And if you need help with getKey just look here: http://tibasicdev.wikidot.com/getkey
So then if I want a character to be moving whenever the arrow keys are pressed (for example), how would I set up the getKey to make that work? Sorry I'm asking so many questions but I'm trying to code a version of pong and I was having some trouble with the getKey.
Here's a simple starting example I just came up with. Note things after the // are comments, not part of the code
1->A //initialize character y value location
Repeat K=45 //repeat main game loop until player presses clear
//use Output( here to display your character, using variable A for the location
Repeat Ans
getKey
End
Ans->K
//use Output( here again to erase your character with some " " spaces
If K=25 and A>1 //if player presses up
A-1->A
If K=34 and A<8 //if player presses down
A+1->A
End
Here is a complete and more optimized version of pong, with the ball and all, but it may be a bit more difficult to understand: http://tibasicdev.wikidot.com/pong
Feel free to ask more questions and experiment with your own program.
Also the version of Pong you sent is the code I referred to. I understand most things about it, I just had trouble understanding the code for having the ball bounce off the wall, moving the paddle, stuff like that.
I'd recommend looking online for a tutorial. I can draft up the code for a basic (no pun intended) one, and explain how it works, but seeing someone develop it is a lot better