Computer Science Canada My Newbish Game |
Author: | PHP God [ Mon Apr 21, 2003 6:07 pm ] | ||||
Post subject: | My Newbish Game | ||||
I'm making a game where the user is prompted to select a character then select some starting coordinates and use the WSAD keys to move it around. Here is my code thus far (note it is not complete)
If you will examine the code at the very bottom
You will see I have used if statements and depending on input, I am trying to call a procedure. when I try to run my program, it says that moveUp and all the others are not declared, well. At the top I declared moveUp and I'm stuck. How do you call a procedure after a THEN statement? |
Author: | Tony [ Mon Apr 21, 2003 6:13 pm ] | ||
Post subject: | |||
you'd have to read a tutorial on procedures and fuctions, it might help out with examples. a quick guess is that procedures need to have parameters, even if you dont pass any values to it. Such as
notice that () in the procedure name. You might need to have it. Check tutorial for examples, its the best way to find errors - compare to working code |
Author: | Catalyst [ Mon Apr 21, 2003 6:47 pm ] | ||||||
Post subject: | |||||||
no, you dont need to do that in turing (ur prob thinking of c++) you can have something like
ne way the the only errors i get r concerning the other move procs not moveUp also turing may have caught this but
is never ended it shoudl be more like
[/code] |
Author: | Tony [ Mon Apr 21, 2003 7:01 pm ] |
Post subject: | |
ah yes... since you commented other procedures out, turing doesnt know what to call. also it seems you dont have "end if" in there |
Author: | Prince [ Mon Apr 21, 2003 7:07 pm ] |
Post subject: | |
its cus u hav the procedures moveDown, moveLeft and moveRight as comments (wit the % in front)... plus ders no code for it to b run in the first place |
Author: | Prince [ Mon Apr 21, 2003 7:08 pm ] |
Post subject: | |
nuts, u wer too quick for me tony ... lol |
Author: | PHP God [ Mon Apr 21, 2003 8:23 pm ] |
Post subject: | |
I know some are comments but moveUp isn't so it should work. my question was just in case you are illiterate, how do i call a procedure after a then statement? |
Author: | Tony [ Mon Apr 21, 2003 8:32 pm ] | ||
Post subject: | |||
just put its name there
|
Author: | Prince [ Mon Apr 21, 2003 9:29 pm ] |
Post subject: | |
think of it this way... if it worked wit one procedure (moveUp) wouldnt it click that doin the same thing would work wit all other procedures *note* : its times like this i agree wit tony's sig |
Author: | PHP God [ Thu Apr 24, 2003 10:39 am ] |
Post subject: | DUH!!! |
look heres an example. I have a bunch of ifs/elsifs if this = that then run if black = white then jump[/b end if notice the big red bolded ones? yeah, they are procedure name's we'll say, the procedures are all written and it doesn't matter what they say cuz thats not the point. notice how i put the procedure name after [b]then? well it won't run the procedur evn if the if's imply it should. |