
-----------------------------------
jrblast
Thu Dec 01, 2005 7:27 pm

Snake help please
-----------------------------------
Well, im making a snake game, i dont have computer sciences, but my friends do (class was full, so i didnt get it  :cry: ) but, i started playing with turing last week, (so dont expect my code to be good) and now im trying to make a snake game, so far...not too bad...except i cant figure out how to give the dot a tail, now i dont expect (or want) someone to finish the game for me, i just want a basic explanation of how i might make a tail, the source is 150 lines so far (well, about) so ill attach it so you dont have to scroll a billion lines to post...lol

o, and so far i have a tail, but its just a straight one

-----------------------------------
[Gandalf]
Thu Dec 01, 2005 9:36 pm


-----------------------------------
Oi...  indent your code.  Look up flexible arrays, and make your snake game grid-based.  Store the last location (on the grid if you are using one of each 'part' of the snake in the flexible array, and add an element when you 'eat' something.  

Also, when properly used, you should only have one View.Update in your program.  Your use of it in this case is strange, g2g

The code is exceptional for 1 week of experience, great job!

-----------------------------------
jrblast
Thu Dec 01, 2005 9:43 pm


-----------------------------------
"]Oi...  indent your code.  Look up flexible arrays, and make your snake game grid-based.  Store the last location (on the grid if you are using one of each 'part' of the snake in the flexible array, and add an element when you 'eat' something.  

Also, when properly used, you should only have one View.Update in your program.  Your use of it in this case is strange, g2g

The code is exceptional for 1 week of experience, great job!

 :oops: yah, i just learnt the View.Update function when i read it in another post, and as for the exceptional thing, well, i did know a bit (basic var get put and draw commands) of the program, plus i have a teensy bit of experience in php...i hate php, syntax is too complicated for me

ok, ill try that, thanks, but, i may have found another way, ill try that first...but ill look up the flexible array anyways, perhaps it might prove useful another time :D or even better than my way :P but, i wanna at least try the way i just htought of first...ill post back like tommorow

-----------------------------------
jrblast
Thu Dec 01, 2005 10:13 pm


-----------------------------------
:S i dont understand the flexible array hting, with the bonds and the blah blah blah, lol, perhaps in time i will :P

o, and anyone know why you cant edit posts??? i dont like having to double post...and possibly tripple :(

-----------------------------------
AzureFire
Thu Dec 01, 2005 11:17 pm


-----------------------------------
Here's my advice. Going from Turing to a REAL programming language is freaking hard. And since you didn't get the compsci course learn the basics of turing then move on to something less restricting, like C or C++. But that's just my opinion.

-----------------------------------
jrblast
Fri Dec 02, 2005 11:11 am


-----------------------------------
Here's my advice. Going from Turing to a REAL programming language is freaking hard. And since you didn't get the compsci course learn the basics of turing then move on to something less restricting, like C or C++. But that's just my opinion.

well i do eventualy want to, but i like turing for now, its nice and simpele :P, besides, i wanna make at least one program that uses the internet, and perhaps works with a php script i would attempt to design for it, kinda like bit torrent and trackers, except, not for dling stuff

-----------------------------------
Mr. T
Fri Dec 02, 2005 8:38 pm

Alex's Opinion
-----------------------------------
Here's sample code showing how a flexible array works. Try figuring out the components that make it function. 

var info : flexible array 1 .. 0 of int
var x, y, button, left : int
put "Click the mouse to update the array."
delay (1000)
cls
loop
    Mouse.ButtonChoose ("multibutton")
    Mouse.Where (x, y, button)
    left := button mod 10      % left = 0 or 1
    if left = 1 then
        new info, upper (info) + 1
        put upper (info)
    end if
    delay (100)
end loop

Good Luck.

-----------------------------------
Cervantes
Sat Dec 03, 2005 8:18 am


-----------------------------------
Here's my advice. Going from Turing to a REAL programming language is freaking hard. And since you didn't get the compsci course learn the basics of turing then move on to something less restricting, like C or C++. But that's just my opinion.
There are plenty of other languages out there than Java and C++.  I suggest learning Ruby after Turing.  [url=http://www.compsci.ca/v2/viewtopic.php?t=6439]Link!

-----------------------------------
MysticVegeta
Sat Dec 03, 2005 12:53 pm


-----------------------------------
I would have to say, Ruby is pretty good. First looked confusing to me, but when you get the hang of it, there are so useful predefined functions availabe, reducing the requirement of a loop.  :D

-----------------------------------
jrblast
Sat Dec 03, 2005 8:18 pm


-----------------------------------
ok, well ill go on to ruby after turing i guess, hopefully by next semester :razz: though id like to stop at some point and finish learning php lmao, i hate: that syntax :evil: or Very Mad thanks for the code Pwned

Well, i think ill give up on this for now perhaps in a week ill pick it up again, ty everyone

-----------------------------------
jrblast
Sun Dec 04, 2005 1:10 am


-----------------------------------
pardon the second double post, but

IM DONE!!! (i know i said i wouldnt continue till like next week, but i just didnt have the will power lol) suddenly i figured it out lmao!!! i decided well ill just give it a tail of a set length of 1 then that will be that, wont be snake but w/e, so i made tailx and taily get the values of x and y at the end of the loop, then i put in in a flexible array (thanks to pwned for that script which led to my understanding of it) and IM DONE!!!

-----------------------------------
[Gandalf]
Sun Dec 04, 2005 1:44 pm


-----------------------------------
Indeed...  Why not post it?

You don't like PHP's syntax?  Well, from what I have seen, it looks a lot like C++/Java syntax which a lot of languages stem out from.  It's not the only option, but it would be good to get used to ;).

-----------------------------------
jrblast
Sun Dec 04, 2005 6:02 pm


-----------------------------------
"]Indeed...  Why not post it?

You don't like PHP's syntax?  Well, from what I have seen, it looks a lot like C++/Java syntax which a lot of languages stem out from.  It's not the only option, but it would be good to get used to ;).

i will get used to the syntax because i need to, but for now :@:@:@:@:@:@:@:@:@ lol, o, and anyone know a way to use the Play.Sound  function but without pausing the script? anyways, ty again especialy pwned and gandalf

-----------------------------------
[Gandalf]
Sun Dec 04, 2005 6:29 pm


-----------------------------------
I've always done it so that if I want two different sounds playing at the same time, I have them in different formats - works for Turing.  For example, you can have a background mp3 running while playing a wav of an explosion.

-----------------------------------
jrblast
Sun Dec 04, 2005 8:01 pm


-----------------------------------
erm, im talking specificaly about the Music.Play and Music.Sound commands, the ones that play musical notes and headache frequencies...Is there a way to play that without pausing the program?

btw, heres the new source, still gonna upgrade it a bit etc...

-----------------------------------
ZeroPaladn
Mon Dec 05, 2005 10:08 am


-----------------------------------
lolz i tried playing at speed 1 and i died right on the spot. anyways, this game if freaking fun! (score 43 btw :p) good job with so little turing experience. i cant even make pong (the collision detection annoys me, and i have no patience) and ive taken 2 comp sci classes and been with turing for 3 years...

-----------------------------------
jrblast
Wed Dec 07, 2005 6:54 pm


-----------------------------------
lolz i tried playing at speed 1 and i died right on the spot. anyways, this game if freaking fun! (score 43 btw :p) good job with so little turing experience. i cant even make pong (the collision detection annoys me, and i have no patience) and ive taken 2 comp sci classes and been with turing for 3 years...

i think theres a collision detection guide on this forum, could be helpful to check it ou? besides, pong wouldnt be easy because of the angles and stuff, bleh! i couldnt make it either...i think, maybe i can get some ideas by looking at the asteroid game that comes with turing :P (turing folder/examples/fun/asteroid game , something like that)
