Omnimaga

Calculator Community => TI Calculators => Lua => Topic started by: Nick on November 07, 2011, 03:55:48 pm

Title: Color tetris
Post by: Nick 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
Title: Re: Color tetris
Post by: thepenguin77 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.
Title: Re: Color tetris
Post by: Nick 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...
Title: Re: Color tetris
Post by: Jim Bauwens 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
Title: Re: Color tetris
Post by: DJ Omnimaga 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. :)
Title: Re: Color tetris
Post by: Nick 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
Title: Re: Color tetris
Post by: Nick on November 07, 2011, 04:16:56 pm
voila, and here's a screenshot, thanks to DJ_O

(http://img.removedfromgame.com/imgs/Tetris_color.JPG)
Title: Re: Color tetris
Post by: Jim Bauwens 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?)
Title: Re: Color tetris
Post by: DJ Omnimaga 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.
Title: Re: Color tetris
Post by: Adriweb on November 07, 2011, 04:24:48 pm
Yep, looks very cool :D

You could also use textures if calc is not CX ... ?
Title: Re: Color tetris
Post by: Nick 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...
Title: Re: Color tetris
Post by: Nick 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.

(http://img.removedfromgame.com/imgs/0-Tetris_color.JPG)
Title: Re: Color tetris
Post by: AzNg0d1030 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. 
Title: Re: Color tetris
Post by: Nick 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

(http://img.removedfromgame.com/imgs/color_vs_bw.JPG)
Title: Re: Color tetris
Post by: AzNg0d1030 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
Title: Re: Color tetris
Post by: DJ Omnimaga on November 07, 2011, 08:57:16 pm
Looks nice. As for the blocks, the lighter ones could probably have a darker color or a lighter outline thing to the top/left.
Title: Re: Color tetris
Post by: AzNg0d1030 on November 07, 2011, 09:38:40 pm
Looks nice. As for the blocks, the lighter ones could probably have a darker color or a lighter outline thing to the top/left.
True, it looks like a tiny triangle in the top right corner of the block, or top left in this case.  Whichever looks better here.
Title: Re: Color tetris
Post by: ralphdspam on November 08, 2011, 12:36:37 am
Nice!  It doesn't necessarily need the fast down button, as I normally don't use it. 

I'd like the fast-down button; I use it more often than the soft-down button.  ;)
Title: Re: Color tetris
Post by: Nick on November 08, 2011, 12:52:12 am
i'll have a try on that button :) cause it's nice to have..

i also have a problem with the turning of the blocks it seems. i thought i only had to transpose the matrix, but in fact, it doesn't work, cause you only have two positions then. how can i fix this?
Title: Re: Color tetris
Post by: AzNg0d1030 on November 08, 2011, 01:06:52 am
i'll have a try on that button :) cause it's nice to have..

i also have a problem with the turning of the blocks it seems. i thought i only had to transpose the matrix, but in fact, it doesn't work, cause you only have two positions then. how can i fix this?
maybe the person who made nTris will know. Search it up on here. There is a thread for it. It's for nspire too (just not cx or something)
Title: Re: Color tetris
Post by: Jim Bauwens on November 08, 2011, 10:41:33 am
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...
Well, it should work, so probably the problem is somewhere else.
You say that it only works with 1, while even with this setup it should work. This confirms the thing above even more.
So .. have fun with bug hunting, and don't hesitate to ask questions :)

I'm also Belgian, and there are quite some dutch speaking people over here. So if you really don't know how to explain something in English, don't be afraid to ask it in dutch :)
Title: Re: Color tetris
Post by: Nick on November 08, 2011, 11:02:25 am
I just solved the problem, it all works nice, i have add the marathon function: every 5 lines you go a level up, and you get a higher score when erasing multiple lines at once.
I used 2*numberoflines if linescleared>1, so 1 line gives 1 point, 2 lines gives 3 points, 3 lines gives 7 points and so on...

Oh, and that's really nice to know, it might be very handy to know, merci om 't met andere woorden te zeggen :)
Title: Re: Color tetris
Post by: Nick on November 08, 2011, 07:04:59 pm
can somebody tell me what's wrong with the code below?
it has to erase the upper line of a tablematrix if all the entries on the first row are 0 and replace it with a {0,0,0,0} entry on the 4th place of the table...
transpon is the table that holds the values 1 and 0 like this: transpon = {{0,1,0,0},{1,1,1,0},{0,0,0,0},{0,0,0,0},..and yet some other stuff here}

Code: [Select]
count = 0
for i=1,4 do
if transpon[1][i]==0 then
count = count + 1
end
end
if count==4 then
table.remove(transpon[1])
table.insert(transpon,4,{0,0,0,0})
count = 0
end
Title: Re: Color tetris
Post by: AzNg0d1030 on November 08, 2011, 09:32:58 pm
I just solved the problem, it all works nice, i have add the marathon function: every 5 lines you go a level up, and you get a higher score when erasing multiple lines at once.
I used 2*numberoflines if linescleared>1, so 1 line gives 1 point, 2 lines gives 3 points, 3 lines gives 7 points and so on...

Oh, and that's really nice to know, it might be very handy to know, merci om 't met andere woorden te zeggen :)
Every 5 lines?  I went up to level 20 and saw how fast it was.  Are you sure 5 lines? :O  Or maybe it should be like steps, where level 1 is # of lines, then level 2 is # of lines + 1, level 3 # +2  or something.  Or else for some it might get too hard too fast...
Title: Re: Color tetris
Post by: Jim Bauwens on November 09, 2011, 04:23:54 am
I think you are mixing transpon and transpon [1] :
Code: [Select]
table.remove(transpon[1])
table.insert(transpon,4,{0,0,0,0})

I think you need

Code: [Select]
table.remove(transpon, 1)
table.insert(transpon,4,{0,0,0,0})
Title: Re: Color tetris
Post by: Nick on November 09, 2011, 01:20:02 pm
yeah, that's it, thanks, now everything works as it should be, the only problem is that if a block turns when it's next to a wall, they dissapear like half into it, so i'll just have to fix that and the first "official" beta edition of ColorTetris will be finished. The only challenge included now is marathon, but this will be my next adjustment...

btw, if you have a cool name for it, shoot! cause ColorrTetris doesn't sound that explosive or atractive or...so if you know one, tell me

(http://img.removedfromgame.com/imgs/TetrisColor.gif)

and maybe only  one thing: what is the shortest code to execute for the calc (to gain speed):

Code: [Select]
gc:setColorRGB(R,G,B)
gc:fillRect(x,y,10,10)
gc:setColorRGB(R,G,B)
gc:fillRect(x,y,10,10)
gc:setColorRGB(R,G,B)
gc:fillRect(x,y,10,10)
or
Code: [Select]
gc:drawImage(image,x,y)
with image a picture of a block of 10x10 (same as fillrect)

Every 5 lines?  I went up to level 20 and saw how fast it was.  Are you sure 5 lines? :O  Or maybe it should be like steps, where level 1 is # of lines, then level 2 is # of lines + 1, level 3 # +2  or something.  Or else for some it might get too hard too fast...

are you being sarcastic or is it true that it goes quite fast?

--edit--
but it's like 3 time setcolorrgb and fillrect, is it still faster than one drawimage?
Title: Re: Color tetris
Post by: Jim Bauwens on November 09, 2011, 04:22:16 pm
fillRect is much faster than drawimage, so I suggest you to use that :)
Title: Re: Color tetris
Post by: AzNg0d1030 on November 09, 2011, 04:42:06 pm
Beta-version of the game coming up tomorrow!  (Yes, I know this stuff :P)
Oh, I lost the game due to that ^ (irrevelancy)
Title: Re: Color tetris
Post by: AzNg0d1030 on November 09, 2011, 04:44:59 pm

Every 5 lines?  I went up to level 20 and saw how fast it was.  Are you sure 5 lines? :O  Or maybe it should be like steps, where level 1 is # of lines, then level 2 is # of lines + 1, level 3 # +2  or something.  Or else for some it might get too hard too fast...

are you being sarcastic or is it true that it goes quite fast?
Yeah it does.  5 lines every level will be insane.  Level 5 already is sort of hard to get through.
Level 20 was absolutely insanity.  At least like every 10 lines.

Sorry for the double post guys...
Title: Re: Color tetris
Post by: Nick on November 09, 2011, 04:48:27 pm
dude, why you guys know the game too xp

Ok then, it's nice to hear that speed isn't a problem here :) and i might change that levelup condition if it's not only you who thinks it goes to fast :)
but if i change it, it will take loooong to finally reach level 20, but if you agree, i do too
Title: Re: Color tetris
Post by: AzNg0d1030 on November 09, 2011, 04:54:03 pm
dude, why you guys know the game too xp

Ok then, it's nice to hear that speed isn't a problem here :) and i might change that levelup condition if it's not only you who thinks it goes to fast :)
but if i change it, it will take loooong to finally reach level 20, but if you agree, i do too
Since when were players required to get to level 20?  If you look at other tetrises, some take a long long time.  It isn't about how high level, but how long you live :)

PS, everyone knows the game.  Of which I just lost.
Title: Re: Color tetris
Post by: Nick on November 09, 2011, 07:10:16 pm
So, here is the moment everyone waited on (i hope so xp): The beta edition of ColorTetris has been completed!
some bugs are still in the game, eg. it's sometimes hard to place a block between two other blocks when coming from the side (as you can see in the screenshot with the yellow and the pink block), but they're not that significant (the one i told here is the most important).
I'll put the .tns file online tomorrow, but now, you already have the screenshot :)

(http://img.removedfromgame.com/imgs/TetrisColorScreen.gif)

oh and on the screenshot, the block sometimes doesnt fall that fluently, that's because i cut some parts to save space, i don't know why but i did. In the real game they fall 1 block down every time

now i'm trying to insert a hold function, and maybe the direct down button, but i'm afraid that won't succeed
Title: Re: Color tetris
Post by: AzNg0d1030 on November 09, 2011, 09:09:37 pm
So, here is the moment everyone waited on (i hope so xp): The beta edition of ColorTetris has been completed!
some bugs are still in the game, eg. it's sometimes hard to place a block between two other blocks when coming from the side (as you can see in the screenshot with the yellow and the pink block), but they're not that significant (the one i told here is the most important).
I'll put the .tns file online tomorrow, but now, you already have the screenshot :)

oh and on the screenshot, the block sometimes doesnt fall that fluently, that's because i cut some parts to save space, i don't know why but i did. In the real game they fall 1 block down every time

now i'm trying to insert a hold function, and maybe the direct down button, but i'm afraid that won't succeed
the direct down button is what I was talking about :P. What do you mean by hold function?
Title: Re: Color tetris
Post by: Nick on November 10, 2011, 01:44:53 am
the direct down button is what I was talking about :P. What do you mean by hold function?
well, that's that instant down you told me :)
The hold function is when a block appears tht you can't use for the moment, you can 'save' it in the hold function and call it back later. It's used in the original one, and i think it's possible

--edit--
i think i found how to implement the dropdown button, woehoew xp i'll try it asap

--edit--
instant dorpdown button is implemented and works perfect

--edit--
hold function is implemented and works perfect
Title: Re: Color tetris
Post by: Stefan Bauwens on November 10, 2011, 06:47:01 am
Nice. Well I hope many people like it.(I don't have a nspire). :)
Title: Re: Color tetris
Post by: Jim Bauwens on November 10, 2011, 07:11:23 am
Good job Nick :)
Title: Re: Color tetris
Post by: Nick on November 10, 2011, 02:18:06 pm
Here it is: the first version of ColorTetris in lua.

THIS IS STILL A BETA VERSION, so do not expect it to be perfect, you will find some (small) bugs in it, but they surely won't crash your calc in any way...

Please report any bug to [email protected] or on this forum. Most likely to the email adres, so this forum will not be filled with stuff that's not that necessary.

I want to thank everyone who contibute(s/d) to this project, and of course omnimaga.org. Special thanks to AzNg0d1030, adriweb, jimbauwens, DJ_O and ralphdspam for their help.

Possibilities
-marathon (kind of ndless playing, score as many lines as possible without dying)
-hold function (tab key)
-instant dropdown button (enter key)
-multi line detection
-and of course COLOR  xp i've tested it with a real CX CAS, CX CAS emulator and CAS touchpad emulator. When the calc is a CAS (not cx), greyscale pictures a B/W background is used for a better overview.

Known bugs:
-hard to insert blocks from beside (it works sometimes)
-at the end (when reached the above line), a 2nd block is placed over the already standing block
-I think this is it, but that's why i need you; to find them (if there are any)

Future plans:
-improve coding (it's really a mess, but i can still follow it :) )
-increase speed a little bit, cause it has to be really hard on level 20
-implement more gametypes (timerace, clear 40 lines, .. any ideas.? )
-improve graphics
-insert a guideblock that shows where the block is gonna fall (but it will be possible to switch it off of it works)

a screenshot can be found at this page, a little more above

--edit--
The hold block is the rectanglecombination beneath the next-block-box, for those who didn't get it..

--edit--
redesign: comment if you want to
for the newest version of ColorTetris, go to page 4 and download it there, to avoid bugposts that are already fixed

(http://img.removedfromgame.com/imgs/tetris_redesign.jpg)
Title: Re: Color tetris
Post by: BalancedFury on November 10, 2011, 05:08:04 pm
Color Tetris on a calculator...
The best invention since sliced bread :D
Title: Re: Color tetris
Post by: AzNg0d1030 on November 10, 2011, 06:10:59 pm
I feel so proud for slightly helping such an amazing tetris!!!!!!!!

GOOD JOB NICK :'(
Title: Re: Color tetris
Post by: BalancedFury on November 10, 2011, 06:52:44 pm
Lol i got +1 for modifying a famous quote :D
Title: Re: Color tetris
Post by: AzNg0d1030 on November 10, 2011, 07:36:33 pm
Lol i got +1 for modifying a famous quote :D
LOL

Nick: I found 3 problems.  
1-The red "S" block (remember, the one with the blue outlining) is missing :O
2-The speed may be messed up.  I was playing and I noticed my speed was at 7, and i decided to test the + and - button to see if they worked still.  When I went down, I went back up to 7 as to not cheat and I noticed I suddenly sped up compared to the speed I was at before.  This means even though it says the level is going up, it may not actually be getting faster until one fiddles with the + and -
3-When you hold a piece for a long enough time (i think theres like a certain time held or something for this bug) and try to get it back by pressing TAB, the held piece disappears and your current piece is still coming (or something like that, either way the held piece disappears)

Hope you can fix these! (Your tester still going strong and finding stuff for ya ;)  )
Title: Re: Color tetris
Post by: Nick on November 10, 2011, 08:11:30 pm
thanks :)

1. math.random(1,7) changed into math.random(1,6), strange, but it did.. and nr 7 is the red block, so it couldn't be chosen anymore
          -Fixed
2. never saw that one, found it too, i used timer.start(2/level) instead of timer.start(1/level), and on the initialisation of the game it was timer.start(1/level), understood? xp
shouldn't i remove the '-' function? cause in most games you can't change to easy while playing, but changing to hard must be possible i think, or not?
          -Fixed
3. serious? never encountered that problem, but i never played really long.. but as i watch the code, there couldn't be any interference with the timer, as it is a total different function xs here's the code (for those who understand it):
Code: [Select]
function on.tabKey()
if holdfull==false then
hold = fallingblock
hold[5]=5
hold[6]=1
holdfull=true
on.newBlock()
else
nextblock = fallingblock
fallingblock = hold
holdfull = false
end
end

function on.newBlock()
for i=1,10 do
if blocks[1][i]==1 then
done = true
end
end
if done == false and pause == false then
lastchoice = chooseblock
repeat
chooseblock = math.random(1,7)
until chooseblock ~= lastchoice

fallingblock = nextblock
if chooseblock == 1 then
nextblock = Tblock
elseif chooseblock == 2 then
nextblock = Lblock
elseif chooseblock == 3 then
nextblock = LLblock
elseif chooseblock == 4 then
nextblock = Iblock
elseif chooseblock == 5 then
nextblock = cublock
elseif chooseblock == 6 then
nextblock = Lstairblock
elseif chooseblock == 7 then
nextblock = Rstairblock
end
fallingblock[5] = 6-math.floor(fallingblock[8]/2)
fallingblock[6] = 1
platform.window:invalidate()
end
end

i'll try to find out, hope you don't have to give me too much work :)

