LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-23-2012, 11:20 AM   #1
Sajin
LQ Newbie
 
Registered: Sep 2012
Posts: 7
Blog Entries: 1

Rep: Reputation: Disabled
Unhappy Pacman problem


how i can make the ghosts to appear in the C++ language and what the command to generate random numbers
 
Old 09-26-2012, 04:43 PM   #2
Snark1994
Senior Member
 
Registered: Sep 2010
Distribution: Debian
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
Well... What have you done so far? Have you done any C++ coding?

For the first question, look at the SDL library.

For the second question, google for "C++ random number", you'll find it most helpful.
 
Old 09-26-2012, 05:24 PM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
I don't know what SDL is---I assume some kind of graphics interface?

Sajin;
Reading between the lines, it appears you want images of ghosts as part of programming a Pacman game. If that's correct, then we would need to know what kind of graphics environment you are working in, and what operating system you are coding for.
 
Old 09-27-2012, 07:51 AM   #4
Snark1994
Senior Member
 
Registered: Sep 2010
Distribution: Debian
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
Oh, I thought it was fairly common. It's a cross-platform library which hides a lot of the gory details of opening windows and drawing to them: http://www.libsdl.org/. I use it for writing any/all applications which don't have a traditional UI (such as games).

I assumed he was asking "how can I draw a pacman ghost using C++?" in which case SDL is a pretty easy general solution
 
Old 09-27-2012, 08:01 AM   #5
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
There are quite a few sites out there which describe, via reverse-engineering of the original Z-80 program, exactly how PacMan works.
 
Old 09-27-2012, 10:30 AM   #6
resetreset
Senior Member
 
Registered: Mar 2008
Location: Cyberspace
Distribution: Dynebolic, Ubuntu 10.10
Posts: 1,340

Rep: Reputation: 62
Pacman was originally a Z80 program???!! Wow, didn't know that, thanks! (grew up on a Z80 machine).

How do I Google for these sites, sundial?
 
Old 09-27-2012, 12:28 PM   #7
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
Here are just a few . . .

The Pac-Man Dossier

Pac-Man's Ghost Behavior Analyzed and Fixed

Pac-Man's Split Screen Behavior Analyzed and Fixed

PIE - PacMan Instructional Emulator

... and last but not least ... Click Me!

while (addicted) {
gobblegobblegobblegobble wockawockawockawocka booooooooooop! awww....
}

Last edited by sundialsvcs; 09-27-2012 at 12:30 PM.
 
Old 09-27-2012, 04:38 PM   #8
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,225

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
LÖVE is a better tool for the job. Much easier than a C++ framework like SDL. (But yes, if you must use C++ for some reason then use SDL).

Also, am I the only person who clicked on this thread thinking it would be about the package manager?

Last edited by dugan; 09-27-2012 at 04:45 PM.
 
Old 09-27-2012, 04:44 PM   #9
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Quote:
Originally Posted by dugan View Post
Honestly, the best tool for this job is really LÖVE. Much easier than a C++ framework like SDL.
Probably (I would prefer Pygame, but it is only a Python binding to SDL), but nonetheless of no use to the OP, who specifically asked about C++.
 
Old 09-27-2012, 04:47 PM   #10
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,225

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
Just because the OP specifically asked about C++ does not necessarily mean that he can't reevaluate his decision to use C++. He may well have chosen C++ because he didn't know about alternatives. It might not be too late to make a more appropriate choice.

Last edited by dugan; 09-27-2012 at 04:50 PM.
 
Old 09-27-2012, 05:02 PM   #11
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Quote:
Originally Posted by dugan View Post
Just because the OP specifically asked about C++ does not necessarily mean that he can't reevaluate his decision to use C++. He may well have chosen C++ because he didn't know about alternatives. It might not be too late to make a more appropriate choice.
True, but previous posts of the OP indicate that he is taking a course, so I don't think he has the chance to choose a language of choice.
 
Old 09-27-2012, 05:04 PM   #12
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,225

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
I'm sorry to say that I missed those previous posts. Thanks for clarifying that.
 
Old 09-29-2012, 10:48 AM   #13
Snark1994
Senior Member
 
Registered: Sep 2010
Distribution: Debian
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
Quote:
Originally Posted by dugan View Post
Also, am I the only person who clicked on this thread thinking it would be about the package manager?
And no, no you weren't - I did a bit of a double-take when I saw the question, until I realised what ey meant...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Why do we need pacman-key if pacman checks md5? Mr. Alex Arch 5 03-09-2012 05:05 PM
Anyone else 'pacman -Sy' instead of simply 'pacman -S'-ing packages? Kenny_Strawn Arch 15 03-23-2011 01:09 PM
Pacman carlosinfl Linux - Games 4 02-13-2006 02:46 PM
pacman alaios Linux - Games 1 08-20-2005 03:34 AM
pacman problem, missing current ylikone Arch 3 12-17-2004 05:30 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration