Play game
1K Puck Man #Pico1K's itch.io pageCharacters/Bytes used
992 chars
Source Code
_set_fps(60)n=mget::s::s=0f=0t={1,0,0,-1,-1,0,0,1}m=mset::l::r=0for i=0,672do j=i-384v=ord("###########1[C&2#C$B_TDB;SFbA[C9;SF&1[CB#CDbA[C3###B_TDB###1[CF9###bbJ++5BBLKK_bBEC+Z@JMM5Z@,%E_bB---``H++Ubb$###",i\6+1)-35k=1+v\2^(i%6)%2sset(16+i%48,i\48,k)m(j%17,j\17,k)end
m(8,9)g={}add(g,{x=8,y=9,d=1,l=0,n=1})for i=0,3do
add(g,{x=3+i%2*9,y=3+i\2*10,d=1,l=0})end
?"\asfc1c2g1ec2g1cc"
z=btn::_::cls(1)camera(4,4)pal({[0]=9,1,8})palt(0)map()pal()palt(1,1)f+=.5for i=1,#g do
e=g[i]k=7u=0v=0e.l+=.08d,x,y=e.d,e.x,e.y
if(d>0)u=t[d]v=t[d+1]
if e.l>=1then
e.l-=1x+=u
y+=v
if(i<2and n(x,y)>0)m(x,y)s+=1r+=1?"\as1ceg"
if(r>141)goto l
repeat
d=i>1and 1+((e.d-3)\2+rnd(3)\1)%4*2or e.n
u=t[d]v=t[d+1]
if(n(x+u,y+v)==1)d=0u=0v=0
until d>0or i<2end
e.d,e.x,e.y=d,x,y
if(i<2)k=(f%5)\1k=k<3and k+4or 9-k
if(z(0))e.n=5e.f=1
if(z(1))e.n=1e.f=nil
if(z(2))e.n=3
if(z(3))e.n=7
a=8*(x+e.l*u)b=8*(y+e.l*v)
if(i<2)p,q=a,b
if(i>1and abs(a-p)<2and abs(b-q)<2)goto s
pal(2,9+i)spr(k,a,b,1,1,e.f)end
?s,64,50,1
flip()goto _
Leave a comment
Log in with itch.io to leave a comment.
Comments
Thanks! Before ghost logic wasn't finished I wasn't sure if random movement would make for a challenging game. But 4 ghosts wandering in a small maze at the same fast speed as you move without stopping or getting stuck definitely gives it a nice difficulty.
got to like 110. How's the ai work for this? Can't understand the code above, Do u use some kind of pathfinding algorithm?
The key code for movement is:
d=i>1and 1+((e.d-3)\2+rnd(3)\1)%4*2or e.n
That code executes when a character reaches a 8x8 tile and decides in which direction index 1+2*(0...3) it moves afterwards. Player takes i=1 and follows the next movement you selected before reaching the cell (it's a bit buggy because in order to leave a straight movement you have to set new direction just before you arrive to the tile). Ghosts take a random direction as long as it's not blocked and is different from going back. So no pathfinding, only random movement plus some logic to avoid weird behaviour.
This is awesome! 👏😮
Looks, plays & sounds great.
Had no idea Pacman would be so much more stressful without the power pills!
Great entry. 👍
Thanks!
The gfx for the power pill is in the game. But implementing it would have required some more chars... Anyway, it adds to the difficulty, along the nasty bug which requires very precise timing for turning at intersections without getting stuck.