btw, there goes my idea of a perfect working function like the hold function... the unexpected can always happen it seems


--edit--
sorry, id didn't update the program, how can id do this instead of reposting it?

--edit--
I updated the zip file, so no the right one is there
and no sorry, i'm happy you're wanting to help

--edit--
Highscore works, with var.recall(), not with on.save(), cause it seems to not be working with me :)
bon, anyway, it works...
Title: Re: Color tetris
Post by: AzNg0d1030 on November 10, 2011, 08:33:15 pm
UPDATE: though you prob fixed this, the missing s block (which is actually blue not red) appears only in te first two or three pieces and even then, still rarely. Hopefully this is fixed.

The held piece disappearing seems to disappear about after the player puts down 4 or more pieces when the player presses tab.

Speed bug: after one pushes pause while on level one and resumes, nothing seems to have changed, though if you go up one level then come back down, suddenly level 1 is ultra slow. If you pause on 2 or above, then resume, it speeds up the level (somehow) until you change level then change back. If you scroll between levels then go back to 1 (I scrolled to level 9 then back several times testing this) level 1 will also be ultra slow.

Maybe the speed not changing bug I mentioned on the previous post was why you thought it sped too slowly :P

Suggestion: Highscores?
Sorry for overloading you!

EDIT: Just wondering, what bugs did you fix :O ?  I see that the blue S piece is back!  I think the speed not changing is still screwed over... :( (but it seems that after the pause everything would speed up since it was speeding up to the supposed level speed, so basically, the pause was correcting the speed!  It still does that.  So every time I level up, I pause or change level then change back so it's fair) The scrolling up to nine and back making level 1 ultraslow is fixed!  Held piece disappearing bug is fixed.
Title: Re: Color tetris
Post by: Nick on November 11, 2011, 09:06:07 am
i've found a picture on the internet from the android tetris app, and it looks really nice. Should i try to make the graphics more like this one, or is that too riscy for tetris himself to do it? otherwise, i think i would love to, but i don't want to do something completely illegal :) does someone has any idea if it is allowed or not?

(http://img.removedfromgame.com/imgs/tetris-android-app.jpg)

for now i'm cleaning up the code, cause that was necessary, so if you'd like i'll post it tonight or tomorrow or something, so you can have a look at it and maybe even try to help the debugging :)

I'm also trying to insert a ghostblock (like i like to call it) the one that shows you where it is gonna fall, but it's kinda hard xs so you'll have to wait a while
btw, you can see one at the picture in the right bottom corner

--edit--
got the code from 15.2 Kb to 13.1 Kb :)
started on the re-designing
Title: Re: Color tetris
Post by: TIfanx1999 on November 11, 2011, 09:21:44 am
For a clone on a calculator I doubt it will be an issue. It certainly does look pretty. :)
Title: Re: Color tetris
Post by: Stefan Bauwens on November 11, 2011, 12:35:30 pm
i've found a picture on the internet from the android tetris app, and it looks really nice. Should i try to make the graphics more like this one, or is that too riscy for tetris himself to do it? otherwise, i think i would love to, but i don't want to do something completely illegal :) does someone has any idea if it is allowed or not?

