Computer Science Canada Pacman's mouth |
Author: | Insectoid [ Mon May 05, 2008 6:48 pm ] |
Post subject: | Pacman's mouth |
I used the search engine and got nothing. I am making a pacman program which I am going to use for my final project (My paint program is for comp. engineering) Today I finished making packman move around and not bump into things, as well as pointing him in a different direction. I would like to know how to make pacman's mouth open and close. How can I make his mouth move without interupting the rest of my program? I could use and fork a process, but that is not the smartest idea... p.s.- All my images were drawn in turing! (except the map) p.p.s.- The map sucks because I did it quickly to get the main algorithm to work. |
Author: | cavetroll [ Mon May 05, 2008 7:41 pm ] | ||
Post subject: | Re: Pacman's mouth | ||
Here is an example of a very ineloquent way of solving this problem. I'm not as familiar with the Sprite module as I could be.
Anything using the variables surrounded by the comments "MY ADDITION---------------------------------------" is my addition ![]() Basically it counts the number of frames that each picture has moved for and flips it accordingly. You can modify the speed of animation by changing the constant PAC_TIME. Please note: This is not an ideal solution nor a recommended one. It is simply an example of how it can be done, not how it should be done. As for how it should be done, I'm not really sure. |
Author: | Insectoid [ Mon May 05, 2008 8:01 pm ] |
Post subject: | RE:Pacman\'s mouth |
I guess variable += 1 is the same as variable := variable + 1 ? I get how you are doing it, and will find this very useful un my later programs. Thanks. |
Author: | cavetroll [ Mon May 05, 2008 8:15 pm ] | ||
Post subject: | Re: RE:Pacman\'s mouth | ||
insectoid @ Mon May 05, 2008 8:01 pm wrote: I guess variable += 1 is the same as variable := variable + 1 ?
Ya they are the same. You can also use the following (If not more):
|
Author: | isaiahk9 [ Fri May 09, 2008 3:24 pm ] |
Post subject: | RE:Pacman\'s mouth |
http://compsci.ca/v3/viewtopic.php?t=17932&highlight=pacman |