Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: Potato on March 31, 2011, 07:43:35 pm

Title: Tetris on the calculator - Help?
Post by: Potato on March 31, 2011, 07:43:35 pm
[This is my first post and I'm still a little confused so sorry if I post this in the wrong place]
[Yes I already know it's been made]
Hey, I'm a amateur coder using BASIC and my current project is Tetris.  So far I have my program to do these things (in this order)

1) Loop
2) Rand int (1,7)
3) Run a program based on the number randomed
4) The program than creates the tetris piece (right now it's a letter but I'm going to fix this later)
5) The tetris piece than falls at a constant rate with a imprint of the same piece under it  (This does not fall) (The tetris piece can be moved left and right; hard and soft drop to be added later)
6) Once the tetris piece lands the bottom of the screen (where the imprint is) is cleared
7) Loop again

Problems I have:
-[Solved, thanks guys] The tetris pieces don't stack.  Right now it isn't coded to but I can't think of a realistic way to do this
-I can't spin the tetris pieces.  Again can't think of a real way to do this (other than when the spin button is pressed it changes the piece all together to the spun all together)
-Can't make tetris pieces (realistically)

Things to be implemented
-Score and high scores (not sure if I want to add this)
-Ability to clear
-User interface
-Menu
-Hold
-Specials (perfect clear, t-spin, tetris etc etc etc)

If it's any help, each of the blocks that make up the tetris pieces will be 2x2 pixels (most likely) and each tetris piece is composed of 4 tetris blocks.  

Title: Re: Tetris on the calculator - Help?
Post by: ztrumpet on March 31, 2011, 07:46:58 pm
Welcome to Omnimaga, Potato. :)

Basic Tetris would be a very hard game to program indeed.  There's a finished version in basic by Builderboy located here (http://ourl.ca/4602/85759).  I still recommend seeing your program out to completion though, as it's a good exercise in coding.  I'm sure Builderboy won't mind if you look at his code for ideas.  Good luck! ;D
Title: Re: Tetris on the calculator - Help?
Post by: turiqwalrus on March 31, 2011, 07:48:08 pm
to stack, try using pixel test.
spinning... how do you store the tetris piece in memory? a list? a variable?
anyway, welcome to omni!
have the peanuts
Title: Re: Tetris on the calculator - Help?
Post by: Potato on March 31, 2011, 07:50:44 pm
Welcome to Omnimaga, Potato. :)

Basic Tetris would be a very hard game to program indeed.  There's a finished version in basic by Builderboy located here (http://ourl.ca/4602/85759).  I still recommend seeing your program out to completion though, as it's a good exercise in coding.  I'm sure Builderboy won't mind if you look at his code for ideas.  Good luck! ;D

I plan to 1 up his.

And I lost my wire. :(

Can you view programs on the calc (the code)
Title: Re: Tetris on the calculator - Help?
Post by: Yeong on March 31, 2011, 07:51:36 pm
cemetech's sourcecoder 2.0
EDIT: URL Here
http://www.cemetech.net/projects/basicelite/sourcecoder2.php (http://www.cemetech.net/projects/basicelite/sourcecoder2.php)
Title: Re: Tetris on the calculator - Help?
Post by: Potato on March 31, 2011, 07:51:48 pm
to stack, try using pixel test.
spinning... how do you store the tetris piece in memory? a list? a variable?
anyway, welcome to omni!
have the peanuts

What do you mean store the tetris piece?
The picture or ones that have already landed or which piece?



cemetech's sourcecoder 2.0

Thanks :D



Edit by ZTrumpet: Doublepost merged.
Title: Re: Tetris on the calculator - Help?
Post by: Yeong on March 31, 2011, 07:54:18 pm
Ur welcome.
And try not to double post next time though XP
Use Modify button instead.
Title: Re: Tetris on the calculator - Help?
Post by: Potato on March 31, 2011, 07:56:54 pm
Sorry >< New and such
Title: Re: Tetris on the calculator - Help?
Post by: ztrumpet on March 31, 2011, 08:02:01 pm
Sorry >< New and such
You're new, so it's perfectly fine. :)
Title: Re: Tetris on the calculator - Help?
Post by: turiqwalrus on March 31, 2011, 08:07:19 pm
to stack, try using pixel test.
spinning... how do you store the tetris piece in memory? a list? a variable?
anyway, welcome to omni!
have the peanuts

What do you mean store the tetris piece?
The picture or ones that have already landed or which piece?
the one that you are moving.
Title: Re: Tetris on the calculator - Help?
Post by: DJ Omnimaga on March 31, 2011, 08:11:19 pm
Heya and welcome on the forums. Unfortunately I cannot help as I never programmed a Tetris game before. However I heard it was a challenging project for a new programmer, so you must be prepared for a huge task and ready to take on such large project. Good luck if you decide to take on it.
Title: Re: Tetris on the calculator - Help?
Post by: Potato on March 31, 2011, 08:21:23 pm
to stack, try using pixel test.
spinning... how do you store the tetris piece in memory? a list? a variable?
anyway, welcome to omni!
have the peanuts

What do you mean store the tetris piece?
The picture or ones that have already landed or which piece?


the one that you are moving.

To be honest, right now I'm not entirely sure.  The only way I know right now how to make them is to go through each time and make the pixels.  Although I'm afraid that might make it too slow so perhaps using pics (not sure how to use them though).

Heya and welcome on the forums. Unfortunately I cannot help as I never programmed a Tetris game before. However I heard it was a challenging project for a new programmer, so you must be prepared for a huge task and ready to take on such large project. Good luck if you decide to take on it.

Thanks :)