(http://img.removedfromgame.com/imgs/tetris-android-app.jpg)

for now i'm cleaning up the code, cause that was necessary, so if you'd like i'll post it tonight or tomorrow or something, so you can have a look at it and maybe even try to help the debugging :)

I'm also trying to insert a ghostblock (like i like to call it) the one that shows you where it is gonna fall, but it's kinda hard xs so you'll have to wait a while
btw, you can see one at the picture in the right bottom corner

--edit--
got the code from 15.2 Kb to 13.1 Kb :)
started on the re-designing
Porting tetris in itself might be illegal :P
Besides, I don't think they patented that picture so... go ahead! :P
Title: Re: Color tetris
Post by: AzNg0d1030 on November 11, 2011, 06:08:11 pm
i've found a picture on the internet from the android tetris app, and it looks really nice. Should i try to make the graphics more like this one, or is that too riscy for tetris himself to do it? otherwise, i think i would love to, but i don't want to do something completely illegal :) does someone has any idea if it is allowed or not?

for now i'm cleaning up the code, cause that was necessary, so if you'd like i'll post it tonight or tomorrow or something, so you can have a look at it and maybe even try to help the debugging :)

I'm also trying to insert a ghostblock (like i like to call it) the one that shows you where it is gonna fall, but it's kinda hard xs so you'll have to wait a while
btw, you can see one at the picture in the right bottom corner

--edit--
got the code from 15.2 Kb to 13.1 Kb :)
started on the re-designing
Go ahead!  You don't have to make the ghost colored, it could just be a white outline or something like that :)
If you want me to test again I'm here :D
Title: Re: Color tetris
Post by: Nick on November 11, 2011, 08:21:37 pm
Go ahead!  You don't have to make the ghost colored, it could just be a white outline or something like that :)
If you want me to test again I'm here :D
you like testing, don't you? :)

in fact, that ghost is the frame of the block that is falling, i mean that only the shape is displayed as drawRect, and in the color of the block, i only have to change the code of the instant dropdown button to find the place to display it. until now, it shows one, but on the lowest row...

--edit--
Here's the new up to date tns file, 'totally' new graphics, and some bugfixes.
There's only one remark, play it on the calc, cause if you're playing it on the emlator, the placing of te numbers isn't correct..idk how, but it is true

btw, does anyone know how to anti-alias the sides of a gc:fillPolygon() drawing?
Title: Re: Color tetris
Post by: DJ Omnimaga on November 11, 2011, 08:42:25 pm
Looks nice. I gotta try the tns soon. I hope to see more news soon :)
Title: Re: Color tetris
Post by: AzNg0d1030 on November 11, 2011, 10:56:58 pm
Hoho nice job!  I don't know how to anti-alias :(

Is it possible to make the shadow on top of blocks? Right now it's at the bottom so when there are blocks in the way you can't really see it, but I think you know this... :P
Title: Re: Color tetris
Post by: Nick on November 12, 2011, 11:45:47 am
damned, by implementing some new stuff, i must have changed something so it goes totally wrong, nooooooo xs
i hope i find it, but i have a back-up from about 1 hour ago, so i won't lose that much, but it's so frustrating

--edit--
Problem solved, accidentally removed a boolean value change...
Ghostblock works, only some small problems with the L-blocks, but it's not that bad
redesign complete
highscore exists now of three numbers instead of 1 highscore
Title: Re: Color tetris
Post by: Adriweb on November 12, 2011, 12:36:50 pm
This really looks awesome, congratz :)
Title: Re: Color tetris
Post by: aeTIos on November 12, 2011, 01:07:59 pm
Awesome? I'd call this epic! Great job!
Title: Re: Color tetris
Post by: Nick on November 12, 2011, 05:38:29 pm
thanks! that's really nice :) i'll hope i can finish it soon, so i can put it online..

but i have some delay because of a problem i'm encountering in the displaying of the ghostblock.
it all works fine, but with the L blocks it just wont work... here's the code for it

Code: [Select]

--variables:
fallingblock[8]=width of the falling block
fallingblock[6]=y-value of the block
fallingblock[7]==1 or 2 checks of it is an L or reversed L block
ghostblock[6]=y-value of the ghostblock
ghostblock[5]=x-value og the ghostblock
fallingblock[9]=height of the falling block
l and m are just for loop variables

function on.ghostBlock()
highest = 21
for l=1,20 do
for m=1,fallingblock[8] do
if (fallingblock[6]+l)<21 then
if blocks[fallingblock[6]+l][fallingblock[5]+m-1]~=0 then
if (fallingblock[6]+l)<highest then
highest = fallingblock[6]+l
if fallingblock[fallingblock[9]][m]==0 then
highest = highest+1
end
if fallingblock[7]==2 or fallingblock[7]==3 then
if
end
end
end
end
end
end
end
ghostblock[6] = highest-fallingblock[9]
ghostblock[5] = fallingblock[5]
end

it shows the left one, but it has to show the right one
Title: Re: Color tetris
Post by: AzNg0d1030 on November 13, 2011, 01:31:07 am
I didn't dl the newest one yet but did you get around to fixing the speed-not-changing problem?
Title: Re: Color tetris
Post by: Nick on November 13, 2011, 02:56:58 am
oh, the speed was NOT changing? eeeuuuuh, didn't realize, i'll check it

--edit--
i found it, it just didn't refresh the timer.start()...how could i have missed that, it was impossible to speed up without '+'
"40 lines " and "Time trial" added, now i only have 2 smaller bugs: the one with the ghostblock and that it still shows a picture of the fallen block, while it shouldn't be ther when the line gets erased..
Title: Re: Color tetris
Post by: AzNg0d1030 on November 13, 2011, 09:05:49 pm
Update file ? :O

