Author Topic: Color tetris  (Read 37106 times)

0 Members and 1 Guest are viewing this topic.

Offline Nick

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1166
  • Rating: +161/-3
  • You just got omnom'd
    • View Profile
    • Nick Steen
Color tetris
« on: November 07, 2011, 03:55:48 pm »
hello

i'm quite new to Lua programming (about 1 month, since i had to buy a TI-Nspire CX CAS for school :) ) and i'm making a Tetris game in color. I've already finished the general gameplay, but i want to know if someone has some special ideas to put into it. It might be nice if it wasn't just a standard tetris, but i haven't got the inspiration yet :)

so if someone likes to help: you're welcome!

and can somebody please tell me how to put a picture in this forum, cause i don't really get it xs thanks

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: Color tetris
« Reply #1 on: November 07, 2011, 03:57:14 pm »
If you copy this, you will be in good shape. http://www.tetrisfriends.com/

I'd say Marathon would be the one you'd want try to resemble most, but, any of the other modes are cool too.
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

Offline Nick

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1166
  • Rating: +161/-3
  • You just got omnom'd
    • View Profile
    • Nick Steen
Re: Color tetris
« Reply #2 on: November 07, 2011, 04:01:33 pm »
the purpose is to clear 5 lines in the first level, and then 6 and.. is it right?

yeah, but i've seen it al quite a lot, and that's what i'm trying to avoid, but i'll certainly put it into it, it's a standard to tetris, so it would be a lack in the game, thanks...

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: Color tetris
« Reply #3 on: November 07, 2011, 04:07:34 pm »
Well, its great that you already have programmed the basic game :D

If you have problems implanting certain stuff, you could always ask for some help here, as there are quite some Lua coders around :D

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: Color tetris
« Reply #4 on: November 07, 2011, 04:08:57 pm »
Heya Nick, welcome to the forums. :D I unfortunately cannot help as I never made a Tetris game, but I think there should at least be the two modes from the NES, where you either move one level up every 10 lines or so (and it falls faster and faster) and the other mode where you must get 25 lines without anything remaining. Also have different modes such as a difficulty setting that disables the ability to drop blocks faster and make them fall instantly and maybe even a mode that gets rid of the vertical block.

As for picture upload, you cannot do so until you get 5 posts I think (anti-spambot adult material upload protection), but you can use http://img.removedfromgame.com then use [img]image url[/img] to link to your post. :)

Offline Nick

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1166
  • Rating: +161/-3
  • You just got omnom'd
    • View Profile
    • Nick Steen
Re: Color tetris
« Reply #5 on: November 07, 2011, 04:13:41 pm »
thanks, i think it will be necessary, wuase it's only my second game..

well, while you're about it, i have a problem, but it might be fised fast. It's in the detection of the obstacles.
Every piece has a different color, and i store them in a table (with subtables so you get a kind of matrix), but when i fill 1 in if it's full (that means a piece is on that place) everything goes well, but when i fill in a number of 1 to 7, each number for a different color, it doesn't work anymore. The code below is for that 1-7 colorcheck...
on.checkleft checks if the left side of the block is free to move to the left

Code: [Select]
function on.checkLeft()
for i=1,fallingblock[9] do
for j=1,4 do
for k=1,7 do
if blocks[i+1+fallingblock[6]-fallingblock[9]+1*(fallingblock[9]-2)][j+fallingblock[5]-2]==k then
stopleft = true
end
end
end
end
if stopleft then
return 0
else
return 1
end
stopleft = false
end

Offline Nick

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1166
  • Rating: +161/-3
  • You just got omnom'd
    • View Profile
    • Nick Steen
Re: Color tetris
« Reply #6 on: November 07, 2011, 04:16:56 pm »
voila, and here's a screenshot, thanks to DJ_O

« Last Edit: November 07, 2011, 04:22:20 pm by Nick »

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: Color tetris
« Reply #7 on: November 07, 2011, 04:21:57 pm »
Nick, that screenshot looks really nice :)

Now about your code, is
Code: [Select]
for k=1,7 do
if blocks[i+1+fallingblock[6]-fallingblock[9]+1*(fallingblock[9]-2)][j+fallingblock[5]-2]==k then
stopleft = true
end
end
only to check if its between 1-7?
If so, its over complicated ^^
 
I'm now a bit too tired too explain more, but will do so tomorrow.

