Author Topic: Grammer Grayscale Ghristmas Game  (Read 16664 times)

0 Members and 1 Guest are viewing this topic.

Offline persalteas

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 231
  • Rating: +44/-4
  • z80 poweeer
    • View Profile
    • Tout-82
Re: Grammer Grayscale Ghristmas Game
« Reply #15 on: December 15, 2012, 08:48:37 am »
Please see.  D:


Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Grammer Grayscale Ghristmas Game
« Reply #16 on: December 15, 2012, 12:12:42 pm »
That is really weird o_O Is that the latest version of Grammer? I used an earlier version and a later version when I tested it and both worked. Maybe it was a bug in that specific version and it got fixed?

Offline persalteas

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 231
  • Rating: +44/-4
  • z80 poweeer
    • View Profile
    • Tout-82
Re: Grammer Grayscale Ghristmas Game
« Reply #17 on: December 15, 2012, 12:15:32 pm »
I used this version, I think it's the latest.


Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Grammer Grayscale Ghristmas Game
« Reply #18 on: December 15, 2012, 12:20:07 pm »
Hmm, I must have never released the newer version D: Maybe it's because I had a bug in it or something ? Regardless, I used that version and it still worked fine. Do you have other apps installed? Maybe zStart or something that could be causing issues even after a RAM clear?

Offline persalteas

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 231
  • Rating: +44/-4
  • z80 poweeer
    • View Profile
    • Tout-82
Re: Grammer Grayscale Ghristmas Game
« Reply #19 on: December 15, 2012, 12:31:46 pm »
No, anything, you can see it on the gif, Grammer is alone.

But I thought it could be because I switch the hooks "On" and you don't.
Wait, I try without the hooks..


EDIT: no, hooks are not responsible of this bug.
« Last Edit: December 15, 2012, 12:34:23 pm by persalteas »


Offline persalteas

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 231
  • Rating: +44/-4
  • z80 poweeer
    • View Profile
    • Tout-82
Re: Grammer Grayscale Ghristmas Game
« Reply #20 on: December 17, 2012, 09:18:47 am »
Big update ;)

2500 bytes exactly.

Code pasted with TokenIDE  8)