edit: Nick, get on the irc chat -.-
Title: Re: Color tetris
Post by: Nick on November 14, 2011, 01:27:55 pm
Hello, here i am again, but now with the video of the official first ColorTetris!

Finally, it's finished!!  :w00t:



Features:
-3 modes: marathon (survive as long as you can), 40 lines (erase 40 lines as fast as you can) and time trial (race against the clock)

-Every mode has 3 highscores, names included! (at the beginning they're all called "0 - name" (as you can see in the movie), so 9 highscores in total :)

-Ghostblock, only with those L and reversed L blocks there's a small bug that it displays it one block too high.

-Controls with arrows, 4, 8, 6, 2, p(ause), r(estart), enter and tab.

-Instant dropdown (enter)

-FULL COLOR, but it also works for B/W calcs (not cx), with a white background for visibility

except for those 2 small bugs (first one at 0:25 when reaching the upper line, second one at 1:17 with the ghostblock), but i really do not have any clue how to fix them.. they do not disturb anything of the gameplay at all.

as soon as it's uploaded to omnimaga and ticalc i'll post the links here (ColorTetris.tns, screenshots, readme AND source code for those who want to learn to make tetris)
Title: Re: Color tetris
Post by: Hayleia on November 14, 2011, 02:10:05 pm
:D Me wants !!! Even with the bugs !!!
Post more so I can give you more +1s :P jk
Title: Re: Color tetris
Post by: Stefan Bauwens on November 14, 2011, 02:12:46 pm
This is totally epic. WOW!
Also, you speak dutch, hmm, and you're Belgian apparently. Do you live In Sint-Niklaas? :D :P
Title: Re: Color tetris
Post by: Jim Bauwens on November 14, 2011, 02:30:34 pm
Very very good job, it looks wonderful :)
Title: Re: Color tetris
Post by: Nick on November 14, 2011, 03:04:39 pm
I uploaded it to omnimaga and ticalc, so now wait untill it gets approved :) hmmm, i wonder how long this will take xp

@Hayleia thanks, go ahead :)

@Stefan Bauwens, no i don't, i live in bruges, but as i see on which distance most of the users here live, St-Niklaas is just around the corner :)

@jimbauwens, thanks, i don't know what to say anymore xp

--edit--
It's already approved, in like 10 minutes, woehoew!!!
here it is:
http://www.omnimaga.org/index.php?action=downloads;sa=view;down=742
Title: Re: Color tetris
Post by: AzNg0d1030 on November 15, 2011, 11:14:15 pm
OMG the suffering I went through before I finally got this! IT'S AWESOME. Though I noticed that the 40 lines mode has no high score input... Is there supposed to be one that I'm missing? There was one for time trial.

Noticed you fixed the speed problem, though on 40 lines the last 10 lines was like god speed and I was very close to failing when I only had 3 lines to go!

GJ
Title: Re: Color tetris
Post by: Nick on November 18, 2011, 02:34:51 pm
For all the fans of ColorTetris (if there are any xp), i'm already working on a newer and better version! i fixed the highscore failure with the 40 lines mode..that was so stupid, and it's so weird i didn't notice that (also, i had some other testers that are not on this forum, and they didn't noticed it too xs nice testers...).

Things to improve in the new edition:
-Highscore save working perfectly (untill now you had to have a highscore higher than the first one, otherwise it wasn't recorded as a second or third highscore)
-better graphics (more like the real tetris blocks)
-a little slower, cause it's really too hard to reach that 40 lines for example (thx AzNg0d1030)
-Not restarting game when entering within the pause menu, but resuming game
-ghostblock correction (L and reversed L blocks, maybe not giving it a color, cause i've heard that it's confusing when playing on a high speed)
-no overlapping of blocks on any moment
-blocks starting out of the screen (above)
-automatic screen of game over when finished (now you had to press anything but enter to get the menu, i really don't know why, cause i've put a invalidate() but i seems to be not working)
-have something else than the number indicating the level (backgroundcolor for example)
-limit # of chars in highscore names
-correcting hold function (if anyone finds that bug, tell me, cuase i've only heard that from AzNg0d1030, and i've not seen it myself)
-...

Bugs can still be reported here or to my emailadres (if they are not in this list ofcourse)

Thanks to everyone who helped developping it, and everyone who already downloaded it (that seems to be stimulating to go on xp)
Title: Re: Color tetris
Post by: AzNg0d1030 on November 18, 2011, 06:15:16 pm
For all the fans of ColorTetris (if there are any xp), i'm already working on a newer and better version! i fixed the highscore failure with the 40 lines mode..that was so stupid, and it's so weird i didn't notice that (also, i had some other testers that are not on this forum, and they didn't noticed it too xs nice testers...).

