Omnimaga
Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: Sorunome on October 23, 2011, 02:41:05 pm
-
Hi, I have started some days ago programming Tetris in grammer! Some of you may have noticed me talking about it on chat. Well, for those who don't: I have already pretty much done, I think I'll have the beta up soon!
What I have already done:
- all blocks, you can rotate them
- checks that you can't go to far left/right
- checks that you cant go through other blocks
- checks whether the block hits the bottom or a other block
- the possibility for fast down (pressing down-button)
- automatic go down
Things I have to add for the beta:
- check whether a line is complete
- make that line go away
- check whether you lost
- put in that it is random what figure appears (easy, just one line of code! :D)
- take out the possibility to change the figure by pressing 2ND :D :D :D
Things I then STILL have to do for the full version:
- score
- make it go down faster after some time
- menu
- high-score list
- display the next block
( - some other cool features!)
Sorry, I don't have any screenies yet. I don't know if I will even make any before the betta. Please tell what you think about it! :)
-
good luck! XD
-
So you have a way to make sure the block doesn't go through another block? Then you can probably use a series of pxl-Test( in a for loop to test if a line is complete. If the shape was 2 blocks tall, you only need to test those two rows.
Use the same idea for checking if you lose :)
As for shifting blocks down, I am not sure how that will work :/ I know I could whip up some code in Grammer, but it would be a little complicated and use several buffers.
EDIT: Okay, here is the complicated piece code I was talking about XD It took some thought, but I figured it out :)
Send(768,"VGBuf→K
37696→J
Lbl "SD→I
<<code>>
.SD
Disp K
ClrDraw
Line(X,Y,H-4,W,1
Fill(10,J
Fill(13,J
Tangent(4,1
Fill(13,J
Disp J
Line(X,Y,H,W,0
Fill(9,K
End
The shifting code is at .SD
The inputs to that subroutine are:
X and Y are the upper left coordinates of the place to begin shifting at
H and W are the height and width of the region to shift down
K points to a 768-byte buffer
J points to the main buffer (usually the graph buffer)
I hope that helps!
-
Good luck with this. :D
-
So you have a way to make sure the block doesn't go through another block? Then you can probably use a series of pxl-Test( in a for loop to test if a line is complete. If the shape was 2 blocks tall, you only need to test those two rows.
Use the same idea for checking if you lose :)
As for shifting blocks down, I am not sure how that will work Undecided I know I could whip up some code in Grammer, but it would be a little complicated and use several buffers.
I was already going to make the check weather a line is complete with pixel checks. :P
And If you lose I wanted to check the y-variable, if it is to small you lose.
And to the shifting: I draw all figures twice: once it leaves the loop where it waits for a keypress/shifting down it draws the figure in white pixels, I change the position of the figure and then I draw it in black ones! xD
-
Oh, I meant shifting the whole block so when a row gets deleted, the ones above can be shifted down :)
-
Good luck! :)
-
Oh, I meant shifting the whole block so when a row gets deleted, the ones above can be shifted down :)
I alswell wanted to do that with ixel test. :)
-
I don't know why, but it throughs an error when it shall shift everything down if a line is complete.....
Well, this is the responsible code::For(O,1,26
:0→H
:For(A,1,10
:H +pxl-Test(65535+O*4,1+4*A)
:→H
:End
:If H=10
:Then
:O-1→O
:For(P,0,O)
:For(Q,1,10)
:O-P→R
:pxl-Test(4*R,4*Q)→K
:If K=1
:Then
:Line(4*Q,4*R,4,4,0
:Line(4*Q,4*1+R,4,4,1
:End
:If K=0
:Line(4*Q,4*1+R,4,4,0
:DispGraph
:End
:End
:
:End
Please help me! D:
-
Okay, so you asked on IRC about how to use the code I gave, but I will post here anyway...
With mine, you will need 2 buffers J and K. Just use 37696→J for the graph buffer and create a tempprog of 768 bytes for the other. So somewhere at the beginning of your code:
37696→J
Send(768,"VTeMP→K
...And yes, that is a lowercase e >.>
-
Ok, cool, thanks. I think I'll have beta up soon!
All I need to do now is a check whether you die! :)
-
Ok, I have finally finished the beta of this! (Some of you may think this isn't allowed due to double posting rules, but I checked them and you may double post in the next hour when you have big project updates)
Well, the controls are simple, up is rotate block, and the other arrow keys are quite obvious! :P
Clear is exit.
If you lose the game just simply exits.
Be sure to check out the screenshot!
-
Just tried. Nice!
It gives me syntax error if I die :P
-
Looks very nice! :D
-
Thanks both of you!
Yeong: I don't know why it throughs a syntax error, to me it doesn't... :S
-
Looks impressive! I'll try this out when I can.
-
Wow, I was just going to look up some math stuff when I got distracted by Omnimaga. Great job Sorunome! I plan to download this as soon as I get back home!
-
Cool! Thanks both of you!
Xeda: If you want to optimize the code, feel free to do so, but I think you'll have to talk with yeong, 'cause he is optimizing the code atm! :P
-
Awwwww, I wish these computers had ti-connect D: This is too cool, I didn't know how great it would turn out!
-
Cool! Thanks both of you!
Xeda: If you want to optimize the code, feel free to do so, but I think you'll have to talk with yeong, 'cause he is optimizing the code atm! :P
and cleared around like 70-80 bytes of codes :D (so far)
-
Cool! Thanks a lot! :)
-
Hehe, I am sure I can clear out a few hundred in one fell swoop Fwahahaha :D
It helps that I know most of the super optimisations >.>
EDIT: I got it down to 3800 bytes, but it seems to mess up the screen after starting, so I will need to go through and fix stuff D:
EDIT2: It was just a mislabled label :D It now works, but it doesn't detect a filled line or when you are dead D: Now I have to see where I broke that D:
-
Hehe, I am sure I can clear out a few hundred in one fell swoop Fwahahaha :D
It helps that I know most of the super optimisations >.>
EDIT: I got it down to 3800 bytes, but it seems to mess up the screen after starting, so I will need to go through and fix stuff D:
EDIT2: It was just a mislabled label :D It now works, but it doesn't detect a filled line or when you are dead D: Now I have to see where I broke that D:
<_<
lol
-
bug report:
-
Btw what is the routine you are using for line clearing? It looks a tad bit slow and maybe i could provide a quick solution :D
-
Um, the way he had it was one I designed as a workaround... It had to use another buffer doing some fancy masking. The next version should have a new method, though, that is a Grammer rectangle routine that shifts a section of the screen.
I think the speed issue is all of the If statements and pixel tests, though x.x
@yeong: Which version is that? Is that the 5000 byte version?
-
yes.
-
Looks really nice :D, minus the bug. x.x
-
cant wait untill it gets released
-
Well you can download the beta...
-
I know it is so awesome
-
I kind of want to see just how fast and optimised I can make it... >.>
-
I kind of want to see just how fast and optimised I can make it... >.>
And then suddenly Xeda codes Tetris in eight bytes.
-
7, actually >.>
(not really!)
-
Well...
:Tetris()
Syntax: no args, starts a game of tetris.
This should definitely be a command.
-
Actually, I could make that a command. Seriously. I was thinking of including subprograms directly in the App data.
-
:ARUN()
:ARUN.ACHIEVEMENT(unlock)
-
I feel like I missed something.... so many new posts! O.o Well:
@annoyingcalc: thanks!
@yeong: I thought, that I had removed all these bugs...... I don't know why, I'll check the code again.
I'm also currently working on the score. :)
EDIT: Fixed that bug! :)
-
Awesome! Cool :D Do you have an update posted? I am trying to think of what commands I can add to speed up Tetris...
EDIT: I was also wondering if I could use the Tetris screenie to show off what Grammer can do? (like when I update on TICalc and whatnot)
-
i don't know if i can help, but it might be better/faster not to use a pixel test to check if the block has to stop. I use a table that represents the field, and every scuare block is one element in the table, so you should have a table of 20x10 i think (20 rows, 10 cols)
you just have to check if the tablevalue is 0 or 1 and if 1, stop moving..
-
I am not sure that would speed things up too much just because of how Grammer works. Grammer treats pixel testing as reading from an array as it is, but that could still be useful... Thanks!
-
oh sorry, well i don't know grammer xs but i'll thought, why not, maybe it will helps. but i wish you good luck with it, it looks nice and fluent :)
-
Ok, here are some updates: I added now a score, the figures now fall down from all the top (they begin outside the screen) and it also gets faster after some time.
@Xeda: yeah, just use it, the screenie! :)
-
:D Thanks! And hooray for updates :D
-
Hey good luck for the zcontest :)
I'm a tetris fan, nice game :)
-
Thanks! I'll update ass soon as possible, Xeda is currently optimizing the code! :)
-
I only could optimise a little bit, so far, so good coding! And I also noticed that this is about as fast and as smooth as a Gameboy game I played one O.O
-
:w00t: Cool! Thanks! :)
-
:w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t:
I finished The final Version 1.0!!!!!!!!!!!!!!!!!!!
Well, here it is:
Download! (http://www.omnimaga.org/index.php?action=downloads;sa=view;down=747)
(http://img.removedfromgame.com/imgs/tetris beta 2.gif)
-
Ooh, great job!
-
Thanks a lot! Tell if you have any idea how to make it more awesome! :)
-
:w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t:
I finished The final Version 1.0!!!!!!!!!!!!!!!!!!!
Well, here it is:
Download! (http://www.omnimaga.org/index.php?action=downloads;sa=view;down=747)
(http://img.removedfromgame.com/imgs/tetris beta 2.gif)
Looks wonderfull. :D Just the score looks a little strange to me IMHO.
-
Well, evrytime you press down you get a score of +1
-
Awesome job Sorunome! I like that the options are saved, too! And the menu selection thingy is lovely :3 +1 :D
-
Cool, thanks!
One of the best things I'm at at programming is menus, even that options are saved :) (That main menu was made in like three minuets ^^)
-
Yeah, the menu is quite cool. :D Also I guess that highscore thing is Ok.
-
Thanks! Have you got any idea how to make it even more awesome?
-
Looking quite nice!
Thanks! Have you got any idea how to make it even more awesome?
I would suggest a way to make a block instantly fall down without having to spend time watching it fly, even if you're holding down.
-
Yeah, thats true. Also if you're bored you could make an insane death scene. :P lol.
-
D: That would be complicated, and I don't know if it would be much faster....but I'll try! :)
-
:w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t: :w00t:
I finished The final Version 1.0!!!!!!!!!!!!!!!!!!!
Well, here it is:
Download! (http://www.omnimaga.org/index.php?action=downloads;sa=view;down=747)
(http://img.removedfromgame.com/imgs/tetris beta 2.gif)
Level 3 seems hard O.O, blocks falls faster than the last levels in the NES Tetris O.O
Nice, though.
-
It is just so fast because xeda pressed down during making of the screenie :P
And thanks! :)
-
Oh, well I will say that level 8 with the new version of Grammer is quite fast x.x I wonder if you might need to recalibrate the delays .___.
The new version did manage to speed up Tetris a bit...
-
O.o that is fast.../me really has to recalibrate, but i think i'll first of all work more on mino. :)
-
Ah I see now, I thought this was because it was like some sort of extreme difficulty Tetris. :P