Code: [Select]
.0:Return
->a
pi9872->Z
pi9340->Y
MakeVar(6,"UNOYEL->M
2+FindVar("UNY->w+16->s+138->r+8->p+80->q+80->x+32->y+32->z+32->b+1->c+1->d+1->e
Lbl "F->F
SetBuf('Y
SetBuf(^^oZ
ClrDrawZ
ClrDraw
Contrast(27
Rect(24,0,25,46,3
Rect('25,0,69,0,0
Rect(6,24,10,81,3
Rect('5,27,88,27
Rect(15,33,22,64,3
Rect(4,54,11,88,3
Rect('5,63,91,63,0
Rect(30,33,20,34,3
Rect(23,33,22,48,3
Rect('24,53,28,53
Rect('66,53,70,53
Rect('28,52,66,52
Rect('11,23,17,23
Rect('78,23,84,23
Rect('17,22,24,22
Rect('69,22,78,22
Circle(29,13,3
Circle(29,26,3
Circle(29,41,3
Circle(29,54,3
Circle(29,67,3
Circle(29,79,3
Misc(1,Y,Z,768
Fill(0
Rect(31,35,19,33,0
For(C,1,5
C*26 +FindVar("UNY->B
For(A,1,7
2*C -1->K
Tile(2,B,A,K,2,13,Z
DispGraph
If A!=7
Tile(2,B,A,K,2,13,Z
call F
End
End
SetFont 2
SetBuf(Z
Text(56,10,"start / quit / stats
SetBuf(Y
SetBuf(^^oZ
0->K
9->V
Return->R
getKey->G
call Lbl "BRILL
call F
If G=15  or G=51
Goto Lbl "Q
If G=50  or G=49
call Lbl "STAT
If G=99
Goto a
If G<52
Goto R
ClrDrawZ
Fill(0
M[0,0,0,0,0,0
2->V
0->W->I->J->K->U->O
100->H
Contrast(30
Horizontal 56,0
Return->R
getKey->G
If O
Then
SetBuf('Z
Rect(0,0,35,15,0
Text(0,0,"Done:
Text('+6,0,I
Text(+6,0,"Fails:
Text('+6,0,J
Text(+6,0,"ToDrop:
Text('+6,0,H
SetBuf('Y
End
K+1->K
If K=1  or K=5
Tile(2,p,2,3,5,16,Z
If K=6  or K=10
Tile(2,q,2,3,5,16,Z
If K=10
0->K
If U=0  and randInt(0,2
Then
0->h
randInt(1,5
If =1
x->h
If =2
y->h
If =3
z->h
If =4
Tile(2,w,40,11,,16
If h
Then
Tile(2,h,40,10,2,16
M+5 [1
End
End
DispGraph
For(C,1,V
ShiftBuf(1,2
U+1->U
Vertical 95
End
Horizontal 56,0
Pxl-Off(randInt(56,65),randInt(94,97
DispGraph
If U>=16
Then
If (M
J+1->J
Misc(1,M+1,M,5
M+5 [0
0->U
End
If G=9  and !W
Then
H-1->H
1->W
0->theta
Tile(5,s,20,3
End
If W
Then
For(C,1,V+1
Rect(0,20,20,30,11
Horizontal 20
theta+1->theta
End
End
If theta>=19
Then
If !(M+1
J+1->J
If (M+1
Then
I+1->I
M+1 [0
End
0->W->theta
End
If G=14
Then
Inv(O->O
SetBuf('Z
Rect(0,0,35,28,0
SetBuf('Y
End
If !H  and !W  or G=15
Goto Lbl "E
Goto R
.E
0->S
If I>J
Then
I-2*J ->S
End
call Lbl "BUF1
Text(12,17,"Well Done !
Text(24,20,"Score:
Text('^^oS
call Lbl "BUF2
100-H->H
b[H+(b
c[I+(c
d[J+(d
If S>(e
e[S
call Lbl "STAT
Goto a
.Q
ClrDraw
ClrDrawZ
DispGraph
DelVar "UNOYEL
ClrHome
Stop
.F
DispGraph
Fill(23,0,35,4,4,18
End
.STAT
call Lbl "BUF1
Text(12,17,"Statistics
Text(36,12,"Total Drops:
Text('^^oGetInc(b
Text(29,12,"Total okays:
Text('^^oGetInc(b
Text(22,12,"Total fails:
Text('^^oGetInc(b
Text(43,12,"High Score:
Text('^^oGetInc(b
call Lbl "BUF2
99->G
End
.BRILL
If !K
Then
randInt(3,88->A
randInt(0,15->B
End
If !K  or K=7
Tile(2,r,B,A,1,8,Z
If K=7
~V->K
K+1->K
End
.BUF1
ClrDrawZ
Fill(0
For(90
Pxl-Off(randInt(3,63),randInt(3,93
End
SetBuf('Z
Rect(11,8,44,76,6
Rect(10,7,44,76,6
Rect('20,19,60,19
End
.BUF2
SetBuf('Y
0->K+1->V
For(C,1,10
For(U,1,53
Tile(2,s,U,C
call Lbl "BRILL
DispGraph
If getKey=15
Then
53->U
10->C
End
If U!=53
Tile(2,s,U,C
U+3->U
End
End
Repeat getKey=15
call Lbl "BRILL
DispGraph
End
End

It's quite great, there is only two problems:

1) The high score sometimes display "255" or "653**", I don't know why and how to solve it...
2) When you press [^] in the game, it displays the score and some info. But I don't know why the back of the sled is BLINKING. The rectangle which erases the score display is small and doesn't erase the sled. That's strange.
« Last Edit: December 17, 2012, 09:20:48 am by persalteas »


Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Grammer Grayscale Ghristmas Game
« Reply #21 on: December 17, 2012, 09:24:10 am »
For 1) It seems that you might be making a negative score? There is a Mode settign that lets you disply negative numbers, but I'm not sure about the 255, I'll have to look at the code.
2) I'll have to look at the code to figure it out XD

EDIT: I cannot figure out what is wrong with the sled, are you using XOR logic? If so, do this:

Make sure the whole sprite is drawn OFF
Draw the menu
Continue as normal

Then, when the menu exits:

Make sure the whole sprite is OFF
Erase the menu
Continue as normal

So, are you inverting the sprite? If so, I may be able to offer some advice on speeding it up...

Offline persalteas

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 231
  • Rating: +44/-4
  • z80 poweeer
    • View Profile
    • Tout-82
Re: Grammer Grayscale Ghristmas Game
« Reply #22 on: December 17, 2012, 10:12:57 am »
2) Yeah ! :D Problem solved ! (but you have to maintain the key pressed)

Code: [Select]
.0:Return
->a
pi9872->Z
pi9340->Y
MakeVar(6,"UNOYEL->M
2+FindVar("UNY->w+16->s+138->r+8->p+80->q+80->x+32->y+32->z+32->b+1->c+1->d+1->e
Lbl "F->F
SetBuf('Y
SetBuf(^^oZ
ClrDrawZ
ClrDraw
Contrast(27
Rect(24,0,25,46,3
Rect('25,0,69,0,0
Rect(6,24,10,81,3
Rect('5,27,88,27
Rect(15,33,22,64,3
Rect(4,54,11,88,3
Rect('5,63,91,63,0
Rect(30,33,20,34,3
Rect(23,33,22,48,3
Rect('24,53,28,53
Rect('66,53,70,53
Rect('28,52,66,52
Rect('11,23,17,23
Rect('78,23,84,23
Rect('17,22,24,22
Rect('69,22,78,22
Circle(29,13,3
Circle(29,26,3
Circle(29,41,3
Circle(29,54,3
Circle(29,67,3
Circle(29,79,3
Misc(1,Y,Z,768
Fill(0
Rect(31,35,19,33,0
For(C,1,5
C*26 +FindVar("UNY->B
For(A,1,7
2*C -1->K
Tile(2,B,A,K,2,13,Z
DispGraph
If A!=7
Tile(2,B,A,K,2,13,Z
call F
End
End
SetFont 2
SetBuf(Z
Text(56,10,"start / quit / stats
SetBuf(Y
SetBuf(^^oZ
0->K
9->V
Return->R
getKey->G
call Lbl "BRILL
call F
If G=15  or G=51
Goto Lbl "Q
If G=50  or G=49
call Lbl "STAT
If G=99
Goto a
If G<52
Goto R
ClrDrawZ
Fill(0
M[0,0,0,0,0,0
2->V
0->W->I->J->K->U
~1->O
100->H
Contrast(30
Horizontal 56,0
Return->R
getKey->G
If O
Then
SetBuf('Z
Rect(0,0,35,15,0
Text(0,0,"Done:
Text('+6,0,I
Text(+6,0,"Fails:
Text('+6,0,J
Text(+6,0,"ToDrop:
Text('+6,0,H
SetBuf('Y
End
K+1->K
If K=1  or K=5
Tile(2,p,2,3,5,16,Z
If K=6  and G=14
Then
Inv(O->O
ClrDrawZ
End
If K=6  or K=10
Tile(2,q,2,3,5,16,Z
If K=10
0->K
If U=0  and randInt(0,2
Then
0->h
randInt(1,5
If =1
x->h
If =2
y->h
If =3
z->h
If =4
Tile(2,w,40,11,,16
If h
Then
Tile(2,h,40,10,2,16
M+5 [1
End
End
DispGraph
For(C,1,V
ShiftBuf(1,2
U+1->U
Vertical 95
End
Horizontal 56,0
Pxl-Off(randInt(56,65),randInt(94,97
DispGraph
If U>=16
Then
If (M
J+1->J
Misc(1,M+1,M,5
M+5 [0
0->U
End
If G=9  and !W
Then
H-1->H
1->W
0->theta
Tile(5,s,20,3
End
If W
Then
For(C,1,V+1
Rect(0,20,20,30,11
Horizontal 20
theta+1->theta
End
End
If theta>=19
Then
If !(M+1
J+1->J
If (M+1
Then
I+1->I
M+1 [0
End
0->W->theta
End
If !H  and !W  or G=15
Goto Lbl "E
Goto R
.E
0->S
If I>J
Then
I-2*J ->S
End
call Lbl "BUF1
Text(12,17,"Well Done !
Text(24,20,"Score:
Text('^^oS
call Lbl "BUF2
100-H->H
b[H+(b
c[I+(c
d[J+(d
If S>(e
e[S
call Lbl "STAT
Goto a
.Q
ClrDraw
ClrDrawZ
DispGraph
DelVar "UNOYEL
ClrHome
Stop
.F
DispGraph
Fill(23,0,35,4,4,18
End
.STAT
call Lbl "BUF1
Text(12,17,"Statistics
Text(36,12,"Total Drops:
Text('^^oGetInc(b
Text(29,12,"Total okays:
Text('^^oGetInc(b
Text(22,12,"Total fails:
Text('^^oGetInc(b
Text(43,12,"High Score:
Text('^^oGetInc(b
call Lbl "BUF2
99->G
End
.BRILL
If !K
Then
randInt(3,88->A
randInt(0,15->B
End
If !K  or K=7
Tile(2,r,B,A,1,8,Z
If K=7
~V->K
K+1->K
End
.BUF1
ClrDrawZ
Fill(0
For(90
Pxl-Off(randInt(3,63),randInt(3,93
End
SetBuf('Z
Rect(11,8,44,76,6
Rect(10,7,44,76,6
Rect('20,19,60,19
End
.BUF2
SetBuf('Y
0->K+1->V
For(C,1,10
For(U,1,53
Tile(2,s,U,C
call Lbl "BRILL
DispGraph
If getKey=15
Then
53->U
10->C
End
If U!=53
Tile(2,s,U,C
U+3->U
End
End
Repeat getKey=15
call Lbl "BRILL
DispGraph
End
End



(YES, the gif is still blinking, but on a real calc it works !)
« Last Edit: December 17, 2012, 10:13:57 am by persalteas »


Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Grammer Grayscale Ghristmas Game
« Reply #23 on: December 17, 2012, 10:23:19 am »
Awesome! So, if you are drawing the sprite using XOR logic, you might be doing this:

XOR sprite 1 to the screen
XOR sprite 1 to erase it
XOR sprite 2 tot he screen
XOR sprite 2 to erase it

...

But really, you don't need to do that. You can create a sprite that will erase the previous sprite with XOR logic and replace it with the new sprite all at once. It is a little tricky to understand, but it might make your animation much smoother since it won't be blinking. For example, here are two sprites:

3C4281818181423C
0000182424180000

Instead of  doing :
XOR 3C4281818181423C
XOR 3C4281818181423C
XOR 0000182424180000
XOR 0000182424180000

You can draw the first sprite outside of the loop, then use a single sprite to toggle between the two images:
Code: [Select]
XOR 3C4281818181423C
Repeat <<main loop>>
XOR 3C4299A5A599423C   ;toggle between the two sprites
End
How do you find the "toggle" sprite? Simple: XOR the two sprites together and use the data it makes :) That will get rid of the moments where there is nothing on the screen, so there won't be any more blinking :D

Offline persalteas

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 231
  • Rating: +44/-4
  • z80 poweeer
    • View Profile
    • Tout-82
Re: Grammer Grayscale Ghristmas Game
« Reply #24 on: December 18, 2012, 07:30:27 am »
Oh yes, that's a good idea !

I will try to do this.