Currently. I 'm creating a recreation of the old classical game, Snake. My version of it will be a little different. First off, I will allow the user to be able to change the skin of the snake. Maybe in a later update I might be able to let the user create their own skin. The menu for the skins will be a lot like the one from slither.io ... though the skins will be different. So far I have created the menu with the help of P_T. (Thanks P_T Very Happy) Here is a screenshot:



That is all I have so far and soon I will be busy because of exams. My exams are next week and I really need to study. So I wouldn't expect this program to be done before summer.
TheGeekyScientist wrote:
[img]file:///C:/TI84PlusCE/CEmu/Captures/Menublurp.gif[/img].
You'll need to host that somewhere that's not just your computer, champ. Evil or Very Mad
I generally use Omnimaga's image hosting service:

https://img.ourl.ca/
Tari wrote:
TheGeekyScientist wrote:
[img]file:///C:/TI84PlusCE/CEmu/Captures/Menublurp.gif[/img].
You'll need to host that somewhere that's not just your computer, champ. Evil or Very Mad

Sorry about that. Wrong link. Razz
I am almost done with creating the skins for the snakes. Just a few more and I'll get working on the menu. Also, on the menu for the skins, should I add something where it picks a random skin for you...?
TheGeekyScientist wrote:
should I add something where it picks a random skin for you...?

Here comes a high-quality post...

My answer is yes Razz
Ok, so I've run into some weird problem. Here is the code for my program right now.

Code:
[i]SNAKE
[i]Define Sprite goes 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 G=1
End
det(1

If G=2
End
det(1

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

[i]Display Skins
det(62,3,35,30,16,160
det(62,2,35,65,16,160
det(62,4,35,100,16,160
det(62,5,35,135,16,160
det(62,1,35,170,16,160

[i]Skin Menu
det(21,36
det(18,"SKINS",121,10

0->G
Repeat K=9 or K=15
   getKey->K
   det(21,254-248*not(G
   det(18,">",25,30
   det(21,254-248*not(G-1
   det(18,">",25,65
   det(21,254-248*not(G-2
   det(18,">",25,100
   det(21,254-248*not(G-3
   det(18,">",25,135
   det(21,254-248*not(G-4
   det(18,">",25,170
   If K=1 and G!=4
        G+1->G
    End
    If K=4 and G
        G-1->G
   End
End

If G=1
End
det(1

If G=2
End
det(1

If G=3
End
det(1

If G=4
End
det(1

If G=5
End
det(1

First off when I go to PLAY or SCORES it takes me to skin menu even though it should be doing det(1.
Then also, The sprites won't display properly. If someone could tell mne if I'm doing it right... I'll be thankful. Also I will make an option to create a skin in a further update once the whole game is completed.
TheGeekyScientist wrote:


If G=2
End
det(1



It should be:

Code:

If G=2
det(1
End

This way, the det(1 gets executed if the condition is true. Which is what you want, right?

Other than that, and the other if-ends in the program that need to be fixed, this code looks pretty good.
For what you are trying to do, it should be:

Code:

If G=2
det(1
Return
End


And yeah, Sprite indexes in ICE start at zero, and just fix the rest of your If:End statements and it should be good! Good luck! Smile
Pieman7373 wrote:
For what you are trying to do, it should be:

Code:

If G=2
det(1
Return
End


And yeah, Sprite indexes in ICE start at zero, and just fix the rest of your If:End statements and it should be good! Good luck! Smile


Ok, it worked. Now it doesn't go to the skins menu... Though now when I go to the skins menu, it does det(1 even though it shouldn't. Here is a screen shot of what happens:

In case I am doing the code wrong. Here is the code:

Code:

[i]SNAKE

[i]Sprite Data goes 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 G=1
   det(1
   Return
   End

If G=2
   det(1
   Return
   End

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

[i]Display Skins
det(62,2,35,30,16,160
det(62,1,35,65,16,160
det(62,3,35,100,16,160
det(62,4,35,135,16,160
det(62,0,35,170,16,160

[i]Skin Menu
det(21,36
det(18,"SKINS",121,10

0->G
Repeat K=9 or K=15
   getKey->K
   det(21,254-248*not(G
   det(18,">",25,30
   det(21,254-248*not(G-1
   det(18,">",25,65
   det(21,254-248*not(G-2
   det(18,">",25,100
   det(21,254-248*not(G-3
   det(18,">",25,135
   det(21,254-248*not(G-4
   det(18,">",25,170
   If K=1 and G!=4
        G+1->G
    End
    If K=4 and G
        G-1->G
   End
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

If G=5
   det(1
   Return
   End
Ah Ok, I found it the problem with the help of P_T. I forgot to add an end and also I completely goofed on det(69... instead of having 1,1 for the width and height, I had 16 and 160... I will post an updated screenshot very soon!
I will be looking forward to the screenshot :3
Pieman7373 wrote:
I will be looking forward to the screenshot :3
I will post it today because I have a social studies exam and then I have my orchestra exam but we don't have an exam in orchestra so we will be watching a movie but in that time I'm going to tidy up the program and then on Friday afternoon I will begin the hard stuff. That was one long sentence...
TheGeekyScientist wrote:
Pieman7373 wrote:
I will be looking forward to the screenshot :3
I will post it today because I have a social studies exam and then I have my orchestra exam but we don't have an exam in orchestra so we will be watching a movie but in that time I'm going to tidy up the program and then on Friday afternoon I will begin the hard stuff. That was one long sentence...

Never mind. I can't. I'm at school right now and deleted my ram accidentally and forgot to archive ICE. I will have one later today.
I just finished tidying it up and adding a back button on the skins menu. Just to let you guys know, there will be more skins in future updates. For now, I have 5. I still need to figure out how to display the snake in the actual game with the head because the skin's head is not the same s the body. Anyway, here's a screenshot for what I've got so far:
Ok, I'm eager to get started on the actual game now. But I need help... So the head of my snake is not the same as the body. So, therefore, I cannot just display the skin. I need to figure out a way so that it displays the head and the rest of the body. It'll look better that way. Kerm's book was very helpful for making snake with just "0" for the body. I understand how snake works but am very confused on the head. If someone could help I would be very grateful. Thanks!
What do you mean? You could just make a sprite for each segment of the snake, and apply the head to the head part of the snake. Same for a tail.
I don't quite know how you are displaying the snake right now, but I assume there X and Y coords for the front of the snake, which must be drawn, and coords for the very end of the snake, which has to be erased. Whenever in your code you draw the front of the snake, draw the head. Then, replace the previous head with a normal snake segment. It would look something like this.

//User Input - Change X and Y coords
//Output head at X and Y coords
//Output body segment at S and T coords
//Erase body segment at tail of snake
//Store X in S and Y in T
dankcalculatorbro wrote:
I don't quite know how you are displaying the snake right now, but I assume there X and Y coords for the front of the snake, which must be drawn, and coords for the very end of the snake, which has to be erased. Whenever in your code you draw the front of the snake, draw the head. Then, replace the previous head with a normal snake segment. It would look something like this.

//User Input - Change X and Y coords
//Output head at X and Y coords
//Output body segment at S and T coords
//Erase body segment at tail of snake
//Store X in S and Y in T

This is the code that I'm using but this is in basic and uses 0's for the head and body: (The 's are the arrows)


Code:
ClrHome
13A:5B:10X:1P:26D
Xdim(L1
Xdim(L2
Fill(B,L1
Fill(A,L2
Repeat K=45
Output(L1(P),L2(P),"[one space]
Output(B,A,"0
BL1(P):AL2(P
P+1-X(P=XP
getKeyK
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
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
  
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 1 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