I have been programming in Ti-Basic for some years, and I wanted to program something. So, I challenged myself to make tetris in Ti-Basic.

It's now going fine, as i have made it possible to fall blocks (one block unfortunately), collision detection, and most important of all: a clear line mechanism that is well suited to multi-line line clears.
Screenshots!



As you can see, I have a lot of basic features here, but I still have a lot to do. Here's a checklist for what I'm going to do:
1. Multi-blocked falling blocks (Maybe using lists?)
2. Score (Definitely)
3. High score table, with scrolling screens and a lot of stats (Line clears, tetrises, etc.)
Wow, got featured today (or yesterday)!
UI update:
Because of speed issues, I'll be using the Pt-On( command to draw squares instead of four Pxl-On( commands.
Screenshot:

Also, I'm working on a way to store tetrominoes in a list. Currently I'm doing the two-blocked case.
Stay tuned!
Keep up the good work! Pt-On() is definitely the right solution here. What's your plan for rotation and detecting collisions in full tetrominos while dropping?
Well, I haven't coded that part, but I think that I'd simulate it and see if it collides. Probably will be in a subprogram (I already have 4 of then Razz).
As for the data, I think that I'd use L1~L6 and add-on an L7 as a custom list. Details not clarified yet, but we'll see...
I finally got rotation working!

Now it's just collision detection Wacko
Today I got collision detection working. Unfortunately, It came at the cost of the game becoming VERY SLOW Sad . So, I'm going to try and optimize the code until it can run smoothly again. Oh, and I can make tiles of ANY size by recording the relative positions of the squares from the "turning center". Very Happy Very Happy Very Happy Stay tuned!

EDIT: SourceCoder link.
Nice bit of work you have going there!

I, too, felt the need once upon a time to build a Tetris game in BASIC. It was a lot of fun and quite informative. One of the big things I made myself do was do it all in one program, as when I was quite active I was trying to reduce the amount of sub programs I would use.

https://www.cemetech.net/downloads/files/971/x971
Some low-hanging fruit:


Code:
[[0,0,0,~1,0,1,0,2][0,0,0,~1,1,0,~1,0][0,0,1,~1,1,0,~1,0][0,0,~1,~1,1,0,~1,0][0,0,~1,0,0,1,1,1][0,0,1,0,0,1,1,~1][0,0,1,0,0,1,1,1->[B]
[B]^^T->[B]


Instead of writing the matrix out and then transposing it, you should write out the transposed version. If you have the matrix in memory you can insert it into your program with rcl.

Calling a sub-program is very slow - I would fold the smaller ones into the larger programs.


Code:
While BC
If not(BC
Goto E
...
Lbl E
End


This is probably unnecessary.

|LCHK is used enough times to warrant the usage of a single-letter or default list probably.


Code:
   If K=24 and not(F
   B-1->B
   If K=26 and not(F
   B+1->B
   If K=25 and not(F
   1+D(D!=4->D
   If not(F
   Then

If you move these single-line ifs into the block-if, you can eliminate the and not(F condition on each of them.
@iPhoenix

1: Done
2:Uh, what do you mean when you fold a program into another program? Confused
3:Done
4:Done
5:Done

Oh, as a sidenote, I've found that the clear lines code is broken, so I'm going to fix that. Smile
SCREENSHOTS!

Unfortunately, there are still some mysterious bugs here and there, but at least I have the full seven tetrominoes! Wink

EDIT: I've found a fatal bug, it can be found on the third line of prgmZTCD1, it happens when I rotate an L or J piece near the edge and when it overlaps with the other squares. The OS says it's a dimension error even though it is a real being stored into a real. Sad
Thanks in advance for anyone who can fix this or explain this.

Code: https://www.cemetech.net/sc/?hash=GHLadzp4NsvZr3f8U6j8fOpgzLu+
I'm really sorry to post this, but I've decided to put this project on hold. Sad
I might restart this project in the future, but no guarantees.
See you next time!

Edit: for any optimization gurus, the main problem is it's SLOW
I'm working on my own version of Tetris that also uses lists, and I'm running into some optimization problems as well (but nothing game-breaking).
  
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 1
» 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