Page 1 of 1

Packman

Posted: Mon Dec 13, 2004 10:03 am
by koopmicter
colorback (black)
cls
var x,y : int
x:=100
y:=100
var chars : array char of boolean
loop
Input.KeyDown (chars)

if chars (KEY_UP_ARROW) then
y:=y+5
end if
if chars (KEY_RIGHT_ARROW) then
x:=x+5
end if
if chars (KEY_LEFT_ARROW) then
x:=x-5
end if
if chars (KEY_DOWN_ARROW) then
y:=y-5
end if


drawfillarc (x,y,20,20,15,350,yellow)
delay(10)
cls

end loop


Ok that is all i have so far in the packman process because im stuck .. i dont no how to give it a perimitor or if it runs out side of the screen to come back around the opposit side just like the real packman ... and can someone help me on to draw a dot and if you go on it like your eating it then it dissapears .. and how i draw lines (i know how to do that) but to make sure the packman doesnt go out of the lines i make and stuf f.. can someone please help?


Archived topic from Iceteks, old topic ID:2920, old post ID:23796

Packman

Posted: Mon Dec 13, 2004 2:04 pm
by Death
To make pacman move to the other side of the screen, you need to know the size of the play area. If you have a screen 640 * 480, your MAX X value is 640 pixels and your MAX Y value is 480. So, if pacman strays too far to the right of the screen PASSED MAX X, then just have pacman's X value become 0. Seeing as whenever you move pacman, its X value increases 5 points. So, instead of doing that, just set the value to 0. Something like this:

IF X > MAXX THEN
X := 0
ELSIF X < 0 THEN
X: = 640
END IF

This is just a quick example of how it would be done. OBVIOUSLY pacman isn't going to be 1 PIXEL. That would be a pretty boring pacman, A DOT. So, you'll have to set a boundary for pacman (Like a square). So, pacman's center might be X, Y. Below is a picture of what I'm talking about.

PACMAN'S center is X, Y. Then the boundaries for pacman are calculated in 4 coordinates. I chose packman to be 20 PIXELS in size FROM top to bottom and left to right. It's ALLLL in the movement of pacman. So, if you want to wait for pacman's butt to be off the screen, you would need something like this:

IF X - 10 >= 640 THEN
X:=0
END IF

You see, this formula/comparison shows that if 10 pixels from pacman's CENTER POINT (so x - 10). If THAT value is greater than or equal to 640, then pacman's X value changes to 0 and when pacman is redrawn, he appears on the other side of the screen. Hopefully this helps. It's kind of hard to write in words, but hopefully it's clear enough.





Image


Archived topic from Iceteks, old topic ID:2920, old post ID:23798

Packman

Posted: Tue Dec 14, 2004 10:53 am
by koopmicter
sorry i am very thankful for your help but you see my teacher has taught me a lot but i am sort of doing this on my own so could you break it down for me? i just wana be able to make my packman dude eat the other dots on the screen just like the real packman .. and when he runs though one side he appears at the other .. and when i hit the key to go back he turns around and stuff .. maybe its to complex but if you could try explain it to me more simple i would be very grateful

Archived topic from Iceteks, old topic ID:2920, old post ID:23816

Packman

Posted: Tue Dec 14, 2004 3:49 pm
by Death
Ya, the pacman game seems simple enough, but it can be quite complex. One of the hardest parts of it being the GHOST'S AI and setting boundaries for pacman and the ghosts (so that they know where the walls are and don't go through them. What exactly have you learned so far in that class? There is a lot of coding that you'll need to know before you can begin to program the game

Archived topic from Iceteks, old topic ID:2920, old post ID:23822

Packman

Posted: Wed Dec 15, 2004 9:38 am
by koopmicter
well i learned almost a lot of stuff maybe not a lot for this game but i know a bit..

if statements
var - all except boolean
when and exit when and stuff like that
loops
pixels
stuff like that..

Archived topic from Iceteks, old topic ID:2920, old post ID:23845

Packman

Posted: Fri Dec 17, 2004 10:27 pm
by Death
Ya, you would need to know get ch commands as well as keyboarding values. Procedures and Functions will help ALOT (And ARE mandatory). Boundaries aren't really taught. You kind of have to figure it out on your own. I solid undertanding in graphics drawing and movement are essential.

Archived topic from Iceteks, old topic ID:2920, old post ID:23889