[sample] 2048 game clone

70 views
Skip to first unread message

Pedro Infantilo

unread,
Oct 30, 2015, 12:22:36 PM10/30/15
to AndroidScript
Hi Community,
just had a little spare time, so i did a very(!) quick and dirty 2048 clone with DS.
Not shure if the gamelogick is exact the same as the original, but i makes fun to play.
 
Here you are...V1
 
 
your's
peter
2048clone.spk

Netpower8

unread,
Oct 30, 2015, 12:49:35 PM10/30/15
to AndroidScript
hi. i tried the game. its playable that' s great. there is some logic problems. like if there's three 4 in a row and i push up. the 1st one on top don't get merged. the last 2 got merged. its suppose to be top 1st. also as i progress further... i  keep getting " 4:" there is no more " 2 " i have one " 2" it got stuck because it can merge with any 2 because there is none.  then i got the 512 number... the 512 got off the square. its not centered anymore.

overall its a nice clone.

Netpower8

unread,
Oct 30, 2015, 12:50:33 PM10/30/15
to AndroidScript
btw have not checked the code yet. just played it ... that's all

Pedro Infantilo

unread,
Oct 31, 2015, 4:48:52 AM10/31/15
to AndroidScript
Hy Netpoer8...
thanks for your great report... i'll fix this today and post a new version at night...

Pedro Infantilo

unread,
Oct 31, 2015, 9:22:26 AM10/31/15
to AndroidScript
so, this is V1.1.
Not shure if gamelogic is now 100% original, but.

news:
.) random stones (2 / 4 ) working
.) each value has its own stone color
.) changed combine stones order
2048clone.spk

Netpower8

unread,
Oct 31, 2015, 9:47:29 AM10/31/15
to AndroidScript
will play with this tomorrow morning... its late evening now here...

Netpower8

unread,
Nov 1, 2015, 6:59:59 PM11/1/15
to AndroidScript
hi i tested the v1.1 ... but i cant play the game... it gave me a math.Log error. maybe there's a function that was not included

Pedro Infantilo

unread,
Nov 2, 2015, 3:12:20 AM11/2/15
to AndroidScript
Sorry...worked for me, but v1.2 has now an fix in case you're missing the log2 or log10 function.

2048clone V1.2.spk

Netpower8

unread,
Nov 2, 2015, 7:49:42 PM11/2/15
to AndroidScript
tried the game.... logic appears to be okay. compared the v1.0 the tiles being different color is ok. i reached 512 the number is now centered. there are times when the score appears but there is still some possible moves left but its ok you can sort it out since most likely you check if all the tiles are filled. will play it a few more times until i reach 2048. since i've played this game before so i know i can reach it.

summary notes.
1. i notice on this version v1.2 the sliding of tiles appears to be slower compared to v1.0
2. logic for "2" not appearing after reaching 64+ ---- fixed
3. the color of tiles is ok but the gray tiles with red numbers is kinda hard to see.
   i like the original better since the numbers are clearly shown. but this is easily fixable.
   maybe the color tiles could be the one that's slowing down the sliding of the tiles.
Message has been deleted

Pedro Infantilo

unread,
Nov 3, 2015, 10:38:01 AM11/3/15
to AndroidScript
so, here's another release:

thanks for testing the app... that helps a lot.

fixes:
.) stones now have an glass-effect (just an optical improvement)
.) fixed sliding speed a bit
.) maybe(?) fixed the "lost score popping up" when only a single cell is free (needs to be tested)
.) stone-values now got shadow for better readability on dark stones
.) added an option to toggle sliding animation on/off

now i think it is playable and it's time to sum up:
It is my very first DS project and it took me as (amateur) about 3hours to do the main code and about 1.5hour to refine things.
This was what i'm looking for: DS is a really quick way to create android apps.... and, thats a nice benefit...IT'S REALLY FUN TO CODE WITH. 

2048clone V1.3.spk

Netpower8

unread,
Nov 3, 2015, 11:13:16 AM11/3/15
to AndroidScript
got the spk will test this tomorrow... 3 hours of coding that's really fast. cant believe you got this in less than a day. I'm playing it so far and trying to win it... i got to a point that's 1024. the number disappear because the tile is red and the number is red also.

really fast coding for an idea and refining it will take only a short time if ever.... great coding Pedro.

Netpower8

unread,
Nov 3, 2015, 8:00:26 PM11/3/15
to AndroidScript
the graphical changes is incredible... so far i only reached 1024 all numbers appear to be readable and clear. which is good. the option to remove animation is good also so there will be faster game play.

in regards during game over (no more moves) the board is removed. and a score is displayed. i like the game board to still be there so i can check if its really game over. =)

your point systems seems a bit big. but am not sure if the other games does the same point system.... like when you merge 2 + 2 you get 4 points. right ? in theory well in my opinion you should only get 2 points. because you merge the  " 2 " if you want to get 4 points you should merge " 4 "s (meaning 4 + 4)

Netpower8

unread,
Nov 3, 2015, 10:54:08 PM11/3/15
to AndroidScript
forget about what i said on the point system... i have check the other games they do the same point system like your game.. but i notice something though. they merge one step not multiple step like yours. here's an example

the row of numbers is 2 2 2 2 if you slide to merge your app will show 8 on the other app it will show 4 4
another sample is 2 2 4 2 slide and its suppose to be 4 4 2 ( the 4 did not get merge because the 2 + 2 gets priority ) and since 4 ( 2+2) is a new block number it wont merge with 4 until you slide the 2nd time

Pedro Infantilo

unread,
Nov 4, 2015, 3:08:57 AM11/4/15
to AndroidScript
once more thanks for your testing and report!! that's great!

The graphical improvement only took 5(!) additional lines of code and removing 1 line, and also brought and speed improvement. I was really suprised my self how the look of an game can improve with such little affort. That's the big benefit coding in javascript ( at least in my opinion).
i'll have a look on the merge-part in the next few days ;-) (but this "bug" gave me a much quicker gameplay feeling ;-))

 

Netpower8

unread,
Nov 4, 2015, 8:57:47 PM11/4/15
to AndroidScript
true it gives  a much faster game play feeling but that would mean it will miss one step (and miss one option to add a  " 2 " or " 4 ")

Netpower8

unread,
Nov 4, 2015, 8:58:13 PM11/4/15
to AndroidScript
maybe make it a menu option ? har har
Reply all
Reply to author
Forward
0 new messages