Computer Science Canada Problem with graphics movement... |
Author: | BladeOfDeath [ Sun Dec 07, 2003 1:09 am ] |
Post subject: | Problem with graphics movement... |
I am currently using an if statement for my pacman's mouth. The variable is mthCls. mthCls increases by 10 each time through the loop, I need it so that once mthCls equals 30 that it will go down to 0 and when it reaches 0 it will go back up again. Could you please help, my assignment is due soon... |
Author: | Homer_simpson [ Sun Dec 07, 2003 1:23 am ] | ||
Post subject: | |||
u mean something like this:
|
Author: | BladeOfDeath [ Sun Dec 07, 2003 2:16 am ] |
Post subject: | |
no i mean something like: mthCls:=0 --> mthCls:= 10 --> mthCls:=20 --> mthCls:=30 --> mthCls:=20 --> mthCls:=10 --> mthCls:=0 --> mthCls:=10 --> and repeats basically... if you can put that into an if statement i would really appreciate it... |
Author: | Tony [ Sun Dec 07, 2003 3:16 am ] |
Post subject: | |
well do what homer did with for loops. If you want it to look old-school like it used to be, you can add by 10, so that your forloops would increase/decrease by 10 instead. |
Author: | McKenzie [ Sun Dec 07, 2003 12:54 pm ] | ||
Post subject: | |||
The only problem with the For loop is that if you want to move Pacman around you're out of luck (doesn't sound like he needs to.) I keeping with your original idea, I would use a second variable that will keep track of how much to add on to your mthCls variable each time around the loop. Kinda like:
|
Author: | BladeOfDeath [ Sun Dec 07, 2003 4:14 pm ] |
Post subject: | |
Ill try that, I also have a problem with it being flashy... |
Author: | Tony [ Sun Dec 07, 2003 5:15 pm ] |
Post subject: | |
you have to use View.Update for animation not to flash. There's a tutorial on use of it available. |
Author: | BladeOfDeath [ Sun Dec 07, 2003 5:47 pm ] |
Post subject: | |
ok thanks for all your help everybody, I greatly appreciate it... |
Author: | BladeOfDeath [ Sun Dec 07, 2003 6:15 pm ] |
Post subject: | |
I tried the View.Update but it isnt working, ill upload the file... Oh by the way, I just started on it there are no levels. This is just the animations and dont change the random movements of the ghosts please... |
Author: | AsianSensation [ Sun Dec 07, 2003 6:52 pm ] |
Post subject: | |
are you using 4.0.x? you need the newest version of turing all patched to be able to use View.Update. another thing, try not to use process and fork, they are really really bad, almost as bad as whatdotcolor. |
Author: | BladeOfDeath [ Sun Dec 07, 2003 7:04 pm ] |
Post subject: | |
What else am i supposed to use? And i have 4.0.1p |
Author: | DanShadow [ Sun Dec 07, 2003 7:13 pm ] | ||
Post subject: | .. | ||
Or of course, you could do it 8th grader style! [This DOES NOT in any way reflect my intelligence....seriously]
|
Author: | BladeOfDeath [ Sun Dec 07, 2003 7:15 pm ] |
Post subject: | |
this is my ISU for comp sci, I take it very seriously... |
Author: | McKenzie [ Mon Dec 08, 2003 12:38 am ] | ||
Post subject: | |||
AZN is right. Too much forkn' around is going to be the source of endless headaches. The biggest problem is that the movement between Pac and the ghosts is not synchronized. What you need to do is simulate the simultanious movement yourself. Your mainline should look something like:
Because you move each character a small increment before you update the scene, they are, in effect, moving simultaneously |