dankcalculatorbro wrote:
Okay, so I should probably run this on my calculator to see if this works, but here is how I would think you would do this. I am using 1 as the head and 0 as the body, and have marked new and changed lines.

Code:

ClrHome
13A:5B:10X:1P:26D
X→dim(L1
X→dim(L2
A→G //changed
B→H //changed
Fill(B,L1
Fill(A,L2
Repeat K=45
Output(L1(P),L2(P),"[one space]
Output(B,A,"1  //changed (outputs head at new position)
Output(H,G,"0  //changed (outputs segment on top of old head)
B→L1(P):A→L2(P
P+1-X(P=X→P
getKey→K
A→G  //changed
B→H  //changed
If max(K={24,25,26,34
K→D
A+(D=26)-(D=24→A
B+(D=34)-(D=25→B
A+26((A=0)-(A=27→A
B+10((B=0)-(B=11→B
End

I just tried that code on my calculator after removing the quotes and replacing the squares with →. It keeps giving me a syntax error...
Because that is basic code, not ice code, I think
When you press goto error, where is the actual error? EDIT: I ran it on my calculator, and had no problems (make sure there are not spaces after commands, it can happen when you transfer programs) See the following gif of the program and download if it still won't work for you:

SourceCoder 3 (PROG01) wrote:
:ClrHome
:13->A
:5->B
:10->B
:10->X
:1->P
:26->D
:X->dim(L1
:X->dim(L2
:A->G
:B->H
:Fill(B,L1
:Fill(A,L2
:Repeat K=45
: Output(L1(P),L2(P)," "
: Output(B,A,"1"
: Output(H,G,"0"
: B->L1(P)
: A->L2(P)
: P+1-X(P=X->P
: getKey->K
: A->G
: B->H
: If max(K={24,25,26,34
: K->D
: A+(D=26)-(D=24->A
: B+(D=34)-(D=25->B
: A+26((A=0)-(A=27->A
: B+10((B=0)-(B=11->B
:End
Yup, I got it. Thanks, Dank. I'll start converting that code to ICE and then put it on my calculator.
dankcalculatorbro wrote:
Okay, so I should probably run this on my calculator to see if this works, but here is how I would think you would do this. I am using 1 as the head and 0 as the body, and have marked new and changed lines.

Code:

ClrHome
13A:5B:10X:1P:26D
X→dim(L1
X→dim(L2
A→G //changed
B→H //changed
Fill(B,L1
Fill(A,L2
Repeat K=45
Output(L1(P),L2(P),"[one space]
Output(B,A,"1  //changed (outputs head at new position)
Output(H,G,"0  //changed (outputs segment on top of old head)
B→L1(P):A→L2(P
P+1-X(P=X→P
getKey→K
A→G  //changed
B→H  //changed
If max(K={24,25,26,34
K→D
A+(D=26)-(D=24→A
B+(D=34)-(D=25→B
A+26((A=0)-(A=27→A
B+10((B=0)-(B=11→B
End


It works great, thanks so much, I'm going to get working on this as soon as I finish my math exam tomorrow (my last exam!!!). I would expect this program to be complete by the end of this month.
Ok so I converted the Basic code into ICE so that it can be used in the game. Apparently, I ran into a problem... again. I used det(62 instead of the outputs so maybe that's the problem I am not sure... anyway here is a screenshot of what happens:
Can we have your code...
dankcalculatorbro wrote:
Can we have your code...

Sure


Code:

Define Sprite is here
[i]Initialize Stuff
Lbl MAINMENU
det(0
det(5,0
det(74,1,1

[i]Main Menu
det(21,254
det(18,"SNAKE BETA          v1.0          By: TheGeekyScientist",0,230
det(74,2,2
0->G
Repeat K=9 or K=15
   getKey->K
   det(21,254-248*not(G
   det(18,"PLAY",130,125
   det(21,254-248*not(G-1
   det(18,"SCORES",113,145
   det(21,254-248*not(G-2
   det(18,"SKINS",121,165
   If K=1 and G!=2
   G+1->G
End
If K=4 and G
G-1->G
End
End

If not(G
13->A
5->B
10->B
10->X
1->P
26->D
A->G
B->H
For(Z,0,X-1
   B->L1(Z
End
For(Z,0,X-1
   A->L2(Z
End
Repeat K=45
   det(62,15,L1(P),L2(P),1,1
   det(62,14,B,A,1,1
   det(62,9,H,G,1,1
   B->L1(P)
   A->L2(P)
   P+1-X*(P=X->P
   getKey->K
   A->G
   B->H
   If K=24 or K=25 or K=26 or K=34
   K->D
   End
   A+(D=26)-(D=24->A
   B+(D=34)-(D=25->B
   A+26*((A=0)-(A=27->A
   B+10*((B=0)-(B=11->B
End
End

If G=1
det(1
Return
End

If G=2
[i]Initialize Stuff
det(0
det(5,0
det(74,2,2

[i]Display Skins
det(62,3,75,35,1,1
det(62,2,75,70,1,1
det(62,4,75,105,1,1
det(62,5,75,140,1,1
det(62,0,75,175,1,1

[i]Skin Menu
det(21,6
det(18,"BACK",75,210

0->G
Repeat K=9 or K=15
   getKey->K
   det(21,0+6*not(G
   det(18,">",60,35
   det(21,0+6*not(G-1
   det(18,">",60,70
   det(21,0+6*not(G-2
   det(18,">",60,105
   det(21,0+6*not(G-3
   det(18,">",60,140
   det(21,0+6*not(G-4
   det(18,">",60,175
   det(21,0+6*not(G-5
   det(18,">",60,210
   If K=1 and G!=5
   G+1->G
End
If K=4 and G
G-1->G
End
End

If G=0
det(1
Return
End

If G=1
det(1
Return
End

If G=2
det(1
Return
End

If G=3
det(1
Return
End

If G=4
det(1
Return
End
When you output your sprites there should be a multiplier I believe... since each sprite is 16*16, the x and y coords of each sprite should be multiplied by 16.
dankcalculatorbro wrote:
When you output your sprites there should be a multiplier I believe... since each sprite is 16*16 or 8*8 (I don't know which), the x and y values of each sprite should be multiplied by 16 or 8, respectively

These are 16x16 sprites but do you mean in det(62 because the command is det(62,Index,x,y,scale. The scale should be 1 because then it displays the sprite by pixels so it would be 16x16. If I make it 2 it would be 32x32.
I mean det(62,Index,x*16,y*16,scale
Let me try
This is what happens
Well it seems to be more functional... you might want to add a Pause 25 in that Repeat loop, just so it can be seen slower. Also, clear the screen after you exit the menu, and remember that the limits on the screen won't correspond to basic (i.e. the screen isn't 26 spaces wide, its (number of pixels wide)/16 wide (in your case))
So should I put the Pause 25 just over the end of the repeat loop? And should I change the 26 and 16 to 320 by 240?
Ok where do I put the pause 25 because I put it on top of the 2 ends at the end and it wouldn't let me export. Here's the code for the snake game only. Not the skins menu or anything.

Code:
13->A
5->B
10->B
10->X
1->P
26->D
A->G
B->H
For(Z,0,X-1
   B->L1(Z
End
For(Z,0,X-1
   A->L2(Z
End
Repeat K=45
   det(62,15,L1(P),L2(P),1,1
   det(62,14,B*16,A*16,1,1
   det(62,9,H*16,G*16,1,1
   B->L1(P)
   A->L2(P)
   P+1-X*(P=X->P
   getKey->K
   A->G
   B->H
   If K=24 or K=25 or K=26 or K=34
   K->D
   End
   A+(D=26)-(D=24->A
   B+(D=34)-(D=25->B
   A+320*((A=0)-(A=27->A
   B+240*((B=0)-(B=11->B   
End
End
PROGRESS UPDATE:
Restarting; current progress = 0%
Expected finish time is whenever I finish it.
Ok guys. So even though I said I am basically quitting this project, I was still working on it Razz. And today I figured something out!!! I may not be able to add the skins but I am working on that right now.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 2 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement