answersLogoWhite

0

What is the pacman embed code?

Updated: 10/26/2022
User Avatar

Wiki User

12y ago

Best Answer

The embed code is:

//

// PacMan

// Another 1 day game (created in 5 hours).

//

// (C)2000

// Brian Postma

//

import java.awt.*;

import java.applet.Applet;

public class PacMan extends Applet implements Runnable

{

Dimension d;

Font largefont = new Font("Helvetica", Font.BOLD, 24);

Font smallfont = new Font("Helvetica", Font.BOLD, 14);

FontMetrics fmsmall, fmlarge;

Graphics goff;

Image ii;

Thread thethread;

MediaTracker thetracker = null;

Color dotcolor=new Color(192,192,0);

int bigdotcolor=192;

int dbigdotcolor=-2;

Color mazecolor;

boolean ingame=false;

boolean showtitle=true;

boolean scared=false;

boolean dying=false;

final int screendelay=120;

final int blocksize=24;

final int nrofblocks=15;

final int scrsize=nrofblocks*blocksize;

final int animdelay=8;

final int pacanimdelay=2;

final int ghostanimcount=2;

final int pacmananimcount=4;

final int maxghosts=12;

final int pacmanspeed=6;

int animcount=animdelay;

int pacanimcount=pacanimdelay;

int pacanimdir=1;

int count=screendelay;

int ghostanimpos=0;

int pacmananimpos=0;

int nrofghosts=6;

int pacsleft,score;

int deathcounter;

int[] dx,dy;

int[] ghostx, ghosty, ghostdx, ghostdy, ghostspeed;

Image ghost1,ghost2,ghostscared1,ghostscared2;

Image pacman1, pacman2up, pacman2left, pacman2right, pacman2down;

Image pacman3up, pacman3down, pacman3left, pacman3right;

Image pacman4up, pacman4down, pacman4left, pacman4right;

int pacmanx, pacmany, pacmandx, pacmandy;

int reqdx, reqdy, viewdx, viewdy;

int scaredcount, scaredtime;

final int maxscaredtime=120;

final int minscaredtime=20;

final short level1data[] = {

19,26,26,22, 9,12,19,26,22, 9,12,19,26,26,22,

37,11,14,17,26,26,20,15,17,26,26,20,11,14,37,

17,26,26,20,11, 6,17,26,20, 3,14,17,26,26,20,

21, 3, 6,25,22, 5,21, 7,21, 5,19,28, 3, 6,21,

21, 9, 8,14,21,13,21, 5,21,13,21,11, 8,12,21,

25,18,26,18,24,18,28, 5,25,18,24,18,26,18,28,

6,21, 7,21, 7,21,11, 8,14,21, 7,21, 7,21,03,

4,21, 5,21, 5,21,11,10,14,21, 5,21, 5,21, 1,

12,21,13,21,13,21,11,10,14,21,13,21,13,21, 9,

19,24,26,24,26,16,26,18,26,16,26,24,26,24,22,

21, 3, 2, 2, 6,21,15,21,15,21, 3, 2, 2,06,21,

21, 9, 8, 8, 4,17,26, 8,26,20, 1, 8, 8,12,21,

17,26,26,22,13,21,11, 2,14,21,13,19,26,26,20,

37,11,14,17,26,24,22,13,19,24,26,20,11,14,37,

25,26,26,28, 3, 6,25,26,28, 3, 6,25,26,26,28 };

final int validspeeds[] = { 1,2,3,4,6,8 };

final int maxspeed=6;

int currentspeed=3;

short[] screendata;

public String getAppletInfo()

{

return("PacMan - by Brian Postma");

}

public void init()

{

short i;

GetImages();

screendata=new short[nrofblocks*nrofblocks];

Graphics g;

d = size();

setBackground(Color.black);

g=getGraphics();

g.setFont(smallfont);

fmsmall = g.getFontMetrics();

g.setFont(largefont);

fmlarge = g.getFontMetrics();

ghostx=new int[maxghosts];

ghostdx=new int[maxghosts];

ghosty=new int[maxghosts];

ghostdy=new int[maxghosts];

ghostspeed=new int[maxghosts];

dx=new int[4];

dy=new int[4];

GameInit();

}

public void GameInit()

{

pacsleft=3;

score=0;

scaredtime=maxscaredtime;

LevelInit();

nrofghosts=6;

currentspeed=3;

scaredtime=maxscaredtime;

}

public void LevelInit()

{

int i;

for (i=0; i<nrofblocks*nrofblocks; i++)

screendata[i]=level1data[i];

LevelContinue();

}

public void LevelContinue()

{

short i;

int dx=1;

int random;

for (i=0; i<nrofghosts; i++)

{

ghosty[i]=7*blocksize;

ghostx[i]=7*blocksize;

ghostdy[i]=0;

ghostdx[i]=dx;

dx=-dx;

random=(int)(Math.random()*(currentspeed+1));

if (random>currentspeed)

random=currentspeed;

ghostspeed[i]=validspeeds[random];

}

screendata[7*nrofblocks+6]=10;

screendata[7*nrofblocks+8]=10;

pacmanx=7*blocksize;

pacmany=11*blocksize;

pacmandx=0;

pacmandy=0;

reqdx=0;

reqdy=0;

viewdx=-1;

viewdy=0;

dying=false;

scared=false;

}

public void GetImages()

{

thetracker=new MediaTracker(this);

ghost1=getImage(getDocumentBase(),"pacpix/Ghost1.gif");

thetracker.addImage(ghost1,0);

ghost2=getImage(getDocumentBase(),"pacpix/Ghost2.gif");

thetracker.addImage(ghost2,0);

ghostscared1=getImage(getDocumentBase(),"pacpix/GhostScared1.gif");

thetracker.addImage(ghostscared1,0);

ghostscared2=getImage(getDocumentBase(),"pacpix/GhostScared2.gif");

thetracker.addImage(ghostscared2,0);

pacman1=getImage(getDocumentBase(),"pacpix/PacMan1.gif");

thetracker.addImage(pacman1,0);

pacman2up=getImage(getDocumentBase(),"pacpix/PacMan2up.gif");

thetracker.addImage(pacman2up,0);

pacman3up=getImage(getDocumentBase(),"pacpix/PacMan3up.gif");

thetracker.addImage(pacman3up,0);

pacman4up=getImage(getDocumentBase(),"pacpix/PacMan4up.gif");

thetracker.addImage(pacman4up,0);

pacman2down=getImage(getDocumentBase(),"pacpix/PacMan2down.gif");

thetracker.addImage(pacman2down,0);

pacman3down=getImage(getDocumentBase(),"pacpix/PacMan3down.gif");

thetracker.addImage(pacman3down,0);

pacman4down=getImage(getDocumentBase(),"pacpix/PacMan4down.gif");

thetracker.addImage(pacman4down,0);

pacman2left=getImage(getDocumentBase(),"pacpix/PacMan2left.gif");

thetracker.addImage(pacman2left,0);

pacman3left=getImage(getDocumentBase(),"pacpix/PacMan3left.gif");

thetracker.addImage(pacman3left,0);

pacman4left=getImage(getDocumentBase(),"pacpix/PacMan4left.gif");

thetracker.addImage(pacman4left,0);

pacman2right=getImage(getDocumentBase(),"pacpix/PacMan2right.gif");

thetracker.addImage(pacman2right,0);

pacman3right=getImage(getDocumentBase(),"pacpix/PacMan3right.gif");

thetracker.addImage(pacman3right,0);

pacman4right=getImage(getDocumentBase(),"pacpix/PacMan4right.gif");

thetracker.addImage(pacman4right,0);

try

{

thetracker.waitForAll();

}

catch (InterruptedException e)

{

return;

}

}

public boolean keyDown(Event e, int key)

{

if (ingame)

{

if (key null) {

thethread = new Thread(this);

thethread.start();

}

}

public void stop()

{

if (thethread != null) {

thethread.stop();

thethread = null;

}

}

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the pacman embed code?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the embed code for WeeWorld?

what is the embed code playlists


What is the pandanda embed code?

You can't embed Pandanda.


Who knows how to embed code in comments?

We could easily embed code in comments but they won't execute. Comments will start from &lt;!-- and end with --!&gt;.


What is a emble code?

Did you mean embed code? An embed code is HTML (web) code for embedding and image or video in a web page or blog. If you upload a video to youtube, you can get an embed code that links from your web page or blog to the video on youtube, so you can direct readers to the video.


What is the code for pacman in jingle brawl?

Pokemon


How do you get PR2 on a yolasite?

Get embed code from kongregate


How do you put playlist on xatspace?

You have to get the embed code of a playlist u want,and then put the embed code anywhere u want on ur xatspace :D


What is the minecraft embed code?

embed code is used for putting flash games/pictures on websites.in a sort redirect way. the embed code searches that web side for the item and copies that item to that area of the website and isn't technically on the website.minecraft doesn't have one.


What is the embed code for platform racing 3?

well, there is an embed code, but the game is linked specifically to sparkworkz.com so it won't work on another website. sorry


What does embed do on YouTube?

The embed code is for people who want to put their video on their own websites. Unless you are interested in coding and making websites, I wouldn't worry about embed codes.


What do you mean when you say Embed Video?

Embed video means to embed, or place, a video within the HTML code of the page you are posting on. You can add video using HTML code - you will need more then basic HTML knowledge. Embedding a video player plugin is much easier. You just need to embed simple code provided by plugin creator.


How do you make a loop wav in HTML?

You add the following to your embed code: loop="true" &lt;html&gt; &lt;embed src="my_file.wav" hidden="true" loop="true"&gt;&lt;/embed&gt; &lt;/html&gt;