I'm not exactly a new programmer (but I'm def not a pro).  I've made basic stuff and I'm also working on minesweeper (just don't feel like finishing it at the moment)
Title: Re: Tetris on the calculator - Help?
Post by: Michael_Lee on March 31, 2011, 08:25:02 pm
Welcome to Omnimaga!

to stack, try using pixel test.
spinning... how do you store the tetris piece in memory? a list? a variable?
anyway, welcome to omni!
have the peanuts

What do you mean store the tetris piece?
The picture or ones that have already landed or which piece?
the one that you are moving.

To be honest, right now I'm not entirely sure.  The only way I know right now how to make them is to go through each time and make the pixels.  Although I'm afraid that might make it too slow so perhaps using pics (not sure how to use them though).

How does the calculator know which pixels to turn on to make the particular shape that is moving?

Does it check a list to see which pixels it should turn on?
Is it hardcoded in?
Or does it use some other method?
Title: Re: Tetris on the calculator - Help?
Post by: Potato on March 31, 2011, 08:31:28 pm
Welcome to Omnimaga!

to stack, try using pixel test.
spinning... how do you store the tetris piece in memory? a list? a variable?
anyway, welcome to omni!
have the peanuts

What do you mean store the tetris piece?
The picture or ones that have already landed or which piece?
the one that you are moving.

To be honest, right now I'm not entirely sure.  The only way I know right now how to make them is to go through each time and make the pixels.  Although I'm afraid that might make it too slow so perhaps using pics (not sure how to use them though).

How does the calculator know which pixels to turn on to make the particular shape that is moving?

Does it check a list to see which pixels it should turn on?
Is it hardcoded in?
Or does it use some other method?

Well right now it's just using letters (I was testing it)

Basically it rands an int 1-7 and that pics a program (dropai1 through dropai2)

Those programs look basically like this

:1->M
:45->X
:1->Y
:While M≠ 45
:Getkey->M
:Text(57,X,"X"
:If B=1
:Then
:Y+1->Y
:Text(Y,x,"x"
:end
:If Pxl-Test(Y+7,X
:Then
:45->M
:end
:If Y=48
:then
:45->M
:If M=24 and X>5
:Then
:Text (Y,x," "
:text (57,x," "
:x-1->x
:end
:If M=26 and X<90
:then
:text(y,x," "
:text(57,x," "
:x+1->x
:end
:end
Title: Re: Tetris on the calculator - Help?
Post by: DJ Omnimaga on April 22, 2011, 09:30:31 pm
How is this going by the way?
Title: Re: Tetris on the calculator - Help?
Post by: Potato on April 23, 2011, 02:11:05 pm
How is this going by the way?

Well it WAS going good until my calculator broke and I had to restart...Haven't had the motivation to start that over yet lol

What I had going was it picked a random number between 1-7 and that in turn opened up a program based on the number.  The program made a piece fall and when it hit the bottom it stopped.  I also made it so the pieces could stack and I was working on making secondary programs so that when you hit a key (I think i set it to alpha or 2nd) it would switch the program and instead of say a l piece falling it would be a _ piece now (it turned).  Didn't finish that.  I plan on picking it back up soon though so I'll update you with it later :)

[Moral of the story: Back up your work on the computer]
Title: Re: Tetris on the calculator - Help?
Post by: jnesselr on April 23, 2011, 02:15:21 pm
Sorry to here about the mem clear.
Title: Re: Tetris on the calculator - Help?
Post by: Potato on April 23, 2011, 02:16:24 pm
Sorry to here about the mem clear.

Oh it wasn't a mem clear.  the only button that worked was the on button.

And for some reason I couldn't link it to my computer either.
Title: Re: Tetris on the calculator - Help?
Post by: jnesselr on April 23, 2011, 02:18:50 pm
Sorry to here about the mem clear.

Oh it wasn't a mem clear.  the only button that worked was the on button.

And for some reason I couldn't link it to my computer either.
Strange.  How did you reset it?  Just pull a battery?
Title: Re: Tetris on the calculator - Help?
Post by: Potato on April 23, 2011, 02:22:33 pm
Sorry to here about the mem clear.

Oh it wasn't a mem clear.  the only button that worked was the on button.

And for some reason I couldn't link it to my computer either.
Strange.  How did you reset it?  Just pull a battery?

Couldn't, had to get a new one. 
Title: Re: Tetris on the calculator - Help?
Post by: jnesselr on April 23, 2011, 02:25:36 pm
Sorry to here about the mem clear.

Oh it wasn't a mem clear.  the only button that worked was the on button.

And for some reason I couldn't link it to my computer either.
Strange.  How did you reset it?  Just pull a battery?

Couldn't, had to get a new one. 
You had to get a new calculator??? We might have been able to help you fix the problem.  Did you try turning it on while holding the Del or Stat key?
Title: Re: Tetris on the calculator - Help?
Post by: Potato on April 23, 2011, 09:39:43 pm
Sorry to here about the mem clear.

Oh it wasn't a mem clear.  the only button that worked was the on button.

And for some reason I couldn't link it to my computer either.
Strange.  How did you reset it?  Just pull a battery?

Couldn't, had to get a new one. 
You had to get a new calculator??? We might have been able to help you fix the problem.  Did you try turning it on while holding the Del or Stat key?

Yeah. :I 

It's not like I wasted money or anything; the new calculator was actually my cousin's old one. 
Title: Re: Tetris on the calculator - Help?
Post by: DJ Omnimaga on April 29, 2011, 02:40:24 am
This sucks. I hope you don't have issues with your new one. As you said, the next time you should back up though, in case.