Page 1 of 1

Color Switch CE

Unread postPosted: 21 Feb 2017, 09:17
by Flip
Hi everybody,
I've been recently working on a CE port of the classic game color switch, here are some pictures for people who don't know it:
Image
So the project is a little bit different because I had some problems with Ice language (and thats probably why I'm writing this topic :troll: )
Image
The gif is slow and a little buged because of Cemu, so If you want to test the program yourself on your calc, here is a download link:
https://drive.google.com/open?id=0BwcXw ... TBTR2U1NTQ
I'm writing this topic in english because it's Ice compiled, so PT_ may help me, and I want to avoid him translating all the message on google trad :troll: :troll: .
So here you have the code:

Code: Select all
SWITCHC

dét(0

0-425→U
40→I→R
80→F
1→S
50-100→V
250-500→Y
5→G
V+300→W

MAIN MENU
dét(5,0
dét(21,254
dét(18,"COLOR SWITCH 1.2 BETA VERSION",0,0
dét(18,"PLEASE DO NOT DISTRIBUTE",0,10
Lbl WAITFORKEY
getKey→K
If K≠0
Goto 01
End
Goto WAITFORKEY

MAINLOOP
Lbl 01
For(θ,0,10

getKey→K

dét(2,0

U+G→U
V+G→V
Y+G→Y
G-1→G
V+300→W

dét(9,1
dét(10
dét(76

dét(2,255
dét(34,150,U,10

dét(2,F
dét(34,150,Y,55
I→F
dét(2,I
dét(34,150,V,55

dét(2,0
dét(34,150,V,50
dét(34,150,Y,50
dét(2,R
dét(34,150,140,10


dét(2,225
dét(36,0,W,320,3

dét(21,120
dét(18,"STAGE: ",240,S

dét(19,290,0
dét(15,S,3

dét(19,0,0
dét(15,C,2

dét(10
dét(11,0


If Y-300≤300
0-425→U
0-50→V
0-300→Y
5→G
S+1→S
If R<255
R+40→R
Else
40→R
End
Goto JUMP
End

Lbl JUMP

If W≤150
Goto GAMEOVER
End

If Y+50<145 et Y+50>125 et F≠R
Goto GAMEOVER
End

If Y-50<145 et Y-50>125 et F≠R
Goto GAMEOVER
End

If V+50<145 et V+50>125 et I≠R
Goto GAMEOVER
End

If V-50<145 et V-50>125 et I≠R
Goto GAMEOVER
End

If K≠0
Goto KEY
End

End

C IS THE COUNTER BETWEEN COLOR CHANGES
If C=2
If I<200
I+40→I
Goto 01
End
If I≥200
40→I
0→C
Goto 01
End
End

C+1→C
Goto 01

IF A KEY IS PRESSED
Lbl KEY

If K=15
Goto END
End

If K=54
10→G
If C=2
If I≥200
40→I
0→C
Goto 01
End
If I<200
I+40→I
0→C
Goto 01
End
End
C+1→C
Goto 01
End
Goto 01

Lbl GAMEOVER

dét(9,0
140→Q

dét(74,3,3
dét(21,254
dét(18,"GAME OVER",50,80

Pause

Lbl END
dét(1

Sory, the  is a little "i" on the calc
If someone could help me with optimising the speed, I'd be grateful.

Re: Color Switch CE

Unread postPosted: 21 Feb 2017, 10:58
by PT_
Awesome! :D
I want to give you some general tips, to speed it up ;)
First of all, why do you have "det(9,1)" in the main loop? You don't need that, just put it in the header somewhere.
Next, you have somewhere "det(10):det(11,0)", which causes (I think) the main lag, you can remove the det(11,0) (it would still work fine).
Also, so you some code with Lbl WAITFORKEY, why not putting a Pause there? :P
My next point is that you have about 6 times the FillCircle routine, but this is routine is pretty slow, just because it's a clipped circle, although I'm not sure how you can solve it :(
Last, but not least, here is my more optimized code, NOT TESTED AT ALL!!! :P
Code: Select all
[i]SWITCH
det(0
1->S+4->G
40->I->R*2->F
0-50->V+300->W
0-250->Y
0-425->U

[i]MAINMENU
det(5,0
det(21,254
det(18,"COLOR SWITCH 1.2 BETA VERSION",0,0
det(18,"PLEASE DO NOT DISTRIBUTE",0,10

Repeat getKey
End

[i]MAINLOOP
Lbl 01
For(theta,0,10
   getKey->K
   If not(K-15
      Goto END
   End
   If not(K-54
      10->G
      If not(C-2
         If I>=1000
            40->I
            0->C
         Else
            I+40->I
            0->C
         End
      Else
         C+1->C
      End
      Goto 01
   End
   If K
      Goto 01
   End
   det(2,0
   U+G->U
   V+G->V
   Y+G->Y
   G-1->G
   V+300->V
   
   det(9,1
   det(10
   det(76
   det(2,255
   det(34,150,U,10
   det(2,F
   det(34,150,Y,55
   I->F
   det(2,I
   det(34,150,V,55
   
   det(2,0
   det(34,150,V,50
   det(34,150,Y,50
   det(2,R
   det(34,150,140,10
   
   det(2,255
   det(36,0,W,320,3
   
   det(21,120
   det(18,"STAGE: ",240,S
   
   det(19,290,0
   det(15,S,3
   
   det(19,0,0
   det(15,C,2
   
   det(10
   
   If Y<=600
      0-425->U
      0-50->V
      0-300->Y
      5->G
      S+1->S
      If R<255
         R+40->R
      Else
         40->R
      End
   End
   If W<=150
      Goto GAMEOVER
   End
   If Y+50<145 and Y+50>125 and F!=R
      Goto GAMEOVER
   End
   If Y-50<145 and Y-50>125 and F!=R
      Goto GAMEOVER
   End
   If V+50<145 and V+50>125 and I!=R
      Goto GAMEOVER
   End
   If V-50<145 and V-50>125 and I!=R
      Goto GAMEOVER
   End
End

[i]C IS THE COUNTER BETWEEN COLOR CHANGES
If not(C-2
   If I<200
      I+40->I
   Else
      40->I
      0->C
   End
Else
   C+1->C
End
Goto 01

Lbl GAMEOVER
det(9,0
det(74,3,3
det(21,254
det(18,"GAME OVER",50,80
Pause
Lbl END
det(1

Re: Color Switch CE

Unread postPosted: 21 Feb 2017, 14:57
by Flip
Thank you very much, I'll do that. Gona test it this evening.
PS: I'm going to change the circles into sprites and I need to rotate the circle sprite. Is it possible right now with the Ice commands ? Again, thanks for your help :D

Re: Color Switch CE

Unread postPosted: 21 Feb 2017, 15:54
by PT_
Flip wrote:Thank you very much, I'll do that. Gona test it this evening.
PS: I'm going to change the circles into sprites and I need to rotate the circle sprite. Is it possible right now with the Ice commands ? Again, thanks for your help :D

No, sadly not, but that is not possible either with the C libs ;)

Re: Color Switch CE

Unread postPosted: 22 Feb 2017, 09:32
by MateoConLechuga
Looks very nice! Also you can to do rotations easily in C PT_ :P Anywho, I would just like to point out that you probably have a super outdated version of CEmu, it works perfectly fine for me; shown below:

Image

Keep up the good work!

Re: Color Switch CE

Unread postPosted: 22 Feb 2017, 10:31
by Flip
Yeah, I've seen it after posting, sorry Mateo :troll: , it was my fault, and as we now know that rotating is possible, could you ad this command PT_?

Re: Color Switch CE

Unread postPosted: 22 Feb 2017, 11:25
by PT_
I thought you mean rotations like 10 degrees, 496 degrees etc, which is not possible ;) And flipping/rotating sprites will be possible after pointers has been added (whenever that will be)

Re: Color Switch CE

Unread postPosted: 12 Mar 2017, 18:41
by Flip
Hey guys, I've have recently been very busy with school work, and I've restarted working on the color Switch game. So, actually, I need sprites , a lot of sprites :troll: :p , because I don't know if you've seen but the game isn't very pretty, so I'll try to make an intro, or an animated menu, and to make the score and the "game over" animation look better. Now If you're actually intrested in helping me with finding good sprites and in giving me good ideas for the death animation, you can MP me.

Re: Color Switch CE

Unread postPosted: 17 Mar 2017, 18:29
by Flip
Version 1.9 finally uploaded ! :D :D Hope you will enjoy it !
If you see some bugs, please mp me or report it on this topic.
Dowload link: archives_voir.php?id=873936
A screenshot:
Image