Author Topic: [Axe game] 2048  (Read 21028 times)

0 Members and 1 Guest are viewing this topic.

Offline Toctave

  • LV2 Member (Next: 40)
  • **
  • Posts: 22
  • Rating: +2/-0
    • View Profile
Re: [Axe game] 2048
« Reply #30 on: April 14, 2014, 11:14:17 am »
You mean something like this?
LOOP
-If any cell is zero, stop loop, game not over
-If block0=block1 or block1=block5 or block1=block2  or... stop loop
-If loop goes to the block15 without finding any of the above, game over
ENDLOOP

Offline TheCoder1998

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 434
  • Rating: +20/-2
  • my art is written in code, not in graphite
    • View Profile
    • My website :D
Re: [Axe game] 2048
« Reply #31 on: April 14, 2014, 11:15:24 am »
yeah basically :)
but the blocks on the side only need to check those sides which actually contain spaces for blocks
my ticalc acc:

http://www.ticalc.org/archives/files/authors/113/11365.html

Spoiler For The Best Song Ever:


follow me on tumblr :)
www.rickdepizza.tumblr.com

check out my anilist :D
http://anilist.co/animelist/29701/Rickdepizza

Offline Toctave

  • LV2 Member (Next: 40)
  • **
  • Posts: 22
  • Rating: +2/-0
    • View Profile
Re: [Axe game] 2048
« Reply #32 on: April 14, 2014, 11:17:09 am »
Well if every block checks his bottom and left every bound will be checked

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: [Axe game] 2048
« Reply #33 on: April 14, 2014, 11:18:25 am »
Yup pretty much.
While you need at most two checks per tile, you need to check 15 of them. Not the last one.

Offline Toctave

  • LV2 Member (Next: 40)
  • **
  • Posts: 22
  • Rating: +2/-0
    • View Profile
Re: [Axe game] 2048
« Reply #34 on: April 14, 2014, 11:20:43 am »
Except ones from the bottom row and right column shouldn't check their right/bottom. Gotta write program that down.


Offline Toctave

  • LV2 Member (Next: 40)
  • **
  • Posts: 22
  • Rating: +2/-0
    • View Profile
Re: [Axe game] 2048
« Reply #35 on: April 14, 2014, 03:07:46 pm »
HI AGAIN GUYS!
(sorry my happiness is exploding)
So the game's all done, thanks to pikachu and the walrus for the help. Here's a gif of how it works :

and here's the code :




Code: [Select]
.A2048
[FF818181818181FF]->Pic0
[FF818199998181FF]
[FF8189B99D9181FF]
[FF81FF8181FF81FF]
[FF81BDA5A5BD81FF]
[FFA5FFA5A5FFA5FF]
[FF9999FFFF9999FF]
[FFC3A59999A5C3FF]
[FFC3BDBDBDBDC3FF]
[FFFFC3DBDBC3FFFF]
[FFFFFFE7E7FFFFFF]
[FFABD5ABD5ABD5FF]
[FFFFFFFFFFFFFFFF]
DeltaList(40,16)->Pic1
[FFFFF0FF00818190818081819F8180F999999980F999999980819981818081998181809F99F999809F99F9998081818981808181898180FFFF8FFF807FFF87FF80000000000000000000000000000000]


DiagnosticOff
ExprOn
Full
Fix 5
Fill(L1,16,0)
0->I->J->K
1->{L1+16}


