Author Topic: Tetris on the calculator - Help?  (Read 10181 times)

0 Members and 2 Guests are viewing this topic.

Offline Potato

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 18
  • Rating: +0/-0
    • View Profile
Tetris on the calculator - Help?
« 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.  

« Last Edit: March 31, 2011, 08:22:03 pm by Potato »

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Tetris on the calculator - Help?
« Reply #1 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.  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

Offline turiqwalrus

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 840
  • Rating: +51/-2
  • Wheeeeeee~!
    • View Profile
Re: Tetris on the calculator - Help?
« Reply #2 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

Offline Potato

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 18
  • Rating: +0/-0
    • View Profile
Re: Tetris on the calculator - Help?
« Reply #3 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.  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)

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: Tetris on the calculator - Help?
« Reply #4 on: March 31, 2011, 07:51:36 pm »
cemetech's sourcecoder 2.0
EDIT: URL Here
http://www.cemetech.net/projects/basicelite/sourcecoder2.php
« Last Edit: March 31, 2011, 07:52:08 pm by yeongJIN_COOL »
Sig wipe!

Offline Potato

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 18
  • Rating: +0/-0
    • View Profile
Re: Tetris on the calculator - Help?
« Reply #5 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.
« Last Edit: March 31, 2011, 07:55:38 pm by ztrumpet »

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: Tetris on the calculator - Help?
« Reply #6 on: March 31, 2011, 07:54:18 pm »
Ur welcome.
And try not to double post next time though XP
Use Modify button instead.
Sig wipe!

Offline Potato

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 18
  • Rating: +0/-0
    • View Profile
Re: Tetris on the calculator - Help?
« Reply #7 on: March 31, 2011, 07:56:54 pm »
Sorry >< New and such

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Tetris on the calculator - Help?
« Reply #8 on: March 31, 2011, 08:02:01 pm »
Sorry >< New and such
You're new, so it's perfectly fine. :)

Offline turiqwalrus

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 840
  • Rating: +51/-2
  • Wheeeeeee~!
    • View Profile
Re: Tetris on the calculator - Help?
« Reply #9 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.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Tetris on the calculator - Help?
« Reply #10 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.

Offline Potato

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 18
  • Rating: +0/-0
    • View Profile
Re: Tetris on the calculator - Help?
« Reply #11 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)
« Last Edit: March 31, 2011, 08:23:30 pm by Potato »

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Tetris on the calculator - Help?
« Reply #12 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?
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline Potato

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 18
  • Rating: +0/-0
    • View Profile
Re: Tetris on the calculator - Help?
« Reply #13 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
« Last Edit: March 31, 2011, 08:31:52 pm by Potato »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Tetris on the calculator - Help?
« Reply #14 on: April 22, 2011, 09:30:31 pm »
How is this going by the way?