(Btw, are you Dutch/Belgian?)
« Last Edit: November 07, 2011, 04:22:38 pm by jimbauwens »

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: Color tetris
« Reply #8 on: November 07, 2011, 04:24:02 pm »
Looks nice so far. In the future are you planning to add textures to the blocks that looks like the originals, to make them look more 3D? It might also make it look better on older TI-Nspires that have no color.

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: Color tetris
« Reply #9 on: November 07, 2011, 04:24:48 pm »
Yep, looks very cool :D

You could also use textures if calc is not CX ... ?
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline Nick

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1166
  • Rating: +161/-3
  • You just got omnom'd
    • View Profile
    • Nick Steen
Re: Color tetris
« Reply #10 on: November 07, 2011, 04:27:39 pm »
yeah, i'm belgian.. i didn't even notice that you could see it on the screenshot :)

thanks, well it's the purpose to make it that way, but it just the beginning to make everything work, and then the lay-out will follow...

and for the code, yeah it is to check if that blocks[][] (that's the matrix that includes the total field) is not 0, i've tried it with ~=0, but it didn't work properly, it wouldn't move anymore...
« Last Edit: November 07, 2011, 04:33:48 pm by Nick »

Offline Nick

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1166
  • Rating: +161/-3
  • You just got omnom'd
    • View Profile
    • Nick Steen
Re: Color tetris
« Reply #11 on: November 07, 2011, 06:35:24 pm »
i finally got it working..and in the meanwhile, i changed the graphics a little bit, now there is a little 3D-piece effect like the real tetris :)

here's a screenshot, but never mind the numbers on the left side, they are only to know some values to debug it.


Offline AzNg0d1030

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 522
  • Rating: +45/-4
  • Hardcore anime watcher.
    • View Profile
Re: Color tetris
« Reply #12 on: November 07, 2011, 06:49:26 pm »
So it does get progressively faster? Also is there going to be a score and line counter? Also another nice thing would be to add in a screen that let's you choose from level 1-9 or something, so you can start easy or hard.
Make sure it fast enough on the calc. Some games on the cx are fast on comp but not on the calc itself. Make sure there is a button to instant drop and like a a down button that if held, speeds up drop. Use the number keys to move etc since the pad is clunky...

Just some (a lot srry) suggestions. 
You just lost the game.



Offline Nick

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1166
  • Rating: +161/-3
  • You just got omnom'd
    • View Profile
    • Nick Steen
Re: Color tetris
« Reply #13 on: November 07, 2011, 07:04:13 pm »
they're really nice, like the keypad usage could be very useful :)
Well, the dropdown button might need a bit of time, cause i don't know directly how to implement it, but i'll certainly have a look at it.

untill now, you can speedup with + and -, it doesn't go atuomatically, but it can go to level 20 with a really nice speed, the block is totally down in about 3 seconds, so... :)

and i've also implemented that it checks if the calc has a colorscreen, if not, it uses white and black as background colors, otherwise pink and grey

« Last Edit: November 07, 2011, 07:04:38 pm by Nick »

Offline AzNg0d1030

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 522
  • Rating: +45/-4
  • Hardcore anime watcher.
    • View Profile
Re: Color tetris
« Reply #14 on: November 07, 2011, 07:55:06 pm »
they're really nice, like the keypad usage could be very useful :)
Well, the dropdown button might need a bit of time, cause i don't know directly how to implement it, but i'll certainly have a look at it.

untill now, you can speedup with + and -, it doesn't go atuomatically, but it can go to level 20 with a really nice speed, the block is totally down in about 3 seconds, so... :)

and i've also implemented that it checks if the calc has a colorscreen, if not, it uses white and black as background colors, otherwise pink and grey

Nice!  It doesn't necessarily need the fast down button, as I normally don't use it.  I don't know about others though.  No automatic leveling?  Aw shucks.  Oh, also, is there a system that gives you more points if you get 2 lines, even more points if you get 3 lines, and also more points for a tetris? Plus you get points for using the instant down? If possible, a highscore list with names too :D

Lol I'm naming quite some stuff...
You don't have to do all this.  I'm just going crazy since it's tetris!

EDIT: There is a thread in the Lua Language forum that is about storing highscores for Lua programs
« Last Edit: November 07, 2011, 08:09:55 pm by AzNg0d1030 »
You just lost the game.