UnArchive "|vA"
!If GetCalc("|vA"
GetCalc("|vA",20)->Q
R()
Else
GetCalc("|vA")->Q
End
LOAD()
GUI()


Repeat getKey(15)
If getKey
If getKey(1)
DOWN()
End
If getKey(2)
LEFT()
End
If getKey(3)
RIGHT()
End
If getKey(4)
UP()
End
If getKey(55)
R()
End
If getKey(54)
H()
End
GO()
If S>{Q+18}^^r
S->{Q+18}^^r
End
If S!=W
TEXT()
S->W
End
End
D()
End
SAVE()
ClrDraw^^r^^r
Return




Lbl DOWN
0->theta
For(J,0,3)
3->N
For(K,1,3)
3-K->I+1->X
If {4*I+J+L1}->V!=0
Repeat {4*X+J+L1}->T=V or (T!=V and (T!=0)) or (X=N)
X++
End
{4*X+J+L1}->T
If T!=V and (T!=0)
X--
End
If X!=I
If {4*X+J+L1}=0
V->{4*X+J+L1}
Else
V+1->{4*X+J+L1}
X-1->N
e^(V+1)+S->S
End
0->{4*I+J+L1}
theta++
End
End
End
End
If theta
N()
End
Return


Lbl LEFT
0->theta
For(J,0,3)
0->N
For(I,1,3)
If {4*J+I+L1}->V!=0
I-1->X
Repeat {4*J+X+L1}->T=V or (T!=V and (T!=0)) or (X=N)
X--
End
{4*J+X+L1}->T
If T!=V and (T!=0)
X++
End
If X!=I
If {4*J+X+L1}=0
V->{4*J+X+L1}
Else
V+1->{4*J+X+L1}
X+1->N
e^(V+1)+S->S
End
0->{4*J+I+L1}
theta++
End
End
End
End
If theta
N()
End
Return


Lbl RIGHT
0->theta
For(J,0,3)
3->N
For(K,1,3)
3-K->I+1->X
If {4*J+I+L1}->V!=0
Repeat {4*J+X+L1}->T=V or (T!=V and (T!=0)) or (X=N)
X++
End
If (T!=V and (T!=0))
X--
End
If X!=I
If {4*J+X+L1}=0
V->{4*J+X+L1}
Else
X-1->N
V+1->{4*J+X+L1}
e^(V+1)+S->S
End
0->{4*J+I+L1}
theta++
End
End
End
End
If theta
N()
End
Return


Lbl UP
0->theta
For(J,0,3)
0->N
For(I,1,3)
I-1->X
If {4*I+J+L1}->V!=0
Repeat {4*X+J+L1}->T=V or (T!=V and (T!=0)) or (X=N)
X--
End
{4*X+J+L1}->T
If T!=V and (T!=0)
X++
End
If X!=I
If {4*X+J+L1}=0
V->{4*X+J+L1}
Else
X+1->N
V+1->{4*X+J+L1}
e^(V+1)+S->S
End
0->{4*I+J+L1}
theta++
End
End
End
End
If theta
N()
End
Return


Lbl SAVE
conj(L1,Q,16)
S->{Q+16}^^r
Return


Lbl LOAD
conj(Q,L1,16)
{Q+16}^^r->S
Return


Lbl N
16->L
Repeat {L1+L}=0
rand^16->L
End
rand^6/5+1->{L1+L}
Return


Lbl R
0->S->W
Fill(L1,16,0
N()
N()
Return


Lbl GO
0->H
For(I,0,15)
If {I+L1}=0 or (I<12 and ({I+4+L1}={I+L1})) or (I^4!=3 and ({I+1+L1}={I+L1}))
1->H
End
End
!If H
Pause 300
ClrDraw^^r^^r
If S={Q+18}^^r
RECT(20,17,56,30,~1)
Text(30,20,"Game Over!")
Text(28,28,"Score:",S>Dec)
Text(23,36,"New Highscore!")
Else
RECT(24,21,47,21,~1)
Text(29,24,"Game Over!"
Text(27,32,"Score:",S>Dec)
End
DispGraph
Repeat getKey
End
R()
GUI()
End
Return


Lbl H
ClrDraw^^r^^r
For(I,0,11)
Pt-On(I/6*48+20,I^6*9+5,I+1*8+Pic0)
If I<6
Text(29,I*9+6,e^(I+1)>Dec)
End
End
Text(56,6,"128")
Text(56,15,"256")
Text(56,24,"512")
Text(52,33,"1024")
Text(52,42,"2048")
Text(52,51,"4096")
Text(58,58,"by Toctave"
DispGraph
Repeat getKey
End
GUI()
Return


Lbl RECT
HLine({r2},{r1}-{r5},{r1}+{r3}+{r5}
HLine({r2}+{r4},{r1}-{r5},{r1}+{r3}+{r5}
VLine({r1},{r2}-{r5},{r2}+{r4}+{r5}
VLine({r1}+{r3},{r2}-{r5},{r2}+{r4}+{r5}
Return


Lbl GUI
ClrDraw^^r^^r
Tangent(32,3,Pic1
For(I,0,15)
Pt-On(I^4*9+31,I/4*9+21,Pic0)^^r
End
RECT(29,19,38,38,1
RECT(70,21,24,14,~1
RECT(70,38,24,14,~1
TEXT()
Return


Lbl D
For(I,0,15)
If {L1+I}
Pt-On(I^4*9+31,I/4*9+21,{L1+I}*8+Pic0)
End
End


DispGraph^^r
Wref(31,21,35,35)
Return


Lbl TEXT
Text(72,22,"Score:"
Text(73,28,S>Dec
Text(75,39,"Best:"
Text(73,45,{Q+18}^^r>Dec
VLine(94,45,50)
VLine(94,28,33)
Return

Fix 4
What I changed :
-The GUI doesn't update every loop anymore, it now has its own subroutine GUI()
-Same for text, it only updates when needed with TEXT()
-Game Over is now supported, whenever you're stuck, the game stops and displays a window with your score and highscore if you beat it, then waits for any key and resets, it's subroutine GO()
-Every display bug is fixed, the text does not flash like an epileptic mouse anymore
« Last Edit: April 15, 2014, 12:55:49 pm by Toctave »

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: [Axe game] 2048
« Reply #36 on: April 14, 2014, 07:50:58 pm »
Nice to see it done ! ;)

Offline TheCoder1998

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 434
  • Rating: +20/-2
  • my art is written in code, not in graphite
    • View Profile
    • My website :D
Re: [Axe game] 2048
« Reply #37 on: April 15, 2014, 09:56:42 am »
could you upload a compiled version?
i'm too lazy to download tokenIDE again :P
my ticalc acc:

http://www.ticalc.org/archives/files/authors/113/11365.html

Spoiler For The Best Song Ever:


follow me on tumblr :)
www.rickdepizza.tumblr.com

check out my anilist :D
http://anilist.co/animelist/29701/Rickdepizza

Offline Toctave

  • LV2 Member (Next: 40)
  • **
  • Posts: 22
  • Rating: +2/-0
    • View Profile
Re: [Axe game] 2048
« Reply #38 on: April 15, 2014, 12:52:39 pm »
oops I totally forgot that :x
Here you go!
Don't hesitate to tell me if you see a bug/find the graphics horrible/have an idea for a new feature!

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: [Axe game] 2048
« Reply #39 on: April 15, 2014, 01:17:54 pm »
Oooh that looks quite nice, and I like the different tile style replacing numbers with drawings. :D

Offline Toctave

  • LV2 Member (Next: 40)
  • **
  • Posts: 22
  • Rating: +2/-0
    • View Profile
Re: [Axe game] 2048
« Reply #40 on: April 15, 2014, 01:41:04 pm »
Thanks! I thought numbers would be either unreadable or would take the whole screen so I went for this style, allowing to have regular tile sizes. Any new feature ideas?

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: [Axe game] 2048
« Reply #41 on: April 15, 2014, 01:45:20 pm »
Would animated blocks be feasible? I think if you did that you should make the moving blocks monochrome while they are still moving, so the grayscale won't look weird.

Offline Toctave

  • LV2 Member (Next: 40)
  • **
  • Posts: 22
  • Rating: +2/-0
    • View Profile
Re: [Axe game] 2048
« Reply #42 on: April 15, 2014, 01:50:43 pm »
Everything's feasible!
but erm... I have no idea how to do that.I would need to check if a block has moved and from where to where, then in a for loop make all the moves... I can't think of another way, and this one would be quite complicated to put up.

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: [Axe game] 2048
« Reply #43 on: April 15, 2014, 04:13:02 pm »
You can do that while you compute the tile movement.

Offline JWinslow23

  • Coder Of Tomorrow
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 556
  • Rating: +43/-6
  • I make quality calculator games...when I have time
    • View Profile
Re: [Axe game] 2048
« Reply #44 on: April 19, 2014, 02:59:04 pm »
I'm actually working on animations! What kind do you want? The kind where everything moves one tile at a time, or the kind of slide present in the "official" online version (where one "slide" iteration moves all tiles to their destination)?
Did you know that "Ammonia Gas" rearranged is "As Omnimaga"?
Click here for the only set of games you'll ever need
= ?