Author Topic: Grammer Grayscale Ghristmas Game  (Read 16591 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
Grammer Grayscale Ghristmas Game
« on: November 29, 2012, 07:49:48 am »
Hey everyone, I am making a new program, (for the christmas Espace-TI contest, I wasn't motivated for Omnimaga's Apocalyptic contest and Cemetech contest 9... I try easier ! )

So, you are Santa Claus in your flying ferrari, carried out by the supple Rudolph, and you throw packs on the houses down.

You have 200 packets to drop, but you accumulate fails when you throw next to the house, or when you don't throw on a house.
I think it's a bit easy, if you have ideas that could make it harder, please tell me !

I will post my code, wait 30 minutes please, enjoy this screen while waiting... (it's an old gif, Santa claus doesn't throw anything, and wabbitemu makes it slow.)

EDIT:


Spoiler For "prgmNOYEL":
Quote from: BASIC Code
:.0:"Grammer Noyel !
:If 5/3≠1
:Then
:ClrDraw
:Text(0,0,"Please install Grammer
:Text(7,0,"to run this program.
:Return
:End
:AsmPrgmFDCB24DEC9
:ClrDraw
:Text(0,0,"loading...
:DispGraph
:π9872→Z
:π9340→Y
:Lbl "N","ZCH→a
:Lbl "O","ZCH→b
:Lbl "Y","ZCH→c
:Lbl "E","ZCH→d
:Lbl "L","ZCH→e
:Send(6,"DNOYEL→M
:Lbl "T1","ZCH→p
:Lbl "T2","ZCH→q
:Lbl "B","ZCH→r
:Lbl "C","ZCH→s
:Lbl "A","ZCH→w
:Lbl "H1","ZCH→x
:Lbl "H2","ZCH→y
:Lbl "H3","ZCH→z
:Lbl "F→F
:.MENU
:Disp 'Y
:Disp °Z
:ClrDrawZ
:ClrDraw
:Shade(27
:Lbl "CH","ZCH→A
:prgmA
:solve(1,Y,Z,768
:Fill(0
:Line(31,35,19,33,0
:For(C,1,5
:If C=1
:a→B
:If C=2
:b→B
:If C=3
:c→B
:If C=4
:d→B
:If C=5
:e→B
:For(A,1,7
:2*C -1→K
:Pt-On(10,B,A,K,2,13,Z
:DispGraph
:If A≠7
:Pt-On(10,B,A,K,2,13,Z
:prgmF
:End
:End
:Output(2
:Disp Z
:Text(56,10,"start / stats / quit
:Disp Y
:Disp °Z
:0→K
:r→C
:Return→R
:getKey→G
:If K=0
:Then
:randInt(3,88→A
:randInt(0,15→B
:End
:If K=0  or K=7
:Pt-On(10,C,B,A,1,8,Z
:If K=7
:‾9→K
:K+1→K
:prgmF
:If G=15  or G=50  or G=49
:Goto Lbl "Q
:If G=51
:prgmLbl "STAT
:If G=99
:Goto Lbl "MENU
:If G<52
:Goto R
:ClrDrawZ
:Fill(0
:p→C
:q→D
:0→K →J
:M[0,0,0,0,0,0
:2→V
:Shade(30
:Horizontal 56,0
:
:
:Return→R
:getKey→G
:K+1→K
:If K=1  or K=5
:Pt-On(10,C,2,3,5,16,Z
:If K=6  or K=10
:Pt-On(10,D,2,3,5,16,Z
:If K=10
:0→K
:If J=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
:Pt-On(10,w,40,11,,16
:If H
:Then
:Pt-On(10,H,40,10,2,16
:M+5 [1
:End
:End
:DispGraph
:Tangent(V,2
:J+V→J
:Vertical 95
:Vertical 94
:Horizontal 56,0
:Pxl-Off(randInt(56,65),randInt(94,97
:DispGraph
:If J≥16
:Then
:solve(1,M+1,M,5
:M+5 [0
:0→J
:End
:If G=15
:Goto Lbl "MENU
:Goto R
:
:.Q
:ClrDraw
:ClrDrawZ
:DispGraph
:ClrHome
:Stop
:.F
:DispGraph
:Fill(23,0,35,4,4,18
:End
:.STAT
:Disp Y
:ClrDraw
:Text(0,0,"BC
:DispGraph
:!Pause If getKey=15
:99→G
:End

Spoiler For "prgmZCH - Data program":
Quote
:.CH
:Line(24,0,25,46,3
:Line('25,0,69,0,0
:Line(6,24,10,81,3
:Line('5,27,88,27
:Line(15,33,22,64,3
:Line(4,54,11,88,3
:Line('5,63,91,63,0
:Line(30,33,20,34,3
:Line(23,33,22,48,3
:Line('24,53,28,53
:Line('66,53,70,53
:Line('28,52,66,52
:Line('11,23,17,23
:Line('78,23,84,23
:Line('17,22,24,22
:Line('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
:End
:.A
:08081C3E1C7F3E7EFF7EFF7EFF3C1818
:.C
:004428FE92FE
:.N
:08101C181E181D18391C391C389C389C18581878183808100000
:.O
:07E008101008300C700E700E700E700E700E300C1008081007E0
:.E
:0FC03FF06018E000F000FC00F800F000E00860103FF00FC00000
:.Y
:700C380C3C181F380FF8007000F001E003C007003C00F0000000
:.L
:38003C003C001C001C001C001800180018E01FF81FFC38060000
:.B
:10101028C7281010
:.T1
:0E0000028A1F0000012414800000C82780000070048FFFFF28371003FFC479EFFC01AE7080001E1073403F6020F0471C80A0BFFA0083A08004005C6080090060107FFE0080102044010020FFF8030000
:.T2
:0E000001541F00000288148000005027800000B0048FF8008837100FF10479EF800F3870807FFFC0734001F040F0471A0080BFFA3400808004340280800922FD407FFE0280C02044010040FFF8010020
:.H1
:000000C000C00FF010C8200440028001FFFF400440044C044C04403440344034
:.H2
:03003FFC20042524200425542004FC54820481148084FF14820482749A549A54
:.H3
:0000019803D807F80E781DB83C3C7FFE20043FFC35543FFC20042FF428942894


The program is not finished (The score system is not implemented, the stats screen just displays "BC", etc...), I have several questions...


1) Is that possible to display text on a specified buffer ?


2) Is that possible to archive the data program, and run a subroutine inside while it is archived ?

« Last Edit: November 29, 2012, 08:01:20 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 #1 on: November 29, 2012, 12:22:53 pm »
Wow, those sprites are great o.o Do you mind if I look for a way to speed up your grayscale, though? (it will be a few days, probably, before I can work on that, though).
1) Is that possible to display text on a specified buffer ?
No, there isn't a way to do that, sorry .__. When I need to draw text on another buffer, I do this:
Code: [Select]
Disp 'pi9872     ;or whatever the buffer is
Text(0,0,"Stuff
Disp 'pi9340     ;Or whatever your main buffer is.
2) Is that possible to archive the data program, and run a subroutine inside while it is archived ?
Unfortunately, no, again :[ However, I will point out that you can convert all the hex (sprites?) directly to data and store all the sprites in an appvar. This will save some memory and slightly speed up sprite display.

Offline persalteas

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 231
  • Rating: +44/-4
  • z80 poweeer
    • View Profile
    • Tout-82
Re: Grammer Grayscale Ghristmas Game
« Reply #2 on: November 29, 2012, 02:54:40 pm »
Quote
Do you mind if I look for a way to speed up your grayscale, though?
Okay, thanks !

Quote
I will point out that you can convert all the hex (sprites?) directly to data and store all the sprites in an appvar. This will save some memory and slightly speed up sprite display.

If I do, labels won't work... But I can use pointers, yes. I suppose to know the width in bytes of each sprite to add it to the appvar pointer, yes ?


Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: Grammer Grayscale Ghristmas Game
« Reply #3 on: November 29, 2012, 03:40:26 pm »
What I usually do for small games is make a label dedicated to memory storage and use them like a custom data.
Sig wipe!

Offline persalteas

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 231
  • Rating: +44/-4
  • z80 poweeer
    • View Profile
    • Tout-82
Re: Grammer Grayscale Ghristmas Game
« Reply #4 on: November 29, 2012, 06:09:01 pm »
Yes, but first I wanted to store these data in archive. If I use a label in the main program, I can't.


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 #5 on: November 29, 2012, 09:21:57 pm »
Grammer has no built in functions for reading archived content, unfortunately.

As to the pointers, yes, just find the number of bytes of each sprite as the offset. For example, say you store the sprites to appvar "Sprites" and these are your first few sprites:
Code: [Select]
:.A
:08081C3E1C7F3E7EFF7EFF7EFF3C1818  ;16 bytes (compressed)
:.C
:004428FE92FE                      ;6 bytes (compressed)
:.N
:08101C181E181D18391C391C389C389C18581878183808100000  ;26 bytes compressed
Then you could do something like this:
Code: [Select]
Get("USprites→w+16→s+6→a+26→b...
(Here, I used the pointers you use in your program).

I hope this helps!

P.S.: Here is a trick... In the Grammer program header, nothing is read by Grammer, but it is read by BASIC. This means you can do this:
Code: [Select]
.0:Pause "Grammer Required":Return

EDIT: The reason I always use the header ".0:Return" is because if Grammer isn't installed, the program won't run. If Grammer is installed, it reads the ".0:" and knows it is a Grammer program.

Offline persalteas

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 231
  • Rating: +44/-4
  • z80 poweeer
    • View Profile
    • Tout-82
Re: Grammer Grayscale Ghristmas Game
« Reply #6 on: December 13, 2012, 07:46:45 am »
I have another question.

What do you do if you want the getkey to be very very less precise ?

(If I press the key one time, it drops something like 2 or 3 packs at the time...)

And this is the same problem when leaving the game: Exit by pressing the [zoom] key would display the Zoom Menu after the program end...


Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Grammer Grayscale Ghristmas Game
« Reply #7 on: December 13, 2012, 10:20:25 am »
if you want key detection to be less precise then your only real option is to check every other frame rather than every single one (i guess you could do something with interrupts as well, but that would be annoying to handle). in order to make this less susceptible to missed keypresses, you could set a variable of some sort to be decremented every frame unless it equals zero. then, set a check on the keypress in question which requires that variable to be at 0 in order for the keypress to be detected. then, if the key is pressed, set the variable to some positive number (probably one or two).

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 #8 on: December 13, 2012, 12:07:31 pm »
You can also do this:
Code: [Select]
Repeat A=51    ;[ZOOM] is pressed
<<main code>>
End
While getKey    ;
End
Stop
Alternatively:
Code: [Select]
Repeat A=51    ;[ZOOM] is pressed
<<main code>>
End
Pause If getKey
Stop

These will not exit the program until no keys are being pressed. You can add something like Pause 5 or Pause 10 at the end for good measure.

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: Grammer Grayscale Ghristmas Game
« Reply #9 on: December 13, 2012, 06:51:25 pm »
wow, this is looking pretty nice so far, the cutszenes :D

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Grammer Grayscale Ghristmas Game
« Reply #10 on: December 13, 2012, 10:55:08 pm »
Looks interesting, and that fire animation at the start fits really well. :)

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 #11 on: December 14, 2012, 07:43:03 am »
Looks interesting, and that fire animation at the start fits really well. :)
Yes, I thought that was a rather awesome use of fire :D

Offline Stefan Bauwens

  • Creator of Myst 89 - סטיבן
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1799
  • Rating: +162/-24
  • 68k programmer
    • View Profile
    • Portfolio
Re: Grammer Grayscale Ghristmas Game
« Reply #12 on: December 14, 2012, 07:48:46 am »
That titlescreen along with the sprites look very pretty. Well done.
« Last Edit: December 14, 2012, 07:49:01 am by Stefan Bauwens »


Very proud Ticalc.org POTY winner (2011 68k) with Myst 89!
Very proud TI-Planet.org DBZ winner(2013)

Interview with me

Offline persalteas

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 231
  • Rating: +44/-4
  • z80 poweeer
    • View Profile
    • Tout-82
Re: Grammer Grayscale Ghristmas Game
« Reply #13 on: December 14, 2012, 05:04:03 pm »
Thank you everyone :)

I will try to use a variable as shmibs said.

Xeda, your example could be great if the problem was just to exit the program, but it's more complex :/

And, I am sorry, but this:
Code: [Select]
.0:Pause "Grammer Required":Returndoesn't work. The program is Paused or crashes when Grammer is installed.


( unlike, the "Get("USprites→w+16→s+6→a+26→b..." works very well, thanks. But I had to add a "-2" in front of that, I don't know why, but it works ! great. )


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 #14 on: December 15, 2012, 07:46:33 am »
Xeda, your example could be great if the problem was just to exit the program, but it's more complex :/
Ah, okay. Well, I also like to do this:
Code: [Select]
Repeat <<stuff>>    ;main loop
<<don't change A>>
Repeat A>0: and A≠B
A→B
getKey→A
End
<<don't change A>>
End


And, I am sorry, but this:
Code: [Select]
.0:Pause "Grammer Required":Returndoesn't work. The program is Paused or crashes when Grammer is installed.
It works when I do it D: Grammer should skip that line and go to the next one if it is installed (because any line starting with '.' is read as a label name).