Hehe... I'm good >:D

Yeah I found out that when I said that the piece would teleport after being held too long, I found that it would teleport usually to a piece of the same color that was already placed down, either taking its place (like on it, so basically no difference other than the fact the held piece is gone) or connecting to it and extending it, overlapping others.

This also happens when say a blue S piece is coming down and I press tab to get out my held blue S piece.  I thought it disappeared when it possibly took the place of the blue piece that was already coming down.  Where this theory came from: Usually when you get out a held piece it starts from the top of the screen.  Like the situation above, the piece just keeps coming
O_O
Title: Re: Color tetris
Post by: DJ Omnimaga on November 19, 2011, 02:11:42 pm
The new version seems promising. I didn't read the whole thread but does it fix the bug where the piece that is falling doesn't have its guide shown completely at the bottom of the screen? I don't know how to replicate this, but sometimes the guide you see at the screen bottom that shows where your piece will land is one block too high.
Title: Re: Color tetris
Post by: AzNg0d1030 on November 19, 2011, 08:56:20 pm
The new version seems promising. I didn't read the whole thread but does it fix the bug where the piece that is falling doesn't have its guide shown completely at the bottom of the screen? I don't know how to replicate this, but sometimes the guide you see at the screen bottom that shows where your piece will land is one block too high.
He said he fixed it
Title: Re: Color tetris
Post by: DJ Omnimaga on November 20, 2011, 02:37:40 am
Ok good. I wasn't sure if he noticed that bug but I didn't feel like reading through the 6 pages of text. X.x
Title: Re: Color tetris
Post by: AzNg0d1030 on November 20, 2011, 11:52:20 am
Ok good. I wasn't sure if he noticed that bug but I didn't feel like reading through the 6 pages of text. X.x
Haha, there was a big post that he did of it! :P
(And don't worry, there are a lot more bugs I've found that I've already said to him)
Title: Re: Color tetris
Post by: BalancedFury on November 20, 2011, 03:49:28 pm
Did you fix the bug I posted yet? :D
Title: Re: Color tetris
Post by: Nick on November 23, 2011, 02:31:38 pm
i'm sorry, but i'm very busy with schoolwork now..   we have to make a lot of reports of things we did in class, so i really need to find the time for it xs i'm very sorry, but trust me, as soon as i have more time i'll return with a full new version of ColorTetris, i promise 

just have some patience...

btw, i'll have it totally remastered, i mean that i'll start from scratch, and i'll give it the cliché, but still orignial name "ColorTetris !!" (with the !! for both meanings, understood)
Title: Re: Color tetris
Post by: aeTIos on November 23, 2011, 03:26:47 pm
Eh, do you happen to have scores? I can't see them in the video.
Title: Re: Color tetris
Post by: Nick on November 30, 2011, 02:50:53 am
well, i might let it rest for a while, as everytime i watch the code, i'm getting squint  but updates will come within a certain amount of time, but not this week, and also not the one after that xs
Title: Re: Color tetris
Post by: Jim Bauwens on November 30, 2011, 04:00:50 am
Well, have fun when you start again :)
Title: Re: Color tetris
Post by: Nick on December 03, 2011, 02:17:04 pm
I'm back with the first view on ColorTetris!! .
It does not yet feature highscores and sother stuff, but it works! many bugs have already been eliminated (as i started from scratch), and here's a short screenie to give you an idea.

Please tell me which sprite i should use for the tiles. I really don't know, but if you have something better, show me, i want it to be good this time :) they have to be 10*10px
Title: Re: Color tetris
Post by: AzNg0d1030 on December 03, 2011, 03:28:33 pm
I would say sprite 2 looks best
Title: Re: Color tetris
Post by: DJ Omnimaga on December 27, 2011, 01:05:35 am
Same for me, assuming you didn't choose yet or are still working on this.