» Goto page 1, 2, 3, 4, 5, 6, 7, 8, 9  Next
» View previous topic :: View next topic  

How excited are you for this project???
SUPER EXCITED!!
 9%  [ 19 ]
SUPER FRUITY EXCITED!!
 44%  [ 89 ]
All of the above
 46%  [ 93 ]
Total Votes : 201

FRUIT NINJA CE IS RELEASED IN THE ARCHIVES
Download it here: http://ceme.tech/DL2207

—————

NOTE: This project is in fact being programmed in C. My first few test programs were written in TI-Basic, but I carry over to C later in the thread!

Check out the GitHub repository: https://github.com/Michael2-3B/FruitNinjaCE


Here is the original post:
-----------------------------

It is yet another tireless night, and here is yet another experimentation of mine. I have written a few lines of TI-Basic code that will display lines on the screen correlating to how you swipe the keyboard on the calculator, much like in fruit-ninja.

It is nothing revolutionary, as we have seen it in the original monochrome fruit-ninja game. However this is written in TI-Basic and is compatible with the CE.

Now, the only real way to show this working is by a video. But before you view it, please completely ignore the scruff marks around the screen. (If you say anything about it, I WILL come after you...)

(https://www.youtube.com/watch?v=D7sEVFSDZjs)

Download Here


Code:
0->dim(L1
ClrDraw
0->Xmin:264->Xmax
~164->Ymin:0->Ymax
AxesOff
DispGraph
DelVar IDelVar ADelVar BDelVar CDelVar D
While 1
   getKey
   If Ans
   Then
      Ans->L1(1+dim(L1
      0->I
   Else
      I+1->I
      If Ans>=20 and dim(L1
      Then
         If A
         Line(B,A,D,C,0
         ~164+(164/10)(abs(L1(1)-101)/10->A
         iPart(L1(1)/10)*10
         (264/5)(L1(1)-Ans)-26->B
         ~164+(164/10)(abs(L1(dim(L1))-101)/10->C
         iPart(L1(dim(L1))/10)*10
         (264/5)(L1(dim(L1))-Ans)-26->D
         Line(B,A,D,C
         0->dim(L1
      End
   End
End
I like how you used the whole keypad, because the monochrome one only used the numbers Razz
If this does become a game, maybe make the function buttons be for like, pausing and quiting, because those are easier to not accidentally press, lol
Kerm can't help himself obsessively optimizing that central code chunk:

Code:

         ~164+1.64(abs(L1(1)-101->A
         10iPart(.1L1(1
         52.8(L1(1)-Ans)-26->B
         ~164+1.64(abs(L1(dim(L1))-101->C
         10iPart(.1L1(dim(L1
         52.8(L1(dim(L1))-Ans)-26->D
         Line(B,A,D,C
         0->dim(L1
KermMartian wrote:
Kerm can't help himself obsessively optimizing that central code chunk:

Code:
         ~164+1.64(abs(L1(1)-101->A
         10iPart(.1L1(1
         52.8(L1(1)-Ans)-26->B
         ~164+1.64(abs(L1(dim(L1))-101->C
         10iPart(.1L1(dim(L1
         52.8(L1(dim(L1))-Ans)-26->D
         Line(B,A,D,C
         0->dim(L1


I can't either, it seems.

Code:
         ~1.64(201-abs(L1(1->A
         10iPart(.1L1(1
         52.8(L1(1)-Ans)-26->B
         ~1.64(201-abs(L1(dim(L1->C
         10iPart(.1L1(dim(L1
         52.8(L1(dim(L1))-Ans)-26->D
         Line(B,A,D,C
         0->dim(L1


All I did was realize that the negative 164 was (obviously) divisible by 1.64, and negated that part of the expression to move the bit with end parens to the back. Nothing too fancy, and I'm sure someone could do better. In theory, you could do the same with C and D, but it's insignificant.
I tried both of your codes, and they didn’t work for some reason. The lines were not visible. So, I did my own optimization.

I added this right before the While 1, taking advantage of the special blue variables.

Code:
"~155+16.4(.1abs(L1(X)-101->|u
"~26+52.8(L1(X)-10iPart(.1L1(X->|v


And in the center part, it becomes:

Code:
Line(B,A,D,C,0
1->X
|u->A
|v->B
dim(L1->X
|u->C
|v->D
Line(B,A,D,C
0->dim(L1
I have created another version, which accounts for all the keys pressed in the swipe, instead of just the first and last key. You can try it here.




Code:
0->dim(L1
ClrDraw
0->Xmin:264->Xmax
~164->Ymin:0->Ymax
AxesOff
DispGraph
DelVar IDelVar ADelVar BDelVar CDelVar D
"~155+16.4(.1abs(L1(X)-101->|u
"~26+52.8(L1(X)-10iPart(.1L1(X->|v
While 1
   getKey
   If Ans
   Then
      Ans->L1(1+dim(L1
      dim(L1)-(dim(L1)>1->X
      |u->A:|v->B
      dim(L1->X:|u->C:|v->D
      Line(B,A,D,C
      0->I
   Else
      I+1->I
      If Ans>=10 and dim(L1
      Then
         ClrDraw
         0->dim(L1
      End
   End
End
Michael2_3B wrote:

Code:
0->dim(L1
ClrDraw
0->Xmin:264->Xmax
~164->Ymin:0->Ymax
AxesOff
DispGraph
DelVar IDelVar ADelVar BDelVar CDelVar D
"~155+16.4(.1abs(L1(X)-101->|u
"~26+52.8(L1(X)-10iPart(.1L1(X->|v
While 1
   getKey
   If Ans
   Then
      Ans->L1(1+dim(L1
      dim(L1)-(dim(L1)>1->X
      |u->A:|v->B
      dim(L1->X:|u->C:|v->D
      Line(B,A,D,C
      0->I
   Else
      I+1->I
      If Ans>=10 and dim(L1
      Then
         ClrDraw
         0->dim(L1
      End
   End
End


Code:
ClrList L1
ClrDraw
0->Xmin:264->Xmax
~164->Ymin:0->Ymax
AxesOff
DispGraph
DelVar IDelVar ADelVar B
"~155+16.4(.1abs(L1(Ans)-101->|u
"~26+52.8(L1(Ans)-10iPart(.1L1(Ans->|v
While 1
   getKey
   If Ans
   Then
      Ans->L1(1+dim(L1
      dim(L1)-(1<dim(L1
      |u->A:|v->B
      dim(L1
      Line(B,A,|v,|u
      0->I
   Else
      I+1->I
      If Ans>=10 and dim(L1
      Then
         ClrDraw
         ClrList L1
      End
   End
End

I haven't tried it out, but I think this would work
Also, you might want to add a PlotsOff because if they are on and you are clearing L1, then a dim error will be thrown when you try to DispGraph
Awesome work, the speed and accuracy are particularly impressive!

Do you anticipate an example game test any time soon?

Also the condition of the calculator in the video ...... :S
tr1p1ea wrote:
Awesome work, the speed and accuracy are particularly impressive!

Do you anticipate an example game test any time soon?

Thanks! An example game might be cool, I’ll have to try that once I get back home from my trip. I could probably have a list of objects whose values and locations on the screen coincide with the key values, and when they match with where was swiped they would disappear. Obviously, ICE or C would be better for graphics if this were to become a full game.

tr1p1ea wrote:
Also the condition of the calculator in the video ...... :S

Yeah, well... it’s been through a lot. Still functions perfectly though. I’m thinking of getting another CE, maybe lightning blue or red. An 84+ monochrome might be nice to have again too, but that all comes out to OVER $200 if there’s not some incredible sale on both of those.
The figure of 200$ was a bit depressing to me. You could surely get a really cheap 84+ on ebay in very good condition. I often see them go for about 30-50$. The CEs are still a bit expensive even used (you could probably get one pretty easily around 80$ because they are still the newest model and people remember what they paid for it only a couple years ago Razz)
Granted they wouldn't be brand new, but I think it's well worth the savings if it is in good condition.

little ebay rant coming up
The thing I hate about ebay is that most of the sellers are in the US, which means that if you are from other countries, either the sellers don't ship to you, or if they do, then there are import costs and shipping fees that pretty much kill any deal you were getting.
So I am trying to improve this further in TI-Basic, afterwards I will be doing everything in C. Runer112 suggested earlier that I do real time swiping, which is actually what I'm already doing. The only thing is, I'm not erasing any of the lines until you stop swiping in order for me to easily ClrDraw.

By doing it a different way, and actually erasing the lines behind you as you swipe, it would be more like the touch screen version... only I have to keep track of where the previous lines are, just like Snake. I will edit this post when I have that completed. Suggestions on this and my port to C are welcome.

EDIT: I have successfully changed it, and I also modified it so that only the keys between [math] and [enter] work for swiping. If you continuously swipe, it will erase the previous lines, albeit slowly. I am hoping that C will solve this issue and I can make it look cleaner.

Didn't do a video this time, not necessary

(CEmu makes it look slightly faster than it actually is)


Code:
0->dim(L1
ClrDraw
0->Xmin:264->Xmax
~164->Ymin:0->Ymax
AxesOff
GridOff
FnOff
PlotsOff
DispGraph
DelVar ADelVar BDelVar CDelVar D1->I
"26.4+52.8(L1(X)-1-10iPart(.1L1(X->|u
"~152.3+23.4(.1(|E2+10fPart(.1L1(X))-L1(X->|v
While 1
   I+1->I
   getKey
   If Ans>40
   Then
      If not(dim(L1
      Then
         {Ans->L1
         1->I
      Else
         augment({Ans},L1->L1
      End
      If dim(L1)>1
      Then
         2->X:|u->A:|v->B
         1->X:|u->C:|v->D
         Line(A,B,C,D
      End
   End
   If dim(L1) and not(fPart(I/4
   Then
      1->I
      If dim(L1)>1
      Then
         dim(L1->X
         |u->A:|v->B
         X-1->X:|u->C:|v->D
         Line(A,B,C,D,0
         dim(L1)-1->dim(L1
      End
      If dim(L1)=1
      0->dim(L1
   End
End

Optimize if you like. Leave me feedback too Very Happy Now onto C development.
Looks Great!Smile Will you be making a fruit ninja game to go along with it,or will it be stand-alone?
Legoman314 wrote:
Looks Great!Smile Will you be making a fruit ninja game to go along with it,or will it be stand-alone?

That is yet to see. I will update you when I get more of the C version working.

(If I can't handle C though I may try ICE)
Google wrote:

Deceptive site ahead
Attackers on img.techpowerup.org may trick you into doing something dangerous like installing software or revealing your personal information (for example, passwords, phone numbers, or credit cards).

When I tried to access this topic, Google gave me a security warning page. Just wondering if anyone has the same problem.
Legoman314 wrote:
Google wrote:

Deceptive site ahead
Attackers on img.techpowerup.org may trick you into doing something dangerous like installing software or revealing your personal information (for example, passwords, phone numbers, or credit cards).

When I tried to access this topic, Google gave me a security warning page. Just wondering if anyone has the same problem.


Same problem.
john35588 wrote:
Legoman314 wrote:
Google wrote:

Deceptive site ahead
Attackers on img.techpowerup.org may trick you into doing something dangerous like installing software or revealing your personal information (for example, passwords, phone numbers, or credit cards).

When I tried to access this topic, Google gave me a security warning page. Just wondering if anyone has the same problem.


Same problem.
Should be fixed now. https://www.cemetech.net/forum/viewtopic.php?p=272722#272722
Michael2_3B wrote:
Legoman314 wrote:
Looks Great!Smile Will you be making a fruit ninja game to go along with it,or will it be stand-alone?

That is yet to see. I will update you when I get more of the C version working.

I have got the first experimental C version roughly working. Here it is:
Got to say, this looks like it is working very well.

You are planning on making a graphical FN clone with this right?
tr1p1ea wrote:
Got to say, this looks like it is working very well.

You are planning on making a graphical FN clone with this right?

It’s still experimental right now, but yes, that’s the goal.

I don’t really know C that well but I’m hitting the ground running!

EDIT: More progress, got it to work with lines. Planning on updating it so it erases as you go instead of waiting. Also planning to add a background of some sort later.

Neato! Looking pretty spiffy so far Smile
  
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
» Goto page 1, 2, 3, 4, 5, 6, 7, 8, 9  Next
» View previous topic :: View next topic  
Page 1 of 9
» 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