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

0 Members and 1 Guest are viewing this topic.

Offline Snake X

  • Ancient Veteran
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 810
  • Rating: +33/-8
    • View Profile
Project Snake X - help
« on: August 08, 2010, 10:18:24 pm »
ok, so I have decided to start working on my snake game again so this time I will be sharing not the entire source code, but what I have produced so far because I need help on it. what I need help on is how the menu on this program works because i need to add the function to tell if someone has pressed enter or not. If you want to know.. runner made most of this code because im not that advanced, i just had my concepts :(

Code: [Select]
:.LOGO
:DiagnosticOff
:ClrDraw
:[07C0000000000000000000001FE00 \
00000000000000000001FF000000078 |
0000000000003FF0000000FC0000000 |
001F87FF7CF0000FC0000000787F87F |
F7DF87E0FC0000001F87F07BF7FF8FF |
0FC0000003F87E079E7FF8FF8FC0000 |
003FC7C07F07FF9FFCFC1000001FEF8 |
07FE7FF8FFCFC7C00000FFF807FF7FF |
8FFCFDFE1E0007FF807FF7FF8FFEFDF |
E3FC003FF001FF7FF9FFEFFFC7FC001 | SNAKE X LOGO
FE0001F7FF9FFEFFF8FFC001FF0039F |
7EF9FFEFFE0FFC000FF8079F7EFDFFE |
FFC1FBC001FFC0FFF7EFDFFEFFE1FFC |
003FFF0FFF7C30FFEFFE1FFC003FFFC |
7FE3C00FDFFFF1FF8007E7FC1F00000 |
00EFDFFFDE00FC3FC00000000007CFE |
FBE01F83F80000000000187EFFE03F8 |
3F80000000000003E7FE03F80400000 |
00000000003FC03F000000000000000 |
00000000E]→Pic1 /
:[0010181C18100000]→Pic3
:0→C
:"PLAY"→Str1
:"HELP"→Str2
:"SCORES"→Str3
:"QUIT"→Str4
:Fix 1
:Fix 5
:Text(30,28→M→N,Str1)
:Text(30,36,Str2)
:Text(30,44,Str3)
:Text(30,52,Str4)
:StorePic
:DrawInv {^r}
:ClrDraw \
:For(A,0,63) |
:Line(0,A,95,63-A) |
:DispGraph |
:End |This makes the screen black
:For(A,0,95) |
:Line(A,0,95-A,63) |
:DispGraph |
:End /
:1→A→Z
:[FDFDFDFDFFFFFFFF]→Pic2
:While getKey→K≠15
:If K=1
:min(M+8,52)→M
:End
:If K=4
:max(M-8,28)→M
:End
:M>N-(M<N)+N→N
:DS<(A,3
:Pt-Off(rand^96,A,Pic2)
:End
:Z+1→Z
:Vertical +
:conj({L6},{L1},708)
:sub(DM)
:DispGraph
:conj({L1},{L6},708)
:End
:Fix 0
:Fix 4
--------------------------
bitwise operations for logo (I think)
--------------------------
:Lbl DM
:For(B,0,148)
:{B*2+Pic1}{^r}→D{box}65535{dot}{B*2+{L6}→C}{^r}{cross}({B*2+Z}{^r}{dot}D)→{C}{^r}
:End
:For(B,168,353)
:{B*2+{L3}}{^r}{dot}{B*2+{L6}→C}{^r}→{C}{^r}
:End
:Pt-On(22,N,Pic3)
:Pt-Change(22,N,Pic3)
:Return
« Last Edit: August 08, 2010, 11:16:44 pm by Snake X »
Loved this place, still the best producers of power metal, and sparked my dreams of coding.

_player1537

  • Guest
Re: Project Snake X - help
« Reply #1 on: August 08, 2010, 11:01:42 pm »
Edit: Nevermind
« Last Edit: August 08, 2010, 11:24:41 pm by _player1537 »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Project Snake X - help
« Reply #2 on: August 08, 2010, 11:15:57 pm »
This is not for the contest I hope, right? (since it's against the rules to post executables of your entry)
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Snake X

  • Ancient Veteran
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 810
  • Rating: +33/-8
    • View Profile
Re: Project Snake X - help
« Reply #3 on: August 08, 2010, 11:18:11 pm »
uhh what executable?
* Snake X hides
what rule says no executables? I might have skipped that part. I did delete it before any downloads were made though
Loved this place, still the best producers of power metal, and sparked my dreams of coding.

_player1537

  • Guest
Re: Project Snake X - help
« Reply #4 on: August 08, 2010, 11:18:38 pm »
Change this line:
Code: [Select]
:While getKey→K≠15to:
Code: [Select]
:While getKey→K≠15 and (K≠9

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Project Snake X - help
« Reply #5 on: August 08, 2010, 11:22:45 pm »
OK thank you snake. Cuz if the count said 1 it could have been kinda bad x.x

Using too many source code from someone else can also affect originality score too, so you need to keep that in mind, too (especially since originality counts for 20% of the entire score)
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Snake X

  • Ancient Veteran
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 810
  • Rating: +33/-8
    • View Profile
Re: Project Snake X - help
« Reply #6 on: August 08, 2010, 11:25:58 pm »
yeah.. your welcome though :)
Loved this place, still the best producers of power metal, and sparked my dreams of coding.

_player1537

  • Guest
Re: Project Snake X - help
« Reply #7 on: August 08, 2010, 11:30:06 pm »
after these lines:
Code: [Select]
:Fix 0
:Fix 4
add some code like this:
Code: [Select]
If M=28
Do stuff for first option
End
if M=36
Second option
End
If M=44
Third option
End
If M=52
fourth option
End

Offline Snake X

  • Ancient Veteran
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 810
  • Rating: +33/-8
    • View Profile
Re: Project Snake X - help
« Reply #8 on: August 09, 2010, 12:21:25 am »
that didn't work when i put sub(XX in the if blocks.. I started lbl XX for the subroutines after the very last line (return)
Loved this place, still the best producers of power metal, and sparked my dreams of coding.

_player1537

  • Guest
Re: Project Snake X - help
« Reply #9 on: August 09, 2010, 12:33:17 am »
Just to clarify you've got something like this:
Code: [Select]
If M=something
Sub(XX)
End
Return
Lbl XX
Disp "BLAH
Return

Offline Snake X

  • Ancient Veteran
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 810
  • Rating: +33/-8
    • View Profile
Re: Project Snake X - help
« Reply #10 on: August 09, 2010, 10:17:36 am »
yes.. now to put in the function to detect if enter was pressed.

would it look like something like this:
Code: [Select]
while getkey != 9
If M=28
Do stuff for first option
End
if M=36
Second option
End
If M=44
Third option
End
If M=52
fourth option
End
End
Loved this place, still the best producers of power metal, and sparked my dreams of coding.

_player1537

  • Guest
Re: Project Snake X - help
« Reply #11 on: August 09, 2010, 10:29:34 am »
Oh, that's where your problem is I believe.  Go up to the loop earlier that says ":While getKey→K≠15" and change that line to ":While getKey→K≠15 and (K≠9"  Should fix it :D

Offline Snake X

  • Ancient Veteran
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 810
  • Rating: +33/-8
    • View Profile
Re: Project Snake X - help
« Reply #12 on: August 09, 2010, 10:51:29 am »
sorry m8 but that gave my calculator the brick (if you don't understand what that ment, basically that bricked my calculator)
Loved this place, still the best producers of power metal, and sparked my dreams of coding.

_player1537

  • Guest
Re: Project Snake X - help
« Reply #13 on: August 09, 2010, 11:13:15 am »
brick != crashed
crashed ~ endless loop.

You have an endless loop.

Which is quite wierd...

Edit:
Code: [Select]
:While getKey→K≠15to
Code: [Select]
:Repeat getkey(15) or Getkey(9)
:getkey->K
« Last Edit: August 09, 2010, 11:18:32 am by _player1537 »

Offline Snake X

  • Ancient Veteran
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 810
  • Rating: +33/-8
    • View Profile
Re: Project Snake X - help
« Reply #14 on: August 09, 2010, 11:29:29 am »
ok here's the updated code on what i have so far:
Code: [Select]
:.LOGO
:DiagnosticOff
:ClrDraw
:[07C0000000000000000000001FE0000000000000000000001FF0000000780000000000003FF0000000FC0000000001F87FF7CF0000FC0000000787F87FF7DF87E0FC0000001F87F07BF7FF8FF0FC0000003F87E079E7FF8FF8FC0000003FC7C07F07FF9FFCFC1000001FEF807FE7FF8FFCFC7C00000FFF807FF7FF8FFCFDFE1E0007FF807FF7FF8FFEFDFE3FC003FF001FF7FF9FFEFFFC7FC001FE0001F7FF9FFEFFF8FFC001FF0039F7EF9FFEFFE0FFC000FF8079F7EFDFFEFFC1FBC001FFC0FFF7EFDFFEFFE1FFC003FFF0FFF7C30FFEFFE1FFC003FFFC7FE3C00FDFFFF1FF8007E7FC1F0000000EFDFFFDE00FC3FC00000000007CFEFBE01F83F80000000000187EFFE03F83F80000000000003E7FE03F8040000000000000003FC03F00000000000000000000000E]→Pic1
:[0010181C18100000]→Pic3
:0→C
:"PLAY"→Str1
:"HELP"→Str2
:"SCORES"→Str3
:"QUIT"→Str4
:Fix 1
:Fix 5
:Text(30,28→M→N,Str1)
:Text(30,36,Str2)
:Text(30,44,Str3)
:Text(30,52,Str4)
:StorePic
:DrawInv r
:ClrDraw
: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
:[FDFDFDFDFFFFFFFF]→Pic2
:While getKey→K≠15
:If K=1
:min(M+8,52)→M
:End
:If K=4
:max(M-8,28)→M
:End
:M>N-(M<N)+N→N
:DS<(A,3
:Pt-Off(rand^96,A,Pic2)
:End
:Z+1→Z
:Vertical +
:conj(L6,L1,708)
:sub(DM)
:DispGraph
:conj(L1,L6,708)
:End
:Fix 0
:Fix 4
:Repeat getKey(9)
:If M=28
:sub(SX
:End
:If M=36
:sub(HP
:End
:If M=44
:sub(SC
:End
:If M=52
:End
:End
:Lbl DM
:For(B,0,148)
:{B*2+Pic1}r→D□65535∙{B*2+L6→C}r┼({B*2+Z}r∙D)→{C}r
:End
:For(B,168,353)
:{B*2+L3}r
Loved this place, still the best producers of power metal, and sparked my dreams of coding.