Author Topic: Project Snake X - help  (Read 26174 times)

0 Members and 4 Guests are viewing this topic.

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Project Snake X - help
« Reply #30 on: August 12, 2010, 04:05:25 pm »
O.O Holy crap that deserves an A+ Imho. Thanks for that. So now I can continue making the game and There is a lot I don't know about. I'll edit this when i reach another problem.. (probably soon knowing me XD)

You know, if you really like a post you can click the little thumbs up in the upper right corner of it ;D

Offline Snake X

  • Ancient Veteran
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 810
  • Rating: +33/-8
    • View Profile
Re: Project Snake X - help
« Reply #31 on: August 12, 2010, 07:10:44 pm »
heh.. yeah. Ok now what im trying to do is to add another menu. I'm gonna try to make this one on my own but it might be a little difficult for me. Can you explain in specific the line:
min(max(K=1-(K=4)*8+M,28),52)→M>N-(M<N)+N→N

and even more specific what the M>N-(M<N)+N→N is about? That's probably the only thing that's left that confuses me. Thanks runner. After this, im bound to get it

edit: Yikes! I tried to make a new menu for the play menu to enter Different Modes!  :o so yeah. Here's what I got so far :S (I copied and modified some parts. O and P are corresponding to M and N (O-M and N-P). Y also corresponds to K. I'm gonna test this code out right now and see how it runs so far.. Also, X mode replaces the name of the mode that is going to be the main mode of the game (I wanted it to be secret until release)

edit 2: I tried to parse it after going through a lot of token fixing, and I seem to have stumbled upon an ERR: BAD SYMBOL when it just took me to an exclamation mark. I deleted the spacing to see if that was the problem or not, but it wasn't... I know an exclamation mark is not a bad symbol. The error is on !If O-28.

Code: [Select]
:.SNAKEX
:
:.<DATA>
:.LOGO
:[07C0000000000000000000001FE0000000000000000000001FF0000000780000000000003FF0000000FC0000000001F87FF7CF0000FC0000000787F87FF7DF87E0FC0000001F87F07BF7FF8FF0FC0000003F87E079E7FF8FF8FC0000003FC7C07F07FF9FFCFC1000001FEF807FE7FF8FFCFC7C00000FFF807FF7FF8FFCFDFE1E0007FF807FF7FF8FFEFDFE3FC003FF001FF7FF9FFEFFFC7FC001FE0001F7FF9FFEFFF8FFC001FF0039F7EF9FFEFFE0FFC000FF8079F7EFDFFEFFC1FBC001FFC0FFF7EFDFFEFFE1FFC003FFF0FFF7C30FFEFFE1FFC003FFFC7FE3C00FDFFFF1FF8007E7FC1F0000000EFDFFFDE00FC3FC00000000007CFEFBE01F83F80000000000187EFFE03F83F80000000000003E7FE03F8040000000000000003FC03F00000000000000000000000E]→Pic1
:
:.MENU RAIN
:[8080808000000000]→Pic2
:
:.MENU ARROW
:[0010181C18100000]→Pic3
:
:.MENU ITEMS
:"PLAY"→Str1
:"HELP"→Str2
:"SCORES"→Str3
:"QUIT"→Str4
:"SELECT GAME MODE"→Str5
:"X MODE"→Str6
:"TIMED MODE"→Str7
:"CLASSIC MODE"→Str8
:"MAIN MENU"→Str9
:
:
:.<INITIALIZING>
:DiagnosticOff
:ClrDraw
:ClrDrawr
:
:.STORE MENU TO BACK BUFFER
:Fix 1
:Fix 5
:Text(30,28→M→N,Str1)
:Text(30,36,Str2)
:Text(30,44,Str3)
:Text(30,52,Str4)
:DrawInv
:StorePic
:ClrDraw
:
:.INTRO EFFECT
:For(A,0,63)
:  Line(0,A,95,63-A)
:  DispGraph
:End
:For(A,0,95)
:  Line(A,0,95-A,63)
:  DispGraph
:End
:
:1→A→Z
:
:
:.<MENU LOOP>
:Repeat getKey→K=9 and (M=N) or (K=15)
:
:  .MOVE CURSOR
:  .Update the cursor destination and current position, although does not draw cursor
:  min(max(K=1-(K=4)*8+M,28),52)→M>N-(M<N)+N→N
:
:  .ADD RAIN
:  .Add a new rain sprite every 5 iterations of the menu loop
:  DS<(A,5)
:    Pt-Change(rand^96,1,Pic2)
:  End
:
:  .DRAW LOGO AND MENU
:  .Shift sandstorm
:  Z+1→Z
:  .Move rain down
:  Vertical +
:  .Backup rain image
:  conj(L6,L1,708)
:  .Draw logo, sandstorm, menu, and cursor
:  sub(DM)
:  .Update screen
:  DispGraph
:  .Restore rain image
:  conj(L1,L6,708)
:
:End
:
:
:.<MENU HANDLER>
:Fix 1
:Fix 5
:ClrHome
:
:.If user did not quit
:If K-15 and (M-52)
:
:  .If PLAY
:  !If M-28
:      .ADD RAIN
:
:Repeat getKey→X=15 or (X=9)
:  DS<(A,5)
:    Pt-Change(rand^96,1,Pic2)
:  End
:
:  Vertical +
:  DispGraph
:End
:Text(30,18,Str5)
:Text(30,28→O→P,Str6)
:Text(30,36,Str7)
:Text(30,44,Str8)
:Text(30,52,Str9)
:
:Repeat getKey→Y=9 and (O=P) or (K=15)
:  min(max(Y=1-(Y=4)*8+O,28),52)→O>P-(O<P)+P→P
:
:  For(B,168,353)
:    .Menu image - End state: White text on black bg
:    .AND Rain image - If either is white (0 - menu text and rain droplets), result will be white (0) - End state: White menu items and rain on black bg
:    .→ Buffer
:    {B*2+L3}r∙{B*2+L6→C}r→{C}r
:  End
:  Pt-On(22,P,Pic3)
:  Pt-Change(22,P,Pic3)
:<MENU HANDLER>
:       !if O-28
:       sub(X
:       End
:       !if O-36
:       sub(TM
:       End
:       !if O-44
:       sub(Cl
:       !f O-52
:       End
:End
:  .If HELP
:  !If M-36
:    .<code>
:  End
:
:  .If SCORES
:  !If M-44
:    .<code>
:  End
:
:.If QUIT
:Else
:  Disp Str4
:End
:Return
:
:
:.<SUBROUTINES>
:.DRAW MENU
:Lbl DM
:
:  .DRAW LOGO AND SANDSTORM
:  .Loop through the logo, 2 bytes at a time
:  For(B,0,148)
:    .Logo data - End state: Black logo image on white bg
:    .XOR 65535 - Inverts logo data - End state: White logo image on black bg
:    .AND Rain image - If either is white (0), output is white, so logo and rain remain white - End state: White logo image and white rain on black bg
:    .OR *Must wait for data in parentheses to be parsed* :
:      .Sandstorm garbage
:      .AND Logo data - This is the original, black on white logo. For the outside of the logo text, which is white (0), all ANDs will result in staying white (no change, so outside of logo text is unaffected) - The black text of the logo is all black (1), so the end state will be determined by the random data of the sandstorm - End state: Random black/white image on white bg
:    .OR ^ - The only areas of ^ which can be black are the logo text, so everything outside the logo text will be unaffected, while areas inside (previously white) will take on the random sandstorm image - End state: Sandstorm logo image and white rain on black bg
:    .→ Buffer
:    {B*2+Pic1}r→D□65535∙{B*2+L6→C}r┼({B*2+Z}r∙D)→{C}r
:  End
:
:  .DRAW MENU ITEMS
:  .Loop through the menu image, 2 bytes at a time
:  For(B,168,353)
:    .Menu image - End state: White text on black bg
:    .AND Rain image - If either is white (0 - menu text and rain droplets), result will be white (0) - End state: White menu items and rain on black bg
:    .→ Buffer
:    {B*2+L3}r∙{B*2+L6→C}r→{C}r
:  End
:
:  .DRAW CURSOR
:  .Draw black cursor, turning any rain that might have been there black
:  Pt-On(22,N,Pic3)
:  .Invert cursor, turning cursor white
:  Pt-Change(22,N,Pic3)
:
:Return
:
:LBL X
:Return
:LBL TM
:Return
:LBL CL
:Return
:
:.<VARIABLES>
:.A=Counter to add rain
:.B=Temp loop variable for Lbl DM
:.C=Temp
:.D=Temp
:.K=getKey
:.M=Menu cursor destination
:.N=Menu cursor current display position
:.Z=Sandstorm offset
:.L1=Rain image backup
:.L3=Menu items image
:.L6=Rain image
« Last Edit: August 12, 2010, 10:10:16 pm by Snake X »
Loved this place, still the best producers of power metal, and sparked my dreams of coding.

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Project Snake X - help
« Reply #32 on: August 12, 2010, 10:17:51 pm »
The "<MENU HANDLER>" comment doesn't have a period in front of it.  Was that just a typo or did you actually forget it?  That could be the problem.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Snake X

  • Ancient Veteran
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 810
  • Rating: +33/-8
    • View Profile
Re: Project Snake X - help
« Reply #33 on: August 13, 2010, 06:24:27 pm »
Ah. that would be the solution! thanks for that. Next problem: its all compiled, but when i ran it, the code for the original menu got messed up. I have no idea where to begin to debug that thing!  ???

edit: attached screenie. When the deformed curser goes away and it speeds up was when i pressed enter while it was on play.

edit: here it goes.. im spilling the beans. Well, ive been keeping my secret mode for a while now and ive wanted it to be a nice supprise. But, it was kind of obvious, and I would definitely need help on it. So, here goes...
My original idea was to have wall's/courses to navigate through to get to the dot. some supprise, eh? Well, i then came up with an idea to combine the game with pacman principals to create a pacman-like field to collect all the dots to advance to the next level. No ghosts of course. I was initially going to start out with 20 levels.. fat chance. 10 levels I think will be sufficient for this game. This now free's me up to ask for help when i need it ESPECIALLY with wall detection x.x.

Code: [Select]
:.SNAKEX
:
:.<DATA>
:.LOGO
:[07C0000000000000000000001FE0000000000000000000001FF0000000780000000000003FF0000000FC0000000001F87FF7CF0000FC0000000787F87FF7DF87E0FC0000001F87F07BF7FF8FF0FC0000003F87E079E7FF8FF8FC0000003FC7C07F07FF9FFCFC1000001FEF807FE7FF8FFCFC7C00000FFF807FF7FF8FFCFDFE1E0007FF807FF7FF8FFEFDFE3FC003FF001FF7FF9FFEFFFC7FC001FE0001F7FF9FFEFFF8FFC001FF0039F7EF9FFEFFE0FFC000FF8079F7EFDFFEFFC1FBC001FFC0FFF7EFDFFEFFE1FFC003FFF0FFF7C30FFEFFE1FFC003FFFC7FE3C00FDFFFF1FF8007E7FC1F0000000EFDFFFDE00FC3FC00000000007CFEFBE01F83F80000000000187EFFE03F83F80000000000003E7FE03F8040000000000000003FC03F00000000000000000000000E]→Pic1
:
:.MENU RAIN
:[8080808000000000]→Pic2
:
:.MENU ARROW
:[0010181C18100000]→Pic3
:
:.MENU ITEMS
:"PLAY"→Str1
:"HELP"→Str2
:"SCORES"→Str3
:"QUIT"→Str4
:"SELECT GAME MODE"→Str5
:"X MODE"→Str6
:"TIMED MODE"→Str7
:"CLASSIC MODE"→Str8
:"MAIN MENU"→Str9
:
:
:.<INITIALIZING>
:DiagnosticOff
:ClrDraw
:ClrDrawr
:
:.STORE MENU TO BACK BUFFER
:Fix 1
:Fix 5
:Text(30,28→M→N,Str1)
:Text(30,36,Str2)
:Text(30,44,Str3)
:Text(30,52,Str4)
:DrawInv
:StorePic
:ClrDraw
:
:.INTRO EFFECT
:For(A,0,63)
:  Line(0,A,95,63-A)
:  DispGraph
:End
:For(A,0,95)
:  Line(A,0,95-A,63)
:  DispGraph
:End
:
:1→A→Z
:
:
:.<MENU LOOP>
:Repeat getKey→K=9 and (M=N) or (K=15)
:
:  .MOVE CURSOR
:  .Update the cursor destination and current position, although does not draw cursor
:  min(max(K=1-(K=4)*8+M,28),52)→M>N-(M<N)+N→N
:
:  .ADD RAIN
:  .Add a new rain sprite every 5 iterations of the menu loop
:  DS<(A,5)
:    Pt-Change(rand^96,1,Pic2)
:  End
:
:  .DRAW LOGO AND MENU
:  .Shift sandstorm
:  Z+1→Z
:  .Move rain down
:  Vertical +
:  .Backup rain image
:  conj(L6,L1,708)
:  .Draw logo, sandstorm, menu, and cursor
:  sub(DM)
:  .Update screen
:  DispGraph
:  .Restore rain image
:  conj(L1,L6,708)
:
:End
:
:
:.<MENU HANDLER>
:Fix 1
:Fix 5
:ClrHome
:
:.If user did not quit
:If K-15 and (M-52)
:
:  .If PLAY
:  !If M-28
:      .ADD RAIN
:
:Repeat getKey→X=15 or (X=9)
:  DS<(A,5)
:    Pt-Change(rand^96,1,Pic2)
:  End
:
:  Vertical +
:  DispGraph
:End
:Text(30,18,Str5)
:Text(30,28→O→P,Str6)
:Text(30,36,Str7)
:Text(30,44,Str8)
:Text(30,52,Str9)
:
:Repeat getKey→Y=9 and (O=P) or (K=15)
:  min(max(Y=1-(Y=4)*8+O,28),52)→O>P-(O<P)+P→P
:
:  For(B,168,353)
:    .Menu image - End state: White text on black bg
:    .AND Rain image - If either is white (0 - menu text and rain droplets), result will be white (0) - End state: White menu items and rain on black bg
:    .→ Buffer
:    {B*2+L3}r∙{B*2+L6→C}r→{C}r
:  End
:  Pt-On(22,P,Pic3)
:  Pt-Change(22,P,Pic3)
:End
:.<MENU HANDLER>
:!If O-28
:sub(X
:End
:!If O-36
:sub(TM
:End
:!If O-44
:sub(CL
:End
:!If O-52
:End
:End
:  .If HELP
:  !If M-36
:    .<code>
:  End
:
:  .If SCORES
:  !If M-44
:    .<code>
:  End
:
:.If QUIT
:Else
:  Disp Str4
:End
:Return
:
:
:.<SUBROUTINES>
:.DRAW MENU
:Lbl DM
:
:  .DRAW LOGO AND SANDSTORM
:  .Loop through the logo, 2 bytes at a time
:  For(B,0,148)
:    .Logo data - End state: Black logo image on white bg
:    .XOR 65535 - Inverts logo data - End state: White logo image on black bg
:    .AND Rain image - If either is white (0), output is white, so logo and rain remain white - End state: White logo image and white rain on black bg
:    .OR *Must wait for data in parentheses to be parsed* :
:      .Sandstorm garbage
:      .AND Logo data - This is the original, black on white logo. For the outside of the logo text, which is white (0), all ANDs will result in staying white (no change, so outside of logo text is unaffected) - The black text of the logo is all black (1), so the end state will be determined by the random data of the sandstorm - End state: Random black/white image on white bg
:    .OR ^ - The only areas of ^ which can be black are the logo text, so everything outside the logo text will be unaffected, while areas inside (previously white) will take on the random sandstorm image - End state: Sandstorm logo image and white rain on black bg
:    .→ Buffer
:    {B*2+Pic1}r→D□65535∙{B*2+L6→C}r┼({B*2+Z}r∙D)→{C}r
:  End
:
:  .DRAW MENU ITEMS
:  .Loop through the menu image, 2 bytes at a time
:  For(B,168,353)
:    .Menu image - End state: White text on black bg
:    .AND Rain image - If either is white (0 - menu text and rain droplets), result will be white (0) - End state: White menu items and rain on black bg
:    .→ Buffer
:    {B*2+L3}r∙{B*2+L6→C}r→{C}r
:  End
:
:  .DRAW CURSOR
:  .Draw black cursor, turning any rain that might have been there black
:  Pt-On(22,N,Pic3)
:  .Invert cursor, turning cursor white
:  Pt-Change(22,N,Pic3)
:
:Return
:
:Lbl X
:Return
:Lbl TM
:Return
:Lbl CL
:Return
:
:.<VARIABLES>
:.A=Counter to add rain
:.B=Temp loop variable for Lbl DM
:.C=Temp
:.D=Temp
:.K=getKey
:.M=Menu cursor destination
:.N=Menu cursor current display position
:.Z=Sandstorm offset
:.L1=Rain image backup
:.L3=Menu items image
:.L6=Rain image
« Last Edit: August 13, 2010, 10:19:21 pm by Snake X »
Loved this place, still the best producers of power metal, and sparked my dreams of coding.

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Project Snake X - help
« Reply #34 on: August 14, 2010, 12:44:16 am »
The easiest way to do hit detection is a simple pixel test. This would cover both the walls and your tail, although you'd have to make sure to filter out collisions with dots so they can be handled differently.

Offline Snake X

  • Ancient Veteran
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 810
  • Rating: +33/-8
    • View Profile
Re: Project Snake X - help
« Reply #35 on: August 14, 2010, 09:21:01 am »
yes.. thank's for that suggestion.
Can you help me with my debugging situation though?

edit: that's weird.. I tried to add things step by step to find out what caused that menu to go bizarre, it happened right after I put in those extra strings!
edit 2: this is so weird! even after removing those extra strings to the way it was, it still doesn't fix it!  :-\ its if I add 1 more string, then it screws it all up. Which means.. my code actually works but either axe parser does this or Str5 is taken up temperately or something.

edit 3: I'm uploading a video. I think thats the best way to explain whats going on here. ill edit this edit when it uploads
« Last Edit: August 14, 2010, 11:18:57 am by Snake X »
Loved this place, still the best producers of power metal, and sparked my dreams of coding.

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Project Snake X - help
« Reply #36 on: August 14, 2010, 01:15:35 pm »
I don't know what's going on, I just copied the code you posted line for line, fixed the symbols so the calculator would accept it, and it runs fine. Here's the SourceCoder code:

Code: [Select]
:.SNAKEX
:
:.<DATA>
:.LOGO
:[07C0000000000000000000001FE0000000000000000000001FF0000000780000000000003FF0000000FC0000000001F87FF7CF0000FC0000000787F87FF7DF87E0FC0000001F87F07BF7FF8FF0FC0000003F87E079E7FF8FF8FC0000003FC7C07F07FF9FFCFC1000001FEF807FE7FF8FFCFC7C00000FFF807FF7FF8FFCFDFE1E0007FF807FF7FF8FFEFDFE3FC003FF001FF7FF9FFEFFFC7FC001FE0001F7FF9FFEFFF8FFC001FF0039F7EF9FFEFFE0FFC000FF8079F7EFDFFEFFC1FBC001FFC0FFF7EFDFFEFFE1FFC003FFF0FFF7C30FFEFFE1FFC003FFFC7FE3C00FDFFFF1FF8007E7FC1F0000000EFDFFFDE00FC3FC00000000007CFEFBE01F83F80000000000187EFFE03F83F80000000000003E7FE03F8040000000000000003FC03F00000000000000000000000E]→Pic1
:
:.MENU RAIN
:[8080808000000000]→Pic2
:
:.MENU ARROW
:[0010181C18100000]→Pic3
:
:.MENU ITEMS
:"PLAY"→Str1
:"HELP"→Str2
:"SCORES"→Str3
:"QUIT"→Str4
:"SELECT GAME MODE"→Str5
:"X MODE"→Str6
:"TIMED MODE"→Str7
:"CLASSIC MODE"→Str8
:"MAIN MENU"→Str9
:
:
:.<INITIALIZING>
:DiagnosticOff
:ClrDraw
:ClrDraw{^r}
:
:.STORE MENU TO BACK BUFFER
:Fix 1
:Fix 5
:Text(30,28→M→N,Str1)
:Text(30,36,Str2)
:Text(30,44,Str3)
:Text(30,52,Str4)
:DrawInv
:StorePic
:ClrDraw
:
:.INTRO EFFECT
:For(A,0,63)
:  Line(0,A,95,63-A)
:  DispGraph
:End
:For(A,0,95)
:  Line(A,0,95-A,63)
:  DispGraph
:End
:
:1→A→Z
:
:
:.<MENU LOOP>
:Repeat getKey→K=9 and (M=N) or (K=15)
:
:  .MOVE CURSOR
:  .Update the cursor destination and current position, although does not draw cursor
:  min(max(K=1-(K=4)*8+M,28),52)→M>N-(M<N)+N→N
:
:  .ADD RAIN
:  .Add a new rain sprite every 5 iterations of the menu loop
:  DS<(A,5)
:    Pt-Change(rand^96,1,Pic2)
:  End
:
:  .DRAW LOGO AND MENU
:  .Shift sandstorm
:  Z+1→Z
:  .Move rain down
:  Vertical +
:  .Backup rain image
:  conj({L6},{L1},708)
:  .Draw logo, sandstorm, menu, and cursor
:  sub(DM)
:  .Update screen
:  DispGraph
:  .Restore rain image
:  conj({L1},{L6},708)
:
:End
:
:
:.<MENU HANDLER>
:Fix 1
:Fix 5
:ClrHome
:
:.If user did not quit
:If K-15 and (M-52)
:
:  .If PLAY
:  !If M-28
:      .ADD RAIN
:
:Repeat getKey→X=15 or (X=9)
:  DS<(A,5)
:    Pt-Change(rand^96,1,Pic2)
:  End
:
:  Vertical +
:  DispGraph
:End
:Text(30,18,Str5)
:Text(30,28→O→P,Str6)
:Text(30,36,Str7)
:Text(30,44,Str8)
:Text(30,52,Str9)
:
:Repeat getKey→Y=9 and (O=P) or (K=15)
:  min(max(Y=1-(Y=4)*8+O,28),52)→O>P-(O<P)+P→P
:
:  For(B,168,353)
:    .Menu image - End state: White text on black bg
:    .AND Rain image - If either is white (0 - menu text and rain droplets), result will be white (0) - End state: White menu items and rain on black bg
:    .→ Buffer
:    {B*2+{L3}}{^r}{dot}{B*2+{L6}→C}{^r}→{C}{^r}
:  End
:  Pt-On(22,P,Pic3)
:  Pt-Change(22,P,Pic3)
:End
:.<MENU HANDLER>
:!If O-28
:sub(X
:End
:!If O-36
:sub(TM
:End
:!If O-44
:sub(CL
:End
:!If O-52
:End
:End
:  .If HELP
:  !If M-36
:    .<code>
:  End
:
:  .If SCORES
:  !If M-44
:    .<code>
:  End
:
:.If QUIT
:Else
:  Disp Str4
:End
:Return
:
:
:.<SUBROUTINES>
:.DRAW MENU
:Lbl DM
:
:  .DRAW LOGO AND SANDSTORM
:  .Loop through the logo, 2 bytes at a time
:  For(B,0,148)
:    .Logo data - End state: Black logo image on white bg
:    .XOR 65535 - Inverts logo data - End state: White logo image on black bg
:    .AND Rain image - If either is white (0), output is white, so logo and rain remain white - End state: White logo image and white rain on black bg
:    .OR *Must wait for data in parentheses to be parsed* :
:      .Sandstorm garbage
:      .AND Logo data - This is the original, black on white logo. For the outside of the logo text, which is white (0), all ANDs will result in staying white (no change, so outside of logo text is unaffected) - The black text of the logo is all black (1), so the end state will be determined by the random data of the sandstorm - End state: Random black/white image on white bg
:    .OR ^ - The only areas of ^ which can be black are the logo text, so everything outside the logo text will be unaffected, while areas inside (previously white) will take on the random sandstorm image - End state: Sandstorm logo image and white rain on black bg
:    .→ Buffer
:    {B*2+Pic1}{^r}→D{box}65535{dot}{B*2+{L6}→C}{^r}{cross}({B*2+Z}{^r}{dot}D)→{C}{^r}
:  End
:
:  .DRAW MENU ITEMS
:  .Loop through the menu image, 2 bytes at a time
:  For(B,168,353)
:    .Menu image - End state: White text on black bg
:    .AND Rain image - If either is white (0 - menu text and rain droplets), result will be white (0) - End state: White menu items and rain on black bg
:    .→ Buffer
:    {B*2+{L3}}{^r}{dot}{B*2+{L6}→C}{^r}→{C}{^r}
:  End
:
:  .DRAW CURSOR
:  .Draw black cursor, turning any rain that might have been there black
:  Pt-On(22,N,Pic3)
:  .Invert cursor, turning cursor white
:  Pt-Change(22,N,Pic3)
:
:Return
:
:Lbl X
:Return
:Lbl TM
:Return
:Lbl CL
:Return
:
:.<VARIABLES>
:.A=Counter to add rain
:.B=Temp loop variable for Lbl DM
:.C=Temp
:.D=Temp
:.K=getKey
:.M=Menu cursor destination
:.N=Menu cursor current display position
:.Z=Sandstorm offset
:.L1=Rain image backup
:.L3=Menu items image
:.L6=Rain image

Or were you referring to a problem with new code?
« Last Edit: August 14, 2010, 01:16:20 pm by Runer112 »

Offline Snake X

  • Ancient Veteran
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 810
  • Rating: +33/-8
    • View Profile
Re: Project Snake X - help
« Reply #37 on: August 14, 2010, 01:17:02 pm »
watch:


that was what was happening

edit: that code works.. hmm. Also, the menu that was supposedly supposed to show up when i press play isn't showing up. How would I fix that problem?
« Last Edit: August 14, 2010, 01:19:47 pm by Snake X »
Loved this place, still the best producers of power metal, and sparked my dreams of coding.

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Project Snake X - help
« Reply #38 on: August 14, 2010, 01:34:15 pm »
The easiest thing to do would be to simply reuse the menu code that already exists. To do that, you'd want to have a label before the menu loop so you can just jump to it from the play option. That menu system uses four entries, so you'd probably want to get rid of the "SELECT GAME MODE" item (since it's not an actual option anyways) and just display the actual entries (3 game modes, 1 return to main menu). To actually display the new entries, you'd have to use a modified version of the "STORE MENU TO BACK BUFFER" code with the different string pointers before entering the menu loop. You would now need more than one menu handler, so I suggest designating another variable to hold which menu you're in (just assign different menus arbitrary numbers) and simply check which menu you're in at the menu handler so it can be processed appropriately.

EDIT: By the way, this has always bugged me. Why does the banner in your signature say both "Windows 7 User" and "Think Different - Apple"
« Last Edit: August 14, 2010, 01:35:57 pm by Runer112 »

Offline Snake X

  • Ancient Veteran
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 810
  • Rating: +33/-8
    • View Profile
Re: Project Snake X - help
« Reply #39 on: August 14, 2010, 01:38:41 pm »
Right. The "SELECT GAME MODE" is the menu title.. just like all other menu's have titles. I did copy and paste the code and modified the variables to correspond to those that already exist (for example, M corresponds with O while N corresponds with P. X corresponds with K). The only thing I don't get now is what M>N-(M<N)+N→N does. That's the last bit of info before I can truly understand the whole entire program.

edit: I have a mac and i use bootcamp to dualboot with windows 7. That's goin away soon because im gonna get a laptop this christmas
edit 2: I have been working on the code so far and when I press play, it shows just the rain as it has been.. but the interesting part is when I press clear it then shows the new menu for a split second before ending the program as seen in the screenshot.
edit 3: modified the code a tiny bit and when I press play, and then press clear, it shows the main menu but faded! and the cursor scrolls! I added another screenshot to show.
code:
Code: [Select]
:.SNAKEX
:
:.<DATA>
:.LOGO
:[07C0000000000000000000001FE0000000000000000000001FF0000000780000000000003FF0000000FC0000000001F87FF7CF0000FC0000000787F87FF7DF87E0FC0000001F87F07BF7FF8FF0FC0000003F87E079E7FF8FF8FC0000003FC7C07F07FF9FFCFC1000001FEF807FE7FF8FFCFC7C00000FFF807FF7FF8FFCFDFE1E0007FF807FF7FF8FFEFDFE3FC003FF001FF7FF9FFEFFFC7FC001FE0001F7FF9FFEFFF8FFC001FF0039F7EF9FFEFFE0FFC000FF8079F7EFDFFEFFC1FBC001FFC0FFF7EFDFFEFFE1FFC003FFF0FFF7C30FFEFFE1FFC003FFFC7FE3C00FDFFFF1FF8007E7FC1F0000000EFDFFFDE00FC3FC00000000007CFEFBE01F83F80000000000187EFFE03F83F80000000000003E7FE03F8040000000000000003FC03F00000000000000000000000E]→Pic1
:
:.MENU RAIN
:[8080808000000000]→Pic2
:
:.MENU ARROW
:[0010181C18100000]→Pic3
:
:.MENU ITEMS
:"PLAY"→Str1
:"HELP"→Str2
:"SCORES"→Str3
:"QUIT"→Str4
:"SELECT GAME MODE"→Str5
:"X MODE"→Str6
:"TIMED MODE"→Str7
:"CLASSIC MODE"→Str8
:"MAIN MENU"→Str9
:
:
:.<INITIALIZING>
:DiagnosticOff
:ClrDraw
:ClrDraw{^r}
:
:.STORE MENU TO BACK BUFFER
:Fix 1
:Fix 5
:Text(30,28→M→N,Str1)
:Text(30,36,Str2)
:Text(30,44,Str3)
:Text(30,52,Str4)
:DrawInv
:StorePic
:ClrDraw
:
:.INTRO EFFECT
:For(A,0,63)
:  Line(0,A,95,63-A)
:  DispGraph
:End
:For(A,0,95)
:  Line(A,0,95-A,63)
:  DispGraph
:End
:
:1→A→Z
:
:
:.<MENU LOOP>
:Repeat getKey→K=9 and (M=N) or (K=15)
:
:  .MOVE CURSOR
:  .Update the cursor destination and current position, although does not draw cursor
:  min(max(K=1-(K=4)*8+M,28),52)→M>N-(M<N)+N→N
:
:  .ADD RAIN
:  .Add a new rain sprite every 5 iterations of the menu loop
:  DS<(A,5)
:    Pt-Change(rand^96,1,Pic2)
:  End
:
:  .DRAW LOGO AND MENU
:  .Shift sandstorm
:  Z+1→Z
:  .Move rain down
:  Vertical +
:  .Backup rain image
:  conj({L6},{L1},708)
:  .Draw logo, sandstorm, menu, and cursor
:  sub(DM)
:  .Update screen
:  DispGraph
:  .Restore rain image
:  conj({L1},{L6},708)
:
:End
:
:
:.<MENU HANDLER>
:Fix 1
:Fix 5
:ClrHome
:
:.If user did not quit
:If K-15 and (M-52)
:
:  .If PLAY
:  !If M-28
:      .ADD RAIN
:
:Repeat getKey→X=15 or (X=9)
:  DS<(A,5)
:    Pt-Change(rand^96,1,Pic2)
:  End
:
:  Vertical +
:  DispGraph
:End
:Text(30,18,Str5)
:Text(30,28→O→P,Str6)
:Text(30,36,Str7)
:Text(30,44,Str8)
:Text(30,52,Str9)
:
:Repeat getKey→Y=9 and (O=P) or (K=15)
:  min(max(Y=1-(Y=4)*8+O,28),52)→O>P-(O<P)+P→P
:
:sub(DSM)
:  .Update screen
:  DispGraph
:  .Restore rain image
:  conj({L1},{L6},708)
:
:  Pt-On(22,P,Pic3)
:  Pt-Change(22,P,Pic3)
:DispGraph
:End
:.<MENU HANDLER>
:!If O-28
:sub(X
:End
:!If O-36
:sub(TM
:End
:!If O-44
:sub(CL
:End
:!If O-52
:End
:End
:  .If HELP
:  !If M-36
:    .<code>
:  End
:
:  .If SCORES
:  !If M-44
:    .<code>
:  End
:
:.If QUIT
:Else
:  Disp Str4
:End
:Return
:
:
:.<SUBROUTINES>
:.DRAW MENU
:Lbl DM
:
:  .DRAW LOGO AND SANDSTORM
:  .Loop through the logo, 2 bytes at a time
:  For(B,0,148)
:    .Logo data - End state: Black logo image on white bg
:    .XOR 65535 - Inverts logo data - End state: White logo image on black bg
:    .AND Rain image - If either is white (0), output is white, so logo and rain remain white - End state: White logo image and white rain on black bg
:    .OR *Must wait for data in parentheses to be parsed* :
:      .Sandstorm garbage
:      .AND Logo data - This is the original, black on white logo. For the outside of the logo text, which is white (0), all ANDs will result in staying white (no change, so outside of logo text is unaffected) - The black text of the logo is all black (1), so the end state will be determined by the random data of the sandstorm - End state: Random black/white image on white bg
:    .OR ^ - The only areas of ^ which can be black are the logo text, so everything outside the logo text will be unaffected, while areas inside (previously white) will take on the random sandstorm image - End state: Sandstorm logo image and white rain on black bg
:    .→ Buffer
:    {B*2+Pic1}{^r}→D{box}65535{dot}{B*2+{L6}→C}{^r}{cross}({B*2+Z}{^r}{dot}D)→{C}{^r}
:  End
:
:  .DRAW MENU ITEMS
:  .Loop through the menu image, 2 bytes at a time
:  For(B,168,353)
:    .Menu image - End state: White text on black bg
:    .AND Rain image - If either is white (0 - menu text and rain droplets), result will be white (0) - End state: White menu items and rain on black bg
:    .→ Buffer
:    {B*2+{L3}}{^r}{dot}{B*2+{L6}→C}{^r}→{C}{^r}
:  End
:
:  .DRAW CURSOR
:  .Draw black cursor, turning any rain that might have been there black
:  Pt-On(22,N,Pic3)
:  .Invert cursor, turning cursor white
:  Pt-Change(22,N,Pic3)
:Return
:
:Lbl DSM
:.DRAW MENU ITEMS
:  .Loop through the menu image, 2 bytes at a time
:  For(B,168,353)
:    .Menu image - End state: White text on black bg
:    .AND Rain image - If either is white (0 - menu text and rain droplets), result will be white (0) - End state: White menu items and rain on black bg
:    .→ Buffer
:    {B*2+{L3}}{^r}{dot}{B*2+{L6}→E}{^r}→{E}{^r}
:  End
:
:  .DRAW CURSOR
:  .Draw black cursor, turning any rain that might have been there black
:  Pt-On(22,P,Pic3)
:  .Invert cursor, turning cursor white
:  Pt-Change(22,P,Pic3)
:Return
:
:Lbl X
:Return
:Lbl TM
:Return
:Lbl CL
:Return
:
:.<VARIABLES>
:.A=Counter to add rain
:.B=Temp loop variable for Lbl DM
:.C=Temp
:.D=Temp
:.E=Temp
:.K=getKey
:.M=Menu cursor destination
:.N=Menu cursor current display position
:.Z=Sandstorm offset
:.L1=Rain image backup
:.L3=Menu items image
:.L6=Rain image
« Last Edit: August 14, 2010, 02:27:33 pm by Snake X »
Loved this place, still the best producers of power metal, and sparked my dreams of coding.

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Project Snake X - help
« Reply #40 on: August 14, 2010, 06:17:12 pm »
Is there anything wrong with having the play menu be exactly like the main menu, with the rain and logo with sandstorm? If so, you don't even need to make a new menu loop or anything else fancy, you just need to redraw the menu items to the back buffer, invert it, and re-enter the menu loop that's already there. No new cursor position variables or new anything else needed. You will, however, need a new variable to keep track of which menu you're in, because both menus will bring you to the same menu handler system and you'll need to split that up based on what menu is currently active.

I still don't see why you need the select game mode text. If the user hits play and enters a menu with options like "timed mode" and "classic mode," I think they'll probably realize they're in the game mode selection menu.
« Last Edit: August 14, 2010, 06:17:59 pm by Runer112 »

Offline Snake X

  • Ancient Veteran
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 810
  • Rating: +33/-8
    • View Profile
Re: Project Snake X - help
« Reply #41 on: August 14, 2010, 07:00:19 pm »
Ok. Well, I'll go from there.. Thanks runner for all this. I truely understand (most) of the program now including most of the bitwise operations. I don't understand the point of 'C' since its only being stored to, and what the heck is M>N-(M<N)+N→N for? I would understand the ┼({B*2+Z}r∙D), but I don't need to for the moment. I'll edit this post when i need help again
« Last Edit: August 14, 2010, 07:17:27 pm by Snake X »
Loved this place, still the best producers of power metal, and sparked my dreams of coding.

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Project Snake X - help
« Reply #42 on: August 14, 2010, 07:34:46 pm »
C is not only being stored to, look at the end of the lines with C in it. As for M>N-(M<N)+N→N, there are three things being combining to get a new value of N. First, M>N will be 1 if M (destination) is greater than N (current position), so the expression will be 1 so far. Second is -(M<N), which will evaluate to -1 if M is less than N, so this subtracts 1 in this case. This can only be true if the first expression is false, so the expression will now equal 1 if M>N, -1 if M<N, or 0 is neither are true (M=N). This offset is then applied to N, either moving N in the appropriate direction towards M or, if N already equals M, not changing it at all.

Now, to address ┼({B*2+Z}r∙D). The loop this is in handles the logo part of the screen, and at this point in the calculation, is currently a completely white logo and rain on a black background. Inside of the parentheses, Z is the sandstorm offset, so {B*2+Z}r simple grabs the random sandstorm data. The next step is AND D. If you look back in the code, the line starts with {B*2+Pic1}→D, so D will contain the original, black logo on white background data. Combining these too with AND logic means that anything outside the logo, which is white (0) in D, will always be unaffected by the sandstorm data. The inside of the logo is black (1) in D, so the result of pixels inside the logo data will just be random according to the sandstorm. The final resulting image inside the parentheses will be a randomized sandstorm logo and a white background. This is then OR'ed onto everything else we have (a completely white logo and rain on a black background), so the white logo (before this) and the randomized logo (resulting from this) will combine to form a randomized logo, and the black background + white rain (before this) and the white background (resulting from this) will combine to form a black background + white rain. Final result: randomized logo with a black background and white rain on top of the background.
« Last Edit: August 14, 2010, 07:45:04 pm by Runer112 »

Offline Snake X

  • Ancient Veteran
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 810
  • Rating: +33/-8
    • View Profile
Re: Project Snake X - help
« Reply #43 on: August 14, 2010, 07:54:19 pm »
yeah, but C is only being something that is used for storing into.. what do you mean .→ Buffer though. I am assuming C represents the buffer? if so, then how is it being used when all there is is a →{C}r and nothing more?
« Last Edit: August 14, 2010, 08:00:18 pm by Snake X »
Loved this place, still the best producers of power metal, and sparked my dreams of coding.

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Project Snake X - help
« Reply #44 on: August 14, 2010, 08:09:32 pm »
Code: [Select]
{B*2+{L3}}{^r}{dot}{B*2+{L6}→C}{^r}→{C}{^r}
see where it says {B*2+{L6}->C}? well, L6 is the area of RAM that is the buffer. the buffer has to have an address in memory. so when you store B*2+L6 to C, that makes C "point" to the address of the buffer. then when it says ->{C}{^r}, it stores to the two bytes of where C points, which is the buffer.