Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 My Beta Pac-Man
Index -> Programming, Turing -> Turing Submissions
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Artimes




PostPosted: Fri Oct 15, 2004 9:21 pm   Post subject: My Beta Pac-Man

Well we were told we had to make Pac-Man for our grade 11 Comp Sci class as our Turing ISU (we will also have a VB ISU). We started the project the other day in class, and the teacher just tought us how to make a still Pac-Man move around the screen and a few people have Pac-Man chomping and have direction. Well I'm a good couple weeks ahead of the class.

My Pac-Man comes with a complete map, semi-easy movent (to be improved), dots to munch on, looping gates (those thingies at the side of the map), very few or no errors. The ghosts, AI, and scoring system will be added at a later date, along with a menu with a few options (such as difficulty).

If you wan the sourse code I'll private message it to you (I know some of my other classmates or on this forum and I don't want them to have my work Razz).

Tell me what you think, and if you have any suggestions or ideas that may be helpful in my programming.

Pac-Man (277k)
Sponsor
Sponsor
Sponsor
sponsor
Delos




PostPosted: Fri Oct 15, 2004 10:05 pm   Post subject: (No subject)

Woah...

Ok, first off, not a bad job. Could be quite some better though.
Your movement! Your movement! It's nice and simple to have it as "pacManX += 1" when you press the arrow, but that's just not realistic. For a Pac Man emulation, try to make it so that you press a key, and it moves a set distance, such as the distance that would contain an entire Pacman...but that's just my interpretation.

There are a number of places where your collision detection is off, so it thinks there's a wall where there isn't one.

Look forward to your completed project in the coming weeks.
Artimes




PostPosted: Fri Oct 15, 2004 10:13 pm   Post subject: (No subject)

Well Pac-Man accualy moves 5 pixels every times Razz That helps a bit, but I should make it a little more. And what parts are the collision detection off?
wtd




PostPosted: Fri Oct 15, 2004 10:59 pm   Post subject: (No subject)

Spiffy.

As for the movement issue, perhaps you already do things this way, but you could create a two dimensional array of "spaces".

Essentially each "space" would have a number of properties:

  • Is it a wall?
  • Is there something to eat here?
  • Is Pac Man here?
  • Is there an opponent here?


Then a movement "up" moves the pac man up one space, and you needn't worry about pixels. A draw procedure would take in a "space", and based on its properties, draw the space on the screen.

Some samples to demonstrate:

code:
type Point : record
   x, y : int := 1
end record

type Space : record
   wall, edible, pacman, opponent : boolean := false
end record

type PacMan : record
   lives, points : int
   position : Point
end record

procedure makeWall(var s : Space)
   s.wall := true
   s.edible := false
   s.pacman := false
   s.opponent := false
end makeWall

procedure drawSpace(s : Space)
   if s.wall then
      % draw a wall segment
   elsif s.opponent then
      % draw an opponent
   elsif s.pacman
      % draw a pacman
   elsif s.edible then
      % draw food
   else
      % empty space
   end if
end drawSpace

var board := array 1..50, 1..50 of Space
josh




PostPosted: Sat Oct 16, 2004 9:12 am   Post subject: (No subject)

wow, this is pretty good for a beta version but their was a few places on the lower left side of the map that when I tried to turn into a new path it took me a few tries to get throgh. I don't know whether it was the collision detection or weather pacman was moving to fast. Also sometimes when you round a corner you get stuck with pacman half on the wall and half on the corner.

Other than that it is a gr8 first build.
Delos




PostPosted: Sat Oct 16, 2004 1:04 pm   Post subject: (No subject)

wtd has it down pat. The problem with the 5-pixel movement is that at times you would see Packy shaving the bits of food...or getting caught at corners due to him not being completely aligned with the paths.

As for the collision detection problems...umm...it was somewhere in the lower left hand area at one + junction. You could move along the L-R area, but the U-D part appeared blocked.
Genesis




PostPosted: Sat Oct 16, 2004 1:21 pm   Post subject: (No subject)

Nice! But like everyone else has said, the 5 pixel movement creates a few glitches. Like on the left side of the screen, I tried to turn into that path that lets you go across to the other side, and I got stuck. Like I couldn't move anywhere, I could just change directions because the pac man wouldn't align with any route.

Good work though.
AsianSensation




PostPosted: Sun Oct 17, 2004 8:10 pm   Post subject: (No subject)

it's pretty cool, double plus bits.

+25 bits
Sponsor
Sponsor
Sponsor
sponsor
zomg




PostPosted: Mon Oct 25, 2004 11:06 am   Post subject: (No subject)

pretty sweet for a beta
nice work
proazn38




PostPosted: Wed Jan 25, 2006 2:51 pm   Post subject: thats good...but try this

this is pretty good...but try and do this one, it took me around 4days

Create a simple game. Place a "wall" in the centre of the screen with an opening in it which is 2x the Pacman's diameter. The Pacman should only be able to move from the left side of the screen to the right by passing through the gap in the wall. The Pacman will start on the left side of the screen, with a randomly located "pill" on the right side for the Pacman to devour. Once this pill has been eaten, a second pill will appear in a random location on the left side of the screen. The object of the game will be to devour the two pills in as short a time interval as possible.
1. To keep track of the time needed by the user to devour the two pills, look up the Turing time procedures wallclock and clock. One of these should be suitable. Write a brief summary of how each works.
2. To determine whether or not a pill has been "eaten", your program will have to calculate the distance between the centre of the pill and the centre of the Pacman. A little Pythagoras will help! If this distance is less than the sum of the radii of the pill and the Pacman, then the Pacman is touching the pill. Write the condition that you would use, assuming that the Pacman's centre is (x, y) and its radius is 20, while the pill's centre is (xPill, yPill) and its radius is 5.
3. In the diagram on the right, only the Pacman at A should be able to pass through the gap. Those at B and C should be able to move slightly closer to the wall, or along the wall, or away from the wall, but should not be able to move through or into the wall.
4. Add some graphics to the game!!
5. Your name, the date, and the assignment number are to be included in comments at the beginning of the listing.
TripleBla




PostPosted: Thu Jan 26, 2006 7:25 pm   Post subject: (No subject)

^--- Sounds far too much like someone who wants their CompSci project finished for them.
person




PostPosted: Thu Jan 26, 2006 7:34 pm   Post subject: (No subject)

proazn38 wrote:
5. Your name, the date, and the assignment number are to be included in comments at the beginning of the listing.


if ur gonna lie, at least make a beleivable one.
assignment number??? come on, at least take some effort and take that line out
Mr. T




PostPosted: Thu Jan 26, 2006 8:10 pm   Post subject: Alex's Opinion

I clicked the link, but I don't see where you download the file. Confused
Isaac




PostPosted: Thu Jan 26, 2006 8:13 pm   Post subject: Re: Alex's Opinion

Pwned wrote:
I clicked the link, but I don't see where you download the file. Confused

He posted this in 04'. Looks like he didn't continue his hosting for that domain.
Mr. T




PostPosted: Thu Jan 26, 2006 8:19 pm   Post subject: Alex's Opinion

Oh, I didn't realize someone revived a 2 year old topic. Evil or Very Mad
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 17 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: