Posted: Thu Dec 01, 2005 7:27 pm Post subject: 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 ) 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
Posted: Thu Dec 01, 2005 9:36 pm Post subject: (No subject)
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
Posted: Thu Dec 01, 2005 9:43 pm Post subject: (No subject)
[Gandalf] wrote:
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!
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 or even better than my way but, i wanna at least try the way i just htought of first...ill post back like tommorow
jrblast
Posted: Thu Dec 01, 2005 10:13 pm Post subject: (No subject)
:S i dont understand the flexible array hting, with the bonds and the blah blah blah, lol, perhaps in time i will
o, and anyone know why you cant edit posts??? i dont like having to double post...and possibly tripple
AzureFire
Posted: Thu Dec 01, 2005 11:17 pm Post subject: (No subject)
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
Posted: Fri Dec 02, 2005 11:11 am Post subject: (No subject)
AzureFire wrote:
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 , 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
Posted: Fri Dec 02, 2005 8:38 pm Post subject: Alex's Opinion
Here's sample code showing how a flexible array works. Try figuring out the components that make it function.
code:
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
Posted: Sat Dec 03, 2005 8:18 am Post subject: (No subject)
AzureFire wrote:
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. Link!
Sponsor Sponsor
MysticVegeta
Posted: Sat Dec 03, 2005 12:53 pm Post subject: (No subject)
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.
jrblast
Posted: Sat Dec 03, 2005 8:18 pm Post subject: (No subject)
ok, well ill go on to ruby after turing i guess, hopefully by next semester though id like to stop at some point and finish learning php lmao, i hate: that syntax 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
Posted: Sun Dec 04, 2005 1:10 am Post subject: (No subject)
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]
Posted: Sun Dec 04, 2005 1:44 pm Post subject: (No subject)
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
Posted: Sun Dec 04, 2005 6:02 pm Post subject: (No subject)
[Gandalf] wrote:
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]
Posted: Sun Dec 04, 2005 6:29 pm Post subject: (No subject)
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
Posted: Sun Dec 04, 2005 8:01 pm Post subject: (No